1
1
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 05:11:06 +02:00

add comments

This commit is contained in:
Zack Scholl 2019-05-03 13:26:40 -07:00
parent d7da7ec1e7
commit 45a331f920

View file

@ -305,12 +305,16 @@ func (c *Client) Send(options TransferOptions) (err error) {
for { for {
data, _ := conn.Receive() data, _ := conn.Receive()
if bytes.Equal(data, []byte("ips?")) { if bytes.Equal(data, []byte("ips?")) {
// recipient wants to try to connect to local ips
var ips []string var ips []string
// only get local ips if the local is enabled
if !c.Options.DisableLocal { if !c.Options.DisableLocal {
// get list of local ips
ips, err = utils.GetLocalIPs() ips, err = utils.GetLocalIPs()
if err != nil { if err != nil {
log.Debugf("error getting local ips: %s", err.Error()) log.Debugf("error getting local ips: %s", err.Error())
} }
// prepend the port that is being listened to
ips = append([]string{c.Options.RelayPorts[0]}, ips...) ips = append([]string{c.Options.RelayPorts[0]}, ips...)
} }
bips, _ := json.Marshal(ips) bips, _ := json.Marshal(ips)