route

package
v3.0.0-...-1f68d82 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRuleTypeNotFound = errors.New("rule type is not found")

Functions

This section is empty.

Types

type CustomRuleInitializer

type CustomRuleInitializer = func(logger *log.Logger, config *config.Rule, listMap map[string]set.StringSet) (Rule, error)

type Router

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

func (*Router) FindListsByTag

func (r *Router) FindListsByTag(tags []string) ([]set.StringSet, error)

func (*Router) FindOutboundByName

func (r *Router) FindOutboundByName(name string) (adapter.Outbound, error)

func (*Router) HandleConnection

func (r *Router) HandleConnection(conn net.Conn, metadata *adapter.Metadata)

func (*Router) Initialize

func (r *Router) Initialize(ctx context.Context, logger *log.Logger, options RouterOptions) error

func (*Router) RegisterCustomRule

func (r *Router) RegisterCustomRule(name string, initializer CustomRuleInitializer) error

func (*Router) UpdateConfig

func (r *Router) UpdateConfig(newOptions RouterOptions) error

type RouterOptions

type RouterOptions struct {
	Config          *config.Router
	OutboundMap     map[string]adapter.Outbound
	ListMap         map[string]set.StringSet
	RuleRegistry    map[string]CustomRuleInitializer
	SnifferRegistry map[string]protocol.SnifferFunc
}

type Rule

type Rule interface {
	Config() *config.Rule
	Match(metadata *adapter.Metadata) bool
}

func NewLogicalAndRule

func NewLogicalAndRule(logger *log.Logger, newConfig *config.Rule, listMap map[string]set.StringSet, ruleRegistry map[string]CustomRuleInitializer) (Rule, error)

func NewLogicalOrRule

func NewLogicalOrRule(logger *log.Logger, newConfig *config.Rule, listMap map[string]set.StringSet, ruleRegistry map[string]CustomRuleInitializer) (Rule, error)

func NewMinecraftHostnameRule

func NewMinecraftHostnameRule(newConfig *config.Rule, listMap map[string]set.StringSet) (Rule, error)

func NewMinecraftPlayerNameRule

func NewMinecraftPlayerNameRule(newConfig *config.Rule, listMap map[string]set.StringSet) (Rule, error)

func NewMinecraftStatusRule

func NewMinecraftStatusRule(newConfig *config.Rule) (Rule, error)

func NewRule

func NewRule(logger *log.Logger, config *config.Rule, listMap map[string]set.StringSet, ruleRegistry map[string]CustomRuleInitializer) (Rule, error)

func NewServiceNameRule

func NewServiceNameRule(newConfig *config.Rule, listMap map[string]set.StringSet) (Rule, error)

type RuleAlways

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

func (*RuleAlways) Config

func (r *RuleAlways) Config() *config.Rule

func (*RuleAlways) Match

func (r *RuleAlways) Match(*adapter.Metadata) bool

type RuleLogicalAnd

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

func (*RuleLogicalAnd) Config

func (r *RuleLogicalAnd) Config() *config.Rule

func (*RuleLogicalAnd) Match

func (r *RuleLogicalAnd) Match(metadata *adapter.Metadata) (match bool)

type RuleLogicalOr

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

func (*RuleLogicalOr) Config

func (r *RuleLogicalOr) Config() *config.Rule

func (*RuleLogicalOr) Match

func (r *RuleLogicalOr) Match(metadata *adapter.Metadata) (match bool)

type RuleMinecraftHostname

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

func (*RuleMinecraftHostname) Config

func (r *RuleMinecraftHostname) Config() *config.Rule

func (*RuleMinecraftHostname) Match

func (r *RuleMinecraftHostname) Match(metadata *adapter.Metadata) (match bool)

type RuleMinecraftPlayerName

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

func (*RuleMinecraftPlayerName) Config

func (r *RuleMinecraftPlayerName) Config() *config.Rule

func (*RuleMinecraftPlayerName) Match

func (r *RuleMinecraftPlayerName) Match(metadata *adapter.Metadata) (match bool)

type RuleMinecraftStatus

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

func (*RuleMinecraftStatus) Config

func (r *RuleMinecraftStatus) Config() *config.Rule

func (*RuleMinecraftStatus) Match

func (r *RuleMinecraftStatus) Match(metadata *adapter.Metadata) (match bool)

type RuleServiceName

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

func (RuleServiceName) Config

func (r RuleServiceName) Config() *config.Rule

func (RuleServiceName) Match

func (r RuleServiceName) Match(metadata *adapter.Metadata) (match bool)

type RuleSourceIP

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

func NewSourceIPRule

func NewSourceIPRule(newConfig *config.Rule, listMap map[string]set.StringSet) (*RuleSourceIP, error)

func (*RuleSourceIP) Config

func (r *RuleSourceIP) Config() *config.Rule

func (*RuleSourceIP) Match

func (r *RuleSourceIP) Match(metadata *adapter.Metadata) (match bool)

type RuleSourceIPVersion

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

func NewSourceIPVersionRule

func NewSourceIPVersionRule(config *config.Rule) (*RuleSourceIPVersion, error)

func (*RuleSourceIPVersion) Config

func (r *RuleSourceIPVersion) Config() *config.Rule

func (*RuleSourceIPVersion) Match

func (r *RuleSourceIPVersion) Match(metadata *adapter.Metadata) (match bool)

type RuleSourcePort

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

func NewSourcePortRule

func NewSourcePortRule(config *config.Rule) (*RuleSourcePort, error)

func (*RuleSourcePort) Config

func (r *RuleSourcePort) Config() *config.Rule

func (*RuleSourcePort) Match

func (r *RuleSourcePort) Match(metadata *adapter.Metadata) (match bool)

Jump to

Keyboard shortcuts

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