Chore: rename NoResolveIP to ShouldResolveIP

This commit is contained in:
Dreamacro 2020-07-27 11:57:55 +08:00
parent 33a6579a3a
commit 78c3034158
11 changed files with 20 additions and 20 deletions

View File

@ -48,5 +48,5 @@ type Rule interface {
Match(metadata *Metadata) bool
Adapter() string
Payload() string
NoResolveIP() bool
ShouldResolveIP() bool
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {