Urgent.News

What's breaking now, across hundreds of outlets.

Tech

My --config-test accepted a listen address that could never bind

transponder is a Go proxy I've been building. It has a --config-test flag: load the config, validate it, exit 0 or 1. It runs in CI and in the deploy script before anything starts. Last week a config passed --config-test and the server died 200 ms later with: listen tcp: lookup tcp/nope: unknown port No key name, no line number, nothing to grep for. The config had listen_addr: ":nope" . The check…

transponder is a Go proxy that the author has been developing. The proxy includes a --config-test flag, which loads the configuration, validates it, and exits with a status code of 0 or 1. This flag is utilized in CI tests and the deployment script before any server starts. Last week, a configuration passed the --config-test, yet the server crashed just 200 milliseconds later with the error: "listen tcp: lookup tcp/nope: unknown port".

The configuration contained the line "listen_addr: ":nope"". The author's verification process involved using the net.SplitHostPort function, followed by strconv.Atoi and range checking. Despite feeling correct due to the standard library handling the parsing, net.SplitHostPort merely splits the string without validating it. The author examined the outcomes of SplitHostPort against various inputs, such as ":nope", ":70000", and "+80", finding that each value splits correctly.

However, net.Listen behaves differently for these inputs, with ":nope" resulting in "listen tcp: lookup tcp/nope: unknown port", while ":70000" leads to "listen tcp: address 70000: invalid port". The port needs to be processed similarly to how net.Listen processes it, which involves checking if the number is within the range 0-65535 or resolving the service name using net.LookupPort.

The author also discussed the two-listener case, where the main listener and ops listener sharing the same port causes a startup failure. Comparing hosts is done by comparing net.IP.Equal, considering case folding, and separating zones due to the limitations of net.ParseIP. The author introduced a wildcard rule, stating that an unspecified address should not be used in conjunction with any host on the same port.

They discovered a discrepancy between the author's mental model and the behavior of net/ipsock_posix.go, where 0.0.0.0 claims both IPv4 and IPv6 addresses. To prevent this, the author adopted a conservative rule: any unspecified host conflicting with anything on that port. The author also addressed the issue of zones, noting that net.ParseIP ignores zones, causing conflicts between interfaces with the same zone.

The final rule emphasizes that a configuration check should reflect the consumer's processing of values, including the same parser, edge cases, and refusals. Otherwise, it becomes a linter with a --config-test label, approving the file while the process still fails, leading to an error message lacking the specific key that caused the issue.

Rewritten by urgent.news; may contain errors — check the original.

Read the original at dev.to →

Report a problem with this story

More in Tech

Interaction Nets Explained: The Programming Model Behind the Frostbite CPU

On November 18, 2026, the chip-design startup Architect Labs published a post introducing Frostbite . They describe it as a general-purpose CPU with a new instruction set.

  • Interaction nets enable Frostbite's energy-efficient programming model
  • Programs represented as graphs with nodes and wires in interaction nets
  • Frostbite's quad achieved 4.59x better performance per watt using interaction nets

More from Saturday 21 November →