diff --git a/app/dns/dns.go b/app/dns/dns.go index 75df565e4..8493972f6 100644 --- a/app/dns/dns.go +++ b/app/dns/dns.go @@ -200,9 +200,7 @@ func (s *DNS) lookupIPInternal(domain string, option dns.IPOption) ([]net.IP, er } // Normalize the FQDN form query - if strings.HasSuffix(domain, ".") { - domain = domain[:len(domain)-1] - } + domain = strings.TrimSuffix(domain, ".") // Static host lookup switch addrs := s.hosts.Lookup(domain, option); { diff --git a/app/reverse/portal.go b/app/reverse/portal.go index 34066f219..0420fa2f8 100644 --- a/app/reverse/portal.go +++ b/app/reverse/portal.go @@ -154,7 +154,7 @@ func (p *StaticMuxPicker) PickAvailable() (*mux.ClientWorker, error) { return nil, newError("empty worker list") } - var minIdx int = -1 + var minIdx = -1 var minConn uint32 = 9999 for i, w := range p.workers { if w.draining { diff --git a/features/routing/dns/context.go b/features/routing/dns/context.go index 8dcfe4945..f0a8b05a1 100644 --- a/features/routing/dns/context.go +++ b/features/routing/dns/context.go @@ -26,7 +26,7 @@ func (ctx *ResolvableContext) GetTargetIPs() []net.IP { } if domain := ctx.GetTargetDomain(); len(domain) != 0 { - var lookupFunc func(string) ([]net.IP, error) = ctx.dnsClient.LookupIP + var lookupFunc = ctx.dnsClient.LookupIP ipOption := &dns.IPOption{ IPv4Enable: true, IPv6Enable: true, diff --git a/proxy/freedom/freedom.go b/proxy/freedom/freedom.go index ffbfeb4e1..12b0b6279 100644 --- a/proxy/freedom/freedom.go +++ b/proxy/freedom/freedom.go @@ -66,7 +66,7 @@ func (h *Handler) resolveIP(ctx context.Context, domain string, localAddr net.Ad newError("DNS client doesn't implement ClientWithIPOption") } - var lookupFunc func(string) ([]net.IP, error) = h.dns.LookupIP + var lookupFunc = h.dns.LookupIP if h.config.DomainStrategy == Config_USE_IP4 || (localAddr != nil && localAddr.Family().IsIPv4()) { if lookupIPv4, ok := h.dns.(dns.IPv4Lookup); ok { lookupFunc = lookupIPv4.LookupIPv4