mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2026-02-06 07:22:17 +00:00
--listener should allow specifying the network interface too, not just the port #82
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mpl on GitHub.
As is customary with such an option for a server, when the interface is not specified, such as in
--listener :8080, then we should listen on all interfaces, but otherwise it should be taken into account.For example:
--listener localhost:8080, or--listener 192.168.0.12:8080, etc.@mpl commented on GitHub:
@aspacca cool.
Btw, on that subject, I would advise you not to ignore the error at
https://github.com/dutchcoders/transfer.sh/blob/main/server/server.go#L549
because you will silently miss errors such as when the port is busy, or we're not allowed to listen on the interface, etc.
For example, on my machine,
log.Fatal(http.ListenAndServe("localhost:777", nil))would result in
2023/01/05 10:53:19 listen tcp 127.0.0.1:777: bind: permission deniedBut transfer.sh will be happily silent about it:
And the user will never know that the listening actually failed.
@paolafrancesca commented on GitHub:
good catch! thanks
btw, feel free to open a PR for it if you have time :)
@mpl commented on GitHub:
Nevermind, I was fooled by your log line that says "listening on port:" (it should say "listening on addr" or something like that instead), but it actually works since you're passing the option straight as the Addr of the Server.
Sorry about the noise.
@mpl commented on GitHub:
sure, thanks. I might do that then ;)
@paolafrancesca commented on GitHub:
I will change the log entry :)