Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompilationError ¶
func (*CompilationError) Error ¶
func (e *CompilationError) Error() string
type CompiledRuleSet ¶
type CompiledRuleSet[O Outbound] interface { Match(host HostInfo, proto Protocol, port uint16) (O, net.IP) }
func Compile ¶
func Compile[O Outbound](rules []TextRule, outbounds map[string]O, cacheSize int, geoLoader GeoLoader, ) (CompiledRuleSet[O], error)
Compile compiles TextRules into a CompiledRuleSet. Names in the outbounds map MUST be in all lower case. We want on-demand loading of GeoIP/GeoSite databases, so instead of passing the databases directly, we use a GeoLoader interface to load them only when needed by at least one rule.
type InvalidSyntaxError ¶
func (*InvalidSyntaxError) Error ¶
func (e *InvalidSyntaxError) Error() string
type TextRule ¶
type TextRule struct {
Outbound string
Address string
ProtoPort string
HijackAddress string
LineNum int
}
TextRule is the struct representation of a (non-comment) line parsed from an ACL file. A line can be parsed into a TextRule as long as it matches one of the following patterns:
outbound(address) outbound(address,protoPort) outbound(address,protoPort,hijackAddress)
It does not check whether any of the fields is valid - it's up to the compiler to do so.
func ParseTextRules ¶
Click to show internal directories.
Click to hide internal directories.