From 726281255cc5ad3b2ca5e705440f0db94e82597e Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Mon, 4 Nov 2019 10:42:39 +0800 Subject: [PATCH] Fix: NoResolveIP should return current value (#390) --- config/config.go | 2 +- rules/domain.go | 2 +- rules/domain_keyword.go | 2 +- rules/domain_suffix.go | 2 +- rules/final.go | 2 +- rules/ipcidr.go | 2 +- rules/port.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/config.go b/config/config.go index 1cccdccd..aee3129e 100644 --- a/config/config.go +++ b/config/config.go @@ -472,7 +472,7 @@ func parseRules(cfg *rawConfig, proxies map[string]C.Proxy) ([]C.Rule, error) { case "SOURCE-IP-CIDR": fallthrough case "SRC-IP-CIDR": - parsed, parseErr = R.NewIPCIDR(payload, target, R.WithIPCIDRSourceIP(true)) + parsed, parseErr = R.NewIPCIDR(payload, target, R.WithIPCIDRSourceIP(true), R.WithIPCIDRNoResolve(true)) case "SRC-PORT": parsed, parseErr = R.NewPort(payload, target, true) case "DST-PORT": diff --git a/rules/domain.go b/rules/domain.go index 373761e5..14c0ffb9 100644 --- a/rules/domain.go +++ b/rules/domain.go @@ -31,7 +31,7 @@ func (d *Domain) Payload() string { } func (d *Domain) NoResolveIP() bool { - return false + return true } func NewDomain(domain string, adapter string) *Domain { diff --git a/rules/domain_keyword.go b/rules/domain_keyword.go index 35833625..dc7578e3 100644 --- a/rules/domain_keyword.go +++ b/rules/domain_keyword.go @@ -32,7 +32,7 @@ func (dk *DomainKeyword) Payload() string { } func (dk *DomainKeyword) NoResolveIP() bool { - return false + return true } func NewDomainKeyword(keyword string, adapter string) *DomainKeyword { diff --git a/rules/domain_suffix.go b/rules/domain_suffix.go index 69bed9bb..6999f29f 100644 --- a/rules/domain_suffix.go +++ b/rules/domain_suffix.go @@ -32,7 +32,7 @@ func (ds *DomainSuffix) Payload() string { } func (ds *DomainSuffix) NoResolveIP() bool { - return false + return true } func NewDomainSuffix(suffix string, adapter string) *DomainSuffix { diff --git a/rules/final.go b/rules/final.go index dc97ffa5..62484999 100644 --- a/rules/final.go +++ b/rules/final.go @@ -25,7 +25,7 @@ func (f *Match) Payload() string { } func (f *Match) NoResolveIP() bool { - return false + return true } func NewMatch(adapter string) *Match { diff --git a/rules/ipcidr.go b/rules/ipcidr.go index 3e128f3e..18763f1e 100644 --- a/rules/ipcidr.go +++ b/rules/ipcidr.go @@ -16,7 +16,7 @@ func WithIPCIDRSourceIP(b bool) IPCIDROption { func WithIPCIDRNoResolve(noResolve bool) IPCIDROption { return func(i *IPCIDR) { - i.noResolveIP = !noResolve + i.noResolveIP = noResolve } } diff --git a/rules/port.go b/rules/port.go index 54eb2306..e6e3b040 100644 --- a/rules/port.go +++ b/rules/port.go @@ -35,7 +35,7 @@ func (p *Port) Payload() string { } func (p *Port) NoResolveIP() bool { - return false + return true } func NewPort(port string, adapter string, isSource bool) (*Port, error) {