ITADN

[BUG] TCP server rewrites 127.0.0.1 binds to 0.0.0.0

#1214ClosedGG-Feng 创建于 26 天前
bug
G
GG-Fengcommented
### What happened? When the TCP server is configured with a loopback bind address, croc rewrites 127.0.0.1 to 0.0.0.0 before listening. Relevant code in src/tcp/tcp.go: addr = strings.Replace(addr, "127.0.0.1", "0.0.0.0", 1) Local validation output: H8 = TRUE POSITIVE: 127.0.0.1:19009 -> 0.0.0.0:19009 This makes the actual listen address broader than the address requested by the caller. ### What did you expect to happen? If a caller configures 127.0.0.1:<port>, the TCP server should bind only to 127.0.0.1:<port>. ### Steps to reproduce 1. Start or test the TCP server with a loopback bind address such as 127.0.0.1:19009. 2. Observe the address passed to the listener or the server startup log. 3. The configured loopback address is rewritten to 0.0.0.0:19009 before Listen is called. ### croc version Tested against commit ac0627f. I also checked current main at b6f478af7e828abf91255890123b8651fd81e630 and the rewrite is still present. ### Operating System Linux ### OS Version Reproduced in a local Docker-based test environment. ### Relevant log output ```shell ``` ### Additional context _No response_
关闭于 26 天前 1 条评论