schollz / croc

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

define ports by amount, not individually #660

Closed qk-santi closed 4 months ago

qk-santi commented 4 months ago

Defining the number of ports for transfer connections is a bit cumbersome, especially if you want to create quite a few ones

croc send --ports 9009,9010,9011,9012,9013,9014,9015,9016,9017 my_file.gzip

Switched to:

Define base port (if different than default) + number of parallel connections
croc send --port 9009 --transfers 8 my_file.gzip
croc send --transfers 8 my_file.gzip

Fixes #617

schollz commented 4 months ago

Perfect, thanks

schollz commented 4 months ago

actually, looks like this broke default behavior. didn't realize it was a breaking change. here's output between this version and croc v9.6.8:

connecting...panic: Expected port and number of transfer ports in banner: 9010,9011,9012,9013

goroutine 1 [running]:
github.com/schollz/croc/v9/src/croc.(*Client).Receive(0xc0000c4248)
    /root/croc/src/croc/croc.go:992 +0x18be
github.com/schollz/croc/v9/src/cli.receive(0xc0000750c0)
    /root/croc/src/cli/cli.go:527 +0xda5
github.com/schollz/croc/v9/src/cli.Run.func1(0xc0000750c0)
    /root/croc/src/cli/cli.go:142 +0x1bc
github.com/schollz/cli/v2.(*App).RunContext(0xc000002480, {0x8e0e68, 0xc0b9c0}, {0xc000024040, 0x2, 0x2})
    /root/go/pkg/mod/github.com/schollz/cli/v2@v2.2.1/app.go:315 +0x928
github.com/schollz/cli/v2.(*App).Run(...)
    /root/go/pkg/mod/github.com/schollz/cli/v2@v2.2.1/app.go:217
github.com/schollz/croc/v9/src/cli.Run()
    /root/croc/src/cli/cli.go:145 +0x138a
main.main()
    /root/croc/main.go:30 +0x13
schollz commented 4 months ago

will revert, please submit again if you can resolve the breaking change

qk-santi commented 4 months ago

It didn't break default behaviour, but changed the protocol between the peers. Pushed a new PR compatible with previous versions