Skip to content

Commit

Permalink
Bug fixes for fakeDNS
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaokangwang committed Jan 27, 2021
1 parent a1a4ab1 commit 5248416
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (s *DNS) lookupIPInternal(domain string, option IPOption) ([]net.IP, error)

// Name servers lookup
errs := []error{}
ctx := session.ContextWithInbound(context.Background(), &session.Inbound{Tag: s.tag})
ctx := session.ContextWithInbound(s.ctx, &session.Inbound{Tag: s.tag})
for _, client := range s.sortClients(domain) {
ips, err := client.QueryIP(ctx, domain, option)
if len(ips) > 0 {
Expand Down
3 changes: 1 addition & 2 deletions app/dns/nameserver_fakedns.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ func (f FakeDNSServer) Name() string {

func (f *FakeDNSServer) QueryIP(ctx context.Context, domain string, clientIP net.IP, option IPOption) ([]net.IP, error) {
if f.fakeDNSEngine == nil {
var fakeDNSEngine dns.FakeDNSEngine
if err := core.RequireFeatures(ctx, func(fdns dns.FakeDNSEngine) {
fakeDNSEngine = fdns
f.fakeDNSEngine = fdns
}); err != nil {
return nil, newError("Unable to locate a fake DNS Engine").Base(err).AtError()
}
Expand Down

0 comments on commit 5248416

Please sign in to comment.