fix: resolve PR2514 lint regressions

This commit is contained in:
lc6464
2026-04-14 14:30:37 +08:00
parent 93bf871bd2
commit ae195831bb
5 changed files with 69 additions and 13 deletions
+8 -2
View File
@@ -506,8 +506,14 @@ func openGroup(group bindGroup, port string) ([]net.Listener, []string, string,
func openAdaptiveLoopbackGroup(allowIPv6, allowIPv4 bool, port string) ([]net.Listener, []string, string, error) {
if allowIPv6 && allowIPv4 {
if ln6, actualPort, err6 := openExactListener(exactBinding{host: "::1", network: "tcp6", v6Only: true}, port); err6 == nil {
if ln4, _, err4 := openExactListener(exactBinding{host: "127.0.0.1", network: "tcp4"}, actualPort); err4 == nil {
if ln6, actualPort, err6 := openExactListener(
exactBinding{host: "::1", network: "tcp6", v6Only: true},
port,
); err6 == nil {
if ln4, _, err4 := openExactListener(
exactBinding{host: "127.0.0.1", network: "tcp4"},
actualPort,
); err4 == nil {
return []net.Listener{ln6, ln4}, []string{"::1", "127.0.0.1"}, actualPort, nil
}
_ = ln6.Close()