Skip to content

Commit

Permalink
apply coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaokangwang committed Jun 22, 2021
1 parent d0d09df commit 9a03b42
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions app/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -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); {
Expand Down
2 changes: 1 addition & 1 deletion app/reverse/portal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion features/routing/dns/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion proxy/freedom/freedom.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9a03b42

Please sign in to comment.