mirror of https://github.com/v2fly/v2ray-core.git
make fake dns aware of resolution IP proto requirement in fake dns server
This commit is contained in:
parent
c6064452f0
commit
7e82418a40
|
@ -22,7 +22,7 @@ func (FakeDNSServer) Name() string {
|
|||
return "FakeDNS"
|
||||
}
|
||||
|
||||
func (f *FakeDNSServer) QueryIP(ctx context.Context, domain string, _ net.IP, _ dns.IPOption, _ bool) ([]net.IP, error) {
|
||||
func (f *FakeDNSServer) QueryIP(ctx context.Context, domain string, _ net.IP, opt dns.IPOption, _ bool) ([]net.IP, error) {
|
||||
if f.fakeDNSEngine == nil {
|
||||
if err := core.RequireFeatures(ctx, func(fd dns.FakeDNSEngine) {
|
||||
f.fakeDNSEngine = fd
|
||||
|
@ -30,7 +30,12 @@ func (f *FakeDNSServer) QueryIP(ctx context.Context, domain string, _ net.IP, _
|
|||
return nil, newError("Unable to locate a fake DNS Engine").Base(err).AtError()
|
||||
}
|
||||
}
|
||||
ips := f.fakeDNSEngine.GetFakeIPForDomain(domain)
|
||||
var ips []net.Address
|
||||
if fkr0, ok := f.fakeDNSEngine.(dns.FakeDNSEngineRev0); ok {
|
||||
ips = fkr0.GetFakeIPForDomain3(domain, opt.IPv4Enable, opt.IPv6Enable)
|
||||
} else {
|
||||
ips = f.fakeDNSEngine.GetFakeIPForDomain(domain)
|
||||
}
|
||||
|
||||
netIP, err := toNetIP(ips)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue