fix(archied): preserve ephemeral gateway ports (#707)

This commit is contained in:
sam authored and GitHub committed 2026-09-03 15:24:36 +10:00
1 parent 61ae078fa0
commit e077b13640
2 files changed
+11 -1

No files matched your search

+1 -1
View File
@@ -767,7 +767,7 @@ func parseListenAddr(addr, defaultHost string, defaultPort int) (string, int) {
return defaultHost, defaultPort
}
port, err := strconv.Atoi(portStr)
if err != nil || port <= 0 {
if err != nil || port < 0 {
return host, defaultPort
}
return host, port
@@ -0,0 +1,10 @@
package archied
import "testing"
func TestParseListenAddrPreservesEphemeralPort(t *testing.T) {
host, port := parseListenAddr("127.0.0.1:0", "0.0.0.0", 8644)
if host != "127.0.0.1" || port != 0 {
t.Fatalf("parseListenAddr() = (%q, %d), want (%q, %d)", host, port, "127.0.0.1", 0)
}
}