Default local listeners to 127.0.0.1
CI / check-and-test (pull_request) Successful in 11s

Client TCP/UDP and the built-in DNS server bind loopback unless bind_address or a per-rule host (tcp://22:0.0.0.0:2222) is set. README and generated server examples no longer document :9000/:8080 as if they were localhost-only.

Closes #3
This commit is contained in:
s1d3sw1ped_bot
2026-09-01 04:10:14 +00:00
parent 283781fd47
commit c20398642d
5 changed files with 393 additions and 45 deletions
+6 -3
View File
@@ -1,7 +1,6 @@
package dns
import (
"fmt"
"net"
"strings"
"time"
@@ -18,9 +17,10 @@ func StartDNSServer(cfg *config.Config) {
return
}
listenAddr := cfg.DNSServer.ListenAddr()
// Create DNS server
server := &dns.Server{
Addr: fmt.Sprintf(":%d", cfg.DNSServer.ListenPort),
Addr: listenAddr,
Net: "udp",
}
@@ -29,7 +29,10 @@ func StartDNSServer(cfg *config.Config) {
handleDNSQuery(w, r, cfg)
})
logger.WithField("port", cfg.DNSServer.ListenPort).Info("DNS server started")
logger.WithFields(map[string]interface{}{
"addr": listenAddr,
"port": cfg.DNSServer.ListenPort,
}).Info("DNS server started")
// Start server
if err := server.ListenAndServe(); err != nil {