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
|
Match(metadata *Metadata) bool
|
||||||
Adapter() string
|
Adapter() string
|
||||||
Payload() string
|
Payload() string
|
||||||
NoResolveIP() bool
|
ShouldResolveIP() bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,8 @@ func (d *Domain) Payload() string {
|
||||||
return d.domain
|
return d.domain
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Domain) NoResolveIP() bool {
|
func (d *Domain) ShouldResolveIP() bool {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDomain(domain string, adapter string) *Domain {
|
func NewDomain(domain string, adapter string) *Domain {
|
||||||
|
|
|
@ -31,8 +31,8 @@ func (dk *DomainKeyword) Payload() string {
|
||||||
return dk.keyword
|
return dk.keyword
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dk *DomainKeyword) NoResolveIP() bool {
|
func (dk *DomainKeyword) ShouldResolveIP() bool {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDomainKeyword(keyword string, adapter string) *DomainKeyword {
|
func NewDomainKeyword(keyword string, adapter string) *DomainKeyword {
|
||||||
|
|
|
@ -31,8 +31,8 @@ func (ds *DomainSuffix) Payload() string {
|
||||||
return ds.suffix
|
return ds.suffix
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ds *DomainSuffix) NoResolveIP() bool {
|
func (ds *DomainSuffix) ShouldResolveIP() bool {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDomainSuffix(suffix string, adapter string) *DomainSuffix {
|
func NewDomainSuffix(suffix string, adapter string) *DomainSuffix {
|
||||||
|
|
|
@ -24,8 +24,8 @@ func (f *Match) Payload() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Match) NoResolveIP() bool {
|
func (f *Match) ShouldResolveIP() bool {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMatch(adapter string) *Match {
|
func NewMatch(adapter string) *Match {
|
||||||
|
|
|
@ -32,8 +32,8 @@ func (g *GEOIP) Payload() string {
|
||||||
return g.country
|
return g.country
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GEOIP) NoResolveIP() bool {
|
func (g *GEOIP) ShouldResolveIP() bool {
|
||||||
return g.noResolveIP
|
return !g.noResolveIP
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGEOIP(country string, adapter string, noResolveIP bool) *GEOIP {
|
func NewGEOIP(country string, adapter string, noResolveIP bool) *GEOIP {
|
||||||
|
|
|
@ -50,8 +50,8 @@ func (i *IPCIDR) Payload() string {
|
||||||
return i.ipnet.String()
|
return i.ipnet.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *IPCIDR) NoResolveIP() bool {
|
func (i *IPCIDR) ShouldResolveIP() bool {
|
||||||
return i.noResolveIP
|
return !i.noResolveIP
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewIPCIDR(s string, adapter string, opts ...IPCIDROption) (*IPCIDR, error) {
|
func NewIPCIDR(s string, adapter string, opts ...IPCIDROption) (*IPCIDR, error) {
|
||||||
|
|
|
@ -34,8 +34,8 @@ func (p *Port) Payload() string {
|
||||||
return p.port
|
return p.port
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Port) NoResolveIP() bool {
|
func (p *Port) ShouldResolveIP() bool {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPort(port string, adapter string, isSource bool) (*Port, error) {
|
func NewPort(port string, adapter string, isSource bool) (*Port, error) {
|
||||||
|
|
|
@ -53,8 +53,8 @@ func (p *Process) Payload() string {
|
||||||
return p.process
|
return p.process
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Process) NoResolveIP() bool {
|
func (p *Process) ShouldResolveIP() bool {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewProcess(process string, adapter string) (*Process, error) {
|
func NewProcess(process string, adapter string) (*Process, error) {
|
||||||
|
|
|
@ -73,8 +73,8 @@ func (p *Process) Payload() string {
|
||||||
return p.process
|
return p.process
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Process) NoResolveIP() bool {
|
func (p *Process) ShouldResolveIP() bool {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewProcess(process string, adapter string) (*Process, error) {
|
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 {
|
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) {
|
func match(metadata *C.Metadata) (C.Proxy, C.Rule, error) {
|
||||||
|
|
Loading…
Reference in a new issue