update hosts
This commit is contained in:
@ -15,7 +15,7 @@ import (
|
||||
type Router struct {
|
||||
Retries int
|
||||
Chain *Chain
|
||||
Hosts *hosts.Hosts
|
||||
Hosts hosts.HostMapper
|
||||
Resolver resolver.Resolver
|
||||
Logger logger.Logger
|
||||
}
|
||||
@ -78,9 +78,11 @@ func (r *Router) resolve(ctx context.Context, addr string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if ip := r.Hosts.Lookup(host); ip != nil {
|
||||
r.Logger.Debugf("hit hosts: %s -> %s", host, ip)
|
||||
return net.JoinHostPort(ip.String(), port), nil
|
||||
if r.Hosts != nil {
|
||||
if ip := r.Hosts.Lookup(host); ip != nil {
|
||||
r.Logger.Debugf("hit hosts: %s -> %s", host, ip)
|
||||
return net.JoinHostPort(ip.String(), port), nil
|
||||
}
|
||||
}
|
||||
|
||||
if r.Resolver != nil {
|
||||
|
Reference in New Issue
Block a user