schollz / croc

Easily and securely send things from one computer to another :crocodile: :package:
https://schollz.com/software/croc6
MIT License
28.13k stars 1.12k forks source link

Local mode not working #85

Closed gh0st42 closed 6 years ago

gh0st42 commented 6 years ago

I just downloaded the newest version from github and build a croc binary myself. So far it only works (send and receive) if local mode is disabled (--no-local). Otherwise it always crashes:

~/LocalCode/go/src/github.com/schollz/croc$ ./croc 
panic: reflect: call of reflect.Value.Int on zero Value

goroutine 1 [running]:
reflect.Value.Int(0x0, 0x0, 0x0, 0x897b51)
    /usr/local/go/src/reflect/value.go:931 +0x127
golang.org/x/net/internal/netreflect.socketOf(0x8f3020, 0xc4200b8220, 0xc4200b8220, 0x8f3020, 0xc4200b8220)
    /home/gh0st42/LocalCode/go/src/golang.org/x/net/internal/netreflect/socket_posix.go:26 +0x196
golang.org/x/net/internal/netreflect.PacketSocketOf(0x8f2ba0, 0xc4200b8220, 0xc4200baa00, 0xc4200b8220, 0x8f3020)
    /home/gh0st42/LocalCode/go/src/golang.org/x/net/internal/netreflect/socket.go:33 +0x7d
golang.org/x/net/ipv4.(*dgramOpt).JoinGroup(0xc4200baa10, 0xc420183c00, 0x8eecc0, 0xc420079588, 0x10, 0x10)
    /home/gh0st42/LocalCode/go/src/golang.org/x/net/ipv4/dgramopt_posix.go:111 +0x55
github.com/schollz/peerdiscovery.Discover(0xc420079770, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/gh0st42/LocalCode/go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:141 +0x50e
github.com/schollz/croc/src.(*Croc).Receive(0xc420190000, 0x0, 0x0, 0x0, 0x0)
    /home/gh0st42/LocalCode/go/src/github.com/schollz/croc/src/api.go:139 +0x660
main.receive(0xc420114b00, 0xc4200798e8, 0x7aa1e6)
    /home/gh0st42/LocalCode/go/src/github.com/schollz/croc/main.go:123 +0xc4
main.main.func4(0xc420114b00, 0x8a1100, 0x17)
    /home/gh0st42/LocalCode/go/src/github.com/schollz/croc/main.go:77 +0x2b
github.com/urfave/cli.HandleAction(0x7fea60, 0x8b6088, 0xc420114b00, 0xc42010c6c0, 0x0)
    /home/gh0st42/LocalCode/go/src/github.com/urfave/cli/app.go:501 +0xc8
github.com/urfave/cli.(*App).Run(0xc42018c000, 0xc4200a8190, 0x1, 0x1, 0x0, 0x0)
    /home/gh0st42/LocalCode/go/src/github.com/urfave/cli/app.go:268 +0x60c
main.main()
    /home/gh0st42/LocalCode/go/src/github.com/schollz/croc/main.go:91 +0xb4a

The problem seems to be in if errJoinGroup := p2.JoinGroup(&ifaces[i], &net.UDPAddr{IP: group, Port: portNum}); errJoinGroup != nil { of peerdiscovery.go. I tried building the binary with go 1.9 and 1.10. Also skipping certain interfaces like loopback did not help.

Oh and my platform is Ubuntu 16.04 amd64. The prebuild binary from the releases page seems to work.

gh0st42 commented 6 years ago

Found out that I had an old $GOPATH/src/golang.org/x/net installation. Removing this and letting go rebuild everything seems to fix this. Maybe something for an FAQ. Too bad that go doesn't have real dependency version management yet.

schollz commented 6 years ago

@gh0st42 Thanks, thats weird. I'll just bundle dependencies with dep for now