chore: wireguard dns can work with domain-based server

This commit is contained in:
wwqgtxx
2023-04-11 14:10:57 +08:00
parent 92cc268209
commit 90f95d7c78
11 changed files with 51 additions and 6 deletions

View File

@ -170,6 +170,14 @@ func getDialHandler(r *Resolver, proxyAdapter C.ProxyAdapter, proxyName string,
Host: host,
DstPort: port,
}
if proxyAdapter.IsL3Protocol(metadata) {
dstIP, err := resolver.ResolveIPWithResolver(ctx, host, r)
if err != nil {
return nil, err
}
metadata.Host = ""
metadata.DstIP = dstIP
}
if proxyAdapter != nil {
return proxyAdapter.DialContext(ctx, metadata, opts...)
}