Bugfix: add ipv6 parsing for custom DNS server (#3266)

This commit is contained in:
Gerhard Tan 2023-01-29 23:54:40 +08:00 committed by GitHub
parent 0eecab06c1
commit d205c26480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,8 +114,8 @@ func (svr *Service) Run() error {
// set custom DNSServer // set custom DNSServer
if svr.cfg.DNSServer != "" { if svr.cfg.DNSServer != "" {
dnsAddr := svr.cfg.DNSServer dnsAddr := svr.cfg.DNSServer
if !strings.Contains(dnsAddr, ":") { if _, _, err := net.SplitHostPort(dnsAddr); err != nil {
dnsAddr += ":53" dnsAddr = net.JoinHostPort(dnsAddr, "53")
} }
// Change default dns server for frpc // Change default dns server for frpc
net.DefaultResolver = &net.Resolver{ net.DefaultResolver = &net.Resolver{