rules

package
v0.0.0-...-e61482c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Domain

type Domain struct {
	// contains filtered or unexported fields
}

func NewDomain

func NewDomain(domain string, adapter string) *Domain

func (*Domain) Adapter

func (p *Domain) Adapter() string

func (*Domain) Clash

func (p *Domain) Clash() (string, bool)

func (*Domain) Match

func (p *Domain) Match(metadata *Metadata) bool

func (*Domain) Payload

func (p *Domain) Payload() string

func (*Domain) QuanX

func (p *Domain) QuanX() (string, bool)

func (*Domain) RuleType

func (p *Domain) RuleType() RuleType

type DomainKeyword

type DomainKeyword struct {
	// contains filtered or unexported fields
}

func NewDomainKeyword

func NewDomainKeyword(keyword string, adapter string) *DomainKeyword

func (*DomainKeyword) Adapter

func (dk *DomainKeyword) Adapter() string

func (*DomainKeyword) Clash

func (p *DomainKeyword) Clash() (string, bool)

func (*DomainKeyword) Match

func (dk *DomainKeyword) Match(metadata *Metadata) bool

func (*DomainKeyword) Payload

func (dk *DomainKeyword) Payload() string

func (*DomainKeyword) QuanX

func (p *DomainKeyword) QuanX() (string, bool)

func (*DomainKeyword) RuleType

func (dk *DomainKeyword) RuleType() RuleType

func (*DomainKeyword) ShouldFindProcess

func (dk *DomainKeyword) ShouldFindProcess() bool

func (*DomainKeyword) ShouldResolveIP

func (dk *DomainKeyword) ShouldResolveIP() bool

type DomainSuffix

type DomainSuffix struct {
	// contains filtered or unexported fields
}

func NewDomainSuffix

func NewDomainSuffix(suffix string, adapter string) *DomainSuffix

func (*DomainSuffix) Adapter

func (ds *DomainSuffix) Adapter() string

func (*DomainSuffix) Clash

func (p *DomainSuffix) Clash() (string, bool)

func (*DomainSuffix) Match

func (ds *DomainSuffix) Match(metadata *Metadata) bool

func (*DomainSuffix) Payload

func (ds *DomainSuffix) Payload() string

func (*DomainSuffix) QuanX

func (p *DomainSuffix) QuanX() (string, bool)

func (*DomainSuffix) RuleType

func (ds *DomainSuffix) RuleType() RuleType

func (*DomainSuffix) ShouldFindProcess

func (ds *DomainSuffix) ShouldFindProcess() bool

func (*DomainSuffix) ShouldResolveIP

func (ds *DomainSuffix) ShouldResolveIP() bool

type GEOIP

type GEOIP struct {
	// contains filtered or unexported fields
}

func NewGEOIP

func NewGEOIP(country string, adapter string) *GEOIP

func (*GEOIP) Adapter

func (g *GEOIP) Adapter() string

func (*GEOIP) Clash

func (p *GEOIP) Clash() (string, bool)

func (*GEOIP) Match

func (g *GEOIP) Match(metadata *Metadata) bool

func (*GEOIP) Payload

func (g *GEOIP) Payload() string

func (*GEOIP) QuanX

func (p *GEOIP) QuanX() (string, bool)

func (*GEOIP) RuleType

func (g *GEOIP) RuleType() RuleType

func (*GEOIP) ShouldFindProcess

func (g *GEOIP) ShouldFindProcess() bool

func (*GEOIP) ShouldResolveIP

func (g *GEOIP) ShouldResolveIP() bool

type IPCIDR

type IPCIDR struct {
	// contains filtered or unexported fields
}

func NewIPCIDR

func NewIPCIDR(s string, adapter string) (*IPCIDR, error)

func (*IPCIDR) Adapter

func (i *IPCIDR) Adapter() string

func (*IPCIDR) Clash

func (p *IPCIDR) Clash() (string, bool)

func (*IPCIDR) Match

func (i *IPCIDR) Match(metadata *Metadata) bool

func (*IPCIDR) Payload

func (i *IPCIDR) Payload() string

func (*IPCIDR) QuanX

func (p *IPCIDR) QuanX() (string, bool)

func (*IPCIDR) RuleType

func (i *IPCIDR) RuleType() RuleType

func (*IPCIDR) ShouldFindProcess

func (i *IPCIDR) ShouldFindProcess() bool

func (*IPCIDR) ShouldResolveIP

func (i *IPCIDR) ShouldResolveIP() bool

type Metadata

type Metadata struct {
	SrcIP       net.IP `json:"sourceIP"`
	DstIP       net.IP `json:"destinationIP"`
	SrcPort     uint64 `json:"sourcePort"`
	DstPort     uint64 `json:"destinationPort"`
	Host        string `json:"host"`
	ProcessPath string `json:"processPath"`
}

type Port

type Port struct {
	// contains filtered or unexported fields
}

func NewPort

func NewPort(port string, adapter string, portType PortType) (*Port, error)

func (*Port) Adapter

func (p *Port) Adapter() string

func (*Port) Clash

func (p *Port) Clash() (string, bool)

func (*Port) Match

func (p *Port) Match(metadata *Metadata) bool

func (*Port) Payload

func (p *Port) Payload() string

func (*Port) QuanX

func (p *Port) QuanX() (string, bool)

func (*Port) RuleType

func (p *Port) RuleType() RuleType

func (*Port) ShouldFindProcess

func (p *Port) ShouldFindProcess() bool

func (*Port) ShouldResolveIP

func (p *Port) ShouldResolveIP() bool

type PortType

type PortType int
const (
	PortTypeSrc PortType = iota
	PortTypeDest
)

type Process

type Process struct {
	// contains filtered or unexported fields
}

func NewProcess

func NewProcess(process string, adapter string, nameOnly bool) (*Process, error)

func (*Process) Adapter

func (p *Process) Adapter() string

func (*Process) Clash

func (p *Process) Clash() (string, bool)

func (*Process) Match

func (p *Process) Match(metadata *Metadata) bool

func (*Process) Payload

func (p *Process) Payload() string

func (*Process) QuanX

func (p *Process) QuanX() (string, bool)

func (*Process) RuleType

func (p *Process) RuleType() RuleType

func (*Process) ShouldFindProcess

func (p *Process) ShouldFindProcess() bool

func (*Process) ShouldResolveIP

func (p *Process) ShouldResolveIP() bool

type Rule

type Rule interface {
	RuleType() RuleType
	Adapter() string
	Payload() string

	Clash() (string, bool)
	QuanX() (string, bool)
}

func NewUserAgent

func NewUserAgent(payload, target string) (Rule, error)

func ParseRule

func ParseRule(tp, payload, target string, params []string) (Rule, error)

type RuleType

type RuleType int
const (
	RuleTypeDomain RuleType = iota
	RuleTypeDomainSuffix
	RuleTypeDomainKeyword
	RuleTypeGEOIP
	RuleTypeIPCIDR
	RuleTypeSrcIPCIDR
	RuleTypeSrcPort
	RuleTypeDstPort
	RuleTypeProcess
	RuleTypeProcessPath
	RuleTypeUserAgent
)

type UserAgent

type UserAgent struct {
	// contains filtered or unexported fields
}

func (*UserAgent) Adapter

func (p *UserAgent) Adapter() string

func (*UserAgent) Clash

func (p *UserAgent) Clash() (string, bool)

func (*UserAgent) Match

func (p *UserAgent) Match(metadata *Metadata) bool

func (*UserAgent) Payload

func (p *UserAgent) Payload() string

func (*UserAgent) QuanX

func (p *UserAgent) QuanX() (string, bool)

func (*UserAgent) RuleType

func (p *UserAgent) RuleType() RuleType

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL