From 17a0dc479a952d7830926b57a2abdd6b8df903a8 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Mon, 27 Jul 2020 11:57:55 +0800 Subject: [PATCH] Chore: rename NoResolveIP to ShouldResolveIP --- constant/rule.go | 2 +- rules/domain.go | 4 ++-- rules/domain_keyword.go | 4 ++-- rules/domain_suffix.go | 4 ++-- rules/final.go | 4 ++-- rules/geoip.go | 4 ++-- rules/ipcidr.go | 4 ++-- rules/port.go | 4 ++-- rules/process_darwin.go | 4 ++-- rules/process_linux.go | 4 ++-- tunnel/tunnel.go | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/constant/rule.go b/constant/rule.go index 6774589d..d7c43416 100644 --- a/constant/rule.go +++ b/constant/rule.go @@ -48,5 +48,5 @@ type Rule interface { Match(metadata *Metadata) bool Adapter() string Payload() string - NoResolveIP() bool + ShouldResolveIP() bool } diff --git a/rules/domain.go b/rules/domain.go index 14c0ffb9..f23ab18d 100644 --- a/rules/domain.go +++ b/rules/domain.go @@ -30,8 +30,8 @@ func (d *Domain) Payload() string { return d.domain } -func (d *Domain) NoResolveIP() bool { - return true +func (d *Domain) ShouldResolveIP() bool { + return false } func NewDomain(domain string, adapter string) *Domain { diff --git a/rules/domain_keyword.go b/rules/domain_keyword.go index dc7578e3..b3d6fbaa 100644 --- a/rules/domain_keyword.go +++ b/rules/domain_keyword.go @@ -31,8 +31,8 @@ func (dk *DomainKeyword) Payload() string { return dk.keyword } -func (dk *DomainKeyword) NoResolveIP() bool { - return true +func (dk *DomainKeyword) ShouldResolveIP() bool { + return false } func NewDomainKeyword(keyword string, adapter string) *DomainKeyword { diff --git a/rules/domain_suffix.go b/rules/domain_suffix.go index 6999f29f..a1f9f28f 100644 --- a/rules/domain_suffix.go +++ b/rules/domain_suffix.go @@ -31,8 +31,8 @@ func (ds *DomainSuffix) Payload() string { return ds.suffix } -func (ds *DomainSuffix) NoResolveIP() bool { - return true +func (ds *DomainSuffix) ShouldResolveIP() bool { + return false } func NewDomainSuffix(suffix string, adapter string) *DomainSuffix { diff --git a/rules/final.go b/rules/final.go index 62484999..91c0b9d9 100644 --- a/rules/final.go +++ b/rules/final.go @@ -24,8 +24,8 @@ func (f *Match) Payload() string { return "" } -func (f *Match) NoResolveIP() bool { - return true +func (f *Match) ShouldResolveIP() bool { + return false } func NewMatch(adapter string) *Match { diff --git a/rules/geoip.go b/rules/geoip.go index cfe8b52b..be4b5029 100644 --- a/rules/geoip.go +++ b/rules/geoip.go @@ -32,8 +32,8 @@ func (g *GEOIP) Payload() string { return g.country } -func (g *GEOIP) NoResolveIP() bool { - return g.noResolveIP +func (g *GEOIP) ShouldResolveIP() bool { + return !g.noResolveIP } func NewGEOIP(country string, adapter string, noResolveIP bool) *GEOIP { diff --git a/rules/ipcidr.go b/rules/ipcidr.go index 18763f1e..ff3b83c4 100644 --- a/rules/ipcidr.go +++ b/rules/ipcidr.go @@ -50,8 +50,8 @@ func (i *IPCIDR) Payload() string { return i.ipnet.String() } -func (i *IPCIDR) NoResolveIP() bool { - return i.noResolveIP +func (i *IPCIDR) ShouldResolveIP() bool { + return !i.noResolveIP } func NewIPCIDR(s string, adapter string, opts ...IPCIDROption) (*IPCIDR, error) { diff --git a/rules/port.go b/rules/port.go index e6e3b040..281a4c4d 100644 --- a/rules/port.go +++ b/rules/port.go @@ -34,8 +34,8 @@ func (p *Port) Payload() string { return p.port } -func (p *Port) NoResolveIP() bool { - return true +func (p *Port) ShouldResolveIP() bool { + return false } func NewPort(port string, adapter string, isSource bool) (*Port, error) { diff --git a/rules/process_darwin.go b/rules/process_darwin.go index dea589e7..cc08fd41 100644 --- a/rules/process_darwin.go +++ b/rules/process_darwin.go @@ -53,8 +53,8 @@ func (p *Process) Payload() string { return p.process } -func (p *Process) NoResolveIP() bool { - return true +func (p *Process) ShouldResolveIP() bool { + return false } func NewProcess(process string, adapter string) (*Process, error) { diff --git a/rules/process_linux.go b/rules/process_linux.go index cc41da90..ff838750 100644 --- a/rules/process_linux.go +++ b/rules/process_linux.go @@ -73,8 +73,8 @@ func (p *Process) Payload() string { return p.process } -func (p *Process) NoResolveIP() bool { - return true +func (p *Process) ShouldResolveIP() bool { + return false } func NewProcess(process string, adapter string) (*Process, error) { diff --git a/tunnel/tunnel.go b/tunnel/tunnel.go index 029e1b0b..055acbdb 100644 --- a/tunnel/tunnel.go +++ b/tunnel/tunnel.go @@ -289,7 +289,7 @@ func handleTCPConn(localConn C.ServerAdapter) { } func shouldResolveIP(rule C.Rule, metadata *C.Metadata) bool { - return !rule.NoResolveIP() && metadata.Host != "" && metadata.DstIP == nil + return !rule.ShouldResolveIP() && metadata.Host != "" && metadata.DstIP == nil } func match(metadata *C.Metadata) (C.Proxy, C.Rule, error) {