croc: Croc fails if either machine lacks an IPv4 address

Please try to download the latest version of croc before reporting a bug!

Describe the bug I just tried croc between two machines on the same local network, both of which have routable public IPv6 addresses, but one of which has no IPv4 connection.

Initiating a transfer from the IPv6-only machine, the receiver fails with “unexpected end of JSON input”:

[debug] 13:25:44 cli.go:123: debug mode on
[debug] 13:25:44 croc.go:149: options: {IsSender:false SharedSecret:winter-eternal-lagoon Debug:true RelayAddress:142.93.177.120:9009 RelayPorts:[] RelayPassword:pass123 Stdout:false NoPrompt:false NoMultiplexing:false DisableLocal:false Ask:false}
connecting...[debug]    13:25:44 croc.go:418: attempt to discover peers
[debug] 13:25:44 croc.go:442: discoveries: []
[debug] 13:25:44 croc.go:443: establishing connection
[debug] 13:25:44 croc.go:449: establishing receiver connection to 142.93.177.120:9009
[debug] 13:25:44 tcp.go:313: sending password
[debug] 13:25:44 tcp.go:318: waiting for first ok
[debug] 13:25:44 tcp.go:329: sending room
[debug] 13:25:44 tcp.go:334: waiting for room confirmation
[debug] 13:25:44 tcp.go:343: all set
[debug] 13:25:44 croc.go:452: banner: 9010,9011,9012,9013
[debug] 13:25:44 croc.go:457: receiver connection established: &{connection:0xc000010010}
[debug] 13:25:44 croc.go:462: sending ips?
[debug] 13:25:44 croc.go:469: ips data: 
[debug] 13:25:44 croc.go:518: exchanged header message
securing channel...[debug]      13:25:44 croc.go:530: ready
[debug] 13:25:44 message.go:31: writing pake message (727 bytes)
[debug] 13:25:45 croc.go:552: got error processing: unexpected end of JSON input
unexpected end of JSON input

Initiating from the dual-stack system, croc tries to connect to IPv4, and fails:

[debug] 13:27:09 cli.go:123: debug mode on
[debug] 13:27:09 croc.go:149: options: {IsSender:false SharedSecret:jessica-pump-total Debug:true RelayAddress:142.93.177.120:9009 RelayPorts:[] RelayPassword:pass123 Stdout:false NoPrompt:false NoMultiplexing:false DisableLocal:false Ask:false}
connecting...[debug]    13:27:09 croc.go:418: attempt to discover peers
[debug] 13:27:10 croc.go:442: discoveries: []
[debug] 13:27:10 croc.go:443: establishing connection
[debug] 13:27:10 croc.go:449: establishing receiver connection to 142.93.177.120:9009
[debug] 13:27:10 croc.go:452: banner: 
could not connect to 142.93.177.120:9009: dial tcp 142.93.177.120:9009: connect: network is unreachable

I also tried running my own explicit relay, but got connecting...could not connect to 2605:a601:ab68:2f00:8af:f435:49ee:8012: dial tcp: address 2605:a601:ab68:2f00:8af:f435:49ee:8012: too many colons in address.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 29 (17 by maintainers)

Most upvoted comments

Turns out you can reproduce the problem without needing an IPv6-only network or Docker.

Make sure /etc/hosts has an entry for localhost6 pointing at ::1, then

croc --relay localhost6:9009 send somefile.mp4

and in another terminal window,

croc --relay localhost6:9009 receive code-phrase-here

Is there any fix for this yet? Most of Go should work with well IPv6 by default.