Fix split mode for all protocols but DoH

In split mode, the code must check for ipv6 availability to return the
correct network stack. Otherwise, we may end up using "tcp6-tls" even
though the upstream IP is an ipv4.
This commit is contained in:
Cuong Manh Le
2023-05-17 22:36:49 +07:00
committed by Cuong Manh Le
parent d7a38363e6
commit b471adfb09
4 changed files with 64 additions and 6 deletions

1
dot.go
View File

@@ -33,6 +33,7 @@ func (r *dotResolver) Resolve(ctx context.Context, msg *dns.Msg) (*dns.Msg, erro
endpoint := r.uc.Endpoint
if r.uc.BootstrapIP != "" {
dnsClient.TLSConfig.ServerName = r.uc.Domain
dnsClient.Net = "tcp-tls"
_, port, _ := net.SplitHostPort(endpoint)
endpoint = net.JoinHostPort(r.uc.BootstrapIP, port)
}