Pull request: 2574 external tests vol.4
Merge in DNS/adguard-home from 2574-external-tests-4 to master Close #2574. Squashed commit of the following: commit 0d06fce604750f76f4a319b2539105e936a248ce Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Apr 22 13:26:25 2021 +0300 home: imp tests, docs commit fc7b7f13f19bb8f183522a13d5726253eaae83d0 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Apr 22 12:20:15 2021 +0300 home: fix whois test
This commit is contained in:
@@ -27,6 +27,10 @@ type Whois struct {
|
||||
clients *clientsContainer
|
||||
ipChan chan net.IP
|
||||
|
||||
// dialContext specifies the dial function for creating unencrypted TCP
|
||||
// connections.
|
||||
dialContext func(ctx context.Context, network, addr string) (conn net.Conn, err error)
|
||||
|
||||
// Contains IP addresses of clients
|
||||
// An active IP address is resolved once again after it expires.
|
||||
// If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP.
|
||||
@@ -45,7 +49,8 @@ func initWhois(clients *clientsContainer) *Whois {
|
||||
EnableLRU: true,
|
||||
MaxCount: 10000,
|
||||
}),
|
||||
ipChan: make(chan net.IP, 255),
|
||||
dialContext: customDialContext,
|
||||
ipChan: make(chan net.IP, 255),
|
||||
}
|
||||
|
||||
go w.workerLoop()
|
||||
@@ -124,7 +129,7 @@ func (w *Whois) query(ctx context.Context, target, serverAddr string) (string, e
|
||||
if addr == "whois.arin.net" {
|
||||
target = "n + " + target
|
||||
}
|
||||
conn, err := customDialContext(ctx, "tcp", serverAddr)
|
||||
conn, err := w.dialContext(ctx, "tcp", serverAddr)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user