Chore: rename NoResolveIP to ShouldResolveIP
This commit is contained in:
parent
33a6579a3a
commit
78c3034158
11 changed files with 20 additions and 20 deletions
|
@ -48,5 +48,5 @@ type Rule interface {
|
|||
Match(metadata *Metadata) bool
|
||||
Adapter() string
|
||||
Payload() string
|
||||
NoResolveIP() bool
|
||||
ShouldResolveIP() bool
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue