chore: wireguard dns can work with domain-based server
This commit is contained in:
@ -412,8 +412,11 @@ func (r *Resolver) asyncExchange(ctx context.Context, client []dnsClient, msg *D
|
||||
return ch
|
||||
}
|
||||
|
||||
// HasProxyServer has proxy server dns client
|
||||
func (r *Resolver) HasProxyServer() bool {
|
||||
// Invalid return this resolver can or can't be used
|
||||
func (r *Resolver) Invalid() bool {
|
||||
if r == nil {
|
||||
return false
|
||||
}
|
||||
return len(r.main) > 0
|
||||
}
|
||||
|
||||
|
@ -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...)
|
||||
}
|
||||
|
Reference in New Issue
Block a user