1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00

apply coding style

This commit is contained in:
Shelikhoo 2021-06-22 12:56:35 +01:00
parent d0d09dfa7f
commit 9a03b425c9
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
4 changed files with 4 additions and 6 deletions

View File

@ -200,9 +200,7 @@ func (s *DNS) lookupIPInternal(domain string, option dns.IPOption) ([]net.IP, er
} }
// Normalize the FQDN form query // Normalize the FQDN form query
if strings.HasSuffix(domain, ".") { domain = strings.TrimSuffix(domain, ".")
domain = domain[:len(domain)-1]
}
// Static host lookup // Static host lookup
switch addrs := s.hosts.Lookup(domain, option); { switch addrs := s.hosts.Lookup(domain, option); {

View File

@ -154,7 +154,7 @@ func (p *StaticMuxPicker) PickAvailable() (*mux.ClientWorker, error) {
return nil, newError("empty worker list") return nil, newError("empty worker list")
} }
var minIdx int = -1 var minIdx = -1
var minConn uint32 = 9999 var minConn uint32 = 9999
for i, w := range p.workers { for i, w := range p.workers {
if w.draining { if w.draining {

View File

@ -26,7 +26,7 @@ func (ctx *ResolvableContext) GetTargetIPs() []net.IP {
} }
if domain := ctx.GetTargetDomain(); len(domain) != 0 { 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{ ipOption := &dns.IPOption{
IPv4Enable: true, IPv4Enable: true,
IPv6Enable: true, IPv6Enable: true,

View File

@ -66,7 +66,7 @@ func (h *Handler) resolveIP(ctx context.Context, domain string, localAddr net.Ad
newError("DNS client doesn't implement ClientWithIPOption") 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 h.config.DomainStrategy == Config_USE_IP4 || (localAddr != nil && localAddr.Family().IsIPv4()) {
if lookupIPv4, ok := h.dns.(dns.IPv4Lookup); ok { if lookupIPv4, ok := h.dns.(dns.IPv4Lookup); ok {
lookupFunc = lookupIPv4.LookupIPv4 lookupFunc = lookupIPv4.LookupIPv4