matcher

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register added in v0.1.0

func Register(name string, factory MatcherFactory)

Types

type AndMatcher added in v0.1.1

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

func (*AndMatcher) Match added in v0.1.1

func (m *AndMatcher) Match(conn *transport.ClientConnection) bool

type DefaultMatcher

type DefaultMatcher struct{}

func NewDefaultMatcher

func NewDefaultMatcher() *DefaultMatcher

func (*DefaultMatcher) Match

type HTTPMatcher added in v0.1.1

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

func NewHTTPMatcher added in v0.1.1

func NewHTTPMatcher(cfg *HTTPMatcherConfig) *HTTPMatcher

func (*HTTPMatcher) Match added in v0.1.1

func (m *HTTPMatcher) Match(conn *transport.ClientConnection) bool

type HTTPMatcherConfig added in v0.1.1

type HTTPMatcherConfig struct {
	Methods    []string `yaml:"methods"`
	URLSchemes []string `yaml:"url_schemes"`
	URLHosts   []string `yaml:"url_hosts"`
	URLPaths   []string `yaml:"url_paths"`
	Hosts      []string `yaml:"hosts"`
}

type IPMatcher added in v0.1.1

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

func NewIPMatcher added in v0.1.1

func NewIPMatcher(cfg *IPMatcherConfig) (*IPMatcher, error)

func (*IPMatcher) Match added in v0.1.1

func (m *IPMatcher) Match(conn *transport.ClientConnection) bool

type IPMatcherConfig added in v0.1.1

type IPMatcherConfig struct {
	CIDRs []string `yaml:"CIDRs"`
	Mode  string   `yaml:"mode"`
}

type LogicMatcherConfig added in v0.1.1

type LogicMatcherConfig struct {
	Matchers []struct {
		Type      string    `yaml:"type"`
		Parameter yaml.Node `yaml:"parameter"`
	} `yaml:"matchers"`
}

type Matcher

type Matcher interface {
	Match(conn *transport.ClientConnection) bool
}

func NewMatcher added in v0.1.0

func NewMatcher(ruleType string, parameter yaml.Node) (Matcher, error)

type MatcherFactory added in v0.1.0

type MatcherFactory func(yaml.Node) (Matcher, error)

type OrMatcher added in v0.1.1

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

func (*OrMatcher) Match added in v0.1.1

func (m *OrMatcher) Match(conn *transport.ClientConnection) bool

type PortMatcher added in v0.1.3

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

func NewPortMatcher added in v0.1.3

func NewPortMatcher(cfg *PortMatcherConfig) (*PortMatcher, error)

func (*PortMatcher) Match added in v0.1.3

func (m *PortMatcher) Match(conn *transport.ClientConnection) bool

type PortMatcherConfig added in v0.1.3

type PortMatcherConfig struct {
	Ports []string `yaml:"ports"`
}

type RegexMatcher

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

func NewRegexMatcher

func NewRegexMatcher(cfg *RegexMatcherConfig) (*RegexMatcher, error)

func (*RegexMatcher) Match

func (m *RegexMatcher) Match(conn *transport.ClientConnection) bool

type RegexMatcherConfig

type RegexMatcherConfig struct {
	Pattern string `yaml:"pattern"`
}

type SSHMatcher added in v0.1.1

type SSHMatcher struct{}

func NewSSHMatcher added in v0.1.1

func NewSSHMatcher() *SSHMatcher

func (*SSHMatcher) Match added in v0.1.1

func (m *SSHMatcher) Match(conn *transport.ClientConnection) bool

type Socks5Matcher added in v0.1.4

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

func NewSocks5Matcher added in v0.1.4

func NewSocks5Matcher(cfg *Socks5MatcherConfig) *Socks5Matcher

func (*Socks5Matcher) Match added in v0.1.4

func (m *Socks5Matcher) Match(conn *transport.ClientConnection) bool

type Socks5MatcherConfig added in v0.1.4

type Socks5MatcherConfig struct {
	AllowedMethods []string `yaml:"allowed_methods"`
}

type SubstringMatcher

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

func NewSubstringMatcher

func NewSubstringMatcher(cfg *SubstringMatcherConfig) *SubstringMatcher

func (*SubstringMatcher) Match

type SubstringMatcherConfig

type SubstringMatcherConfig struct {
	Offset int    `yaml:"offset"`
	Value  string `yaml:"value"`
}

type TLSMatcher

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

func NewTLSMatcher

func NewTLSMatcher(cfg *TLSMatcherConfig) *TLSMatcher

func (*TLSMatcher) Match

func (m *TLSMatcher) Match(conn *transport.ClientConnection) bool

type TLSMatcherConfig

type TLSMatcherConfig struct {
	SNI  string   `yaml:"sni"`
	ALPN []string `yaml:"alpn"`
}

type TimeoutMatcher

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

func NewTimeoutMatcher

func NewTimeoutMatcher(cfg *TimeoutMatcherConfig) *TimeoutMatcher

func (*TimeoutMatcher) Match

type TimeoutMatcherConfig

type TimeoutMatcherConfig struct {
	Timeout int `yaml:"timeout"`
}

type TrojanMatcher added in v0.1.4

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

func NewTrojanMatcher added in v0.1.4

func NewTrojanMatcher(cfg *TrojanMatcherConfig) (*TrojanMatcher, error)

func (*TrojanMatcher) Match added in v0.1.4

func (m *TrojanMatcher) Match(conn *transport.ClientConnection) bool

type TrojanMatcherConfig added in v0.1.4

type TrojanMatcherConfig struct {
	Passwords []string `yaml:"passwords,omitempty"`
}

Jump to

Keyboard shortcuts

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