rule

package
v0.0.0-...-7893bb9 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyReject = "REJECT"
	PolicyDirect = "DIRECT"
	PolicyGlobal = "GLOBAL"
	PolicyMock   = "MOCK"
	PolicyNone   = "NONE"

	RuleDomainSuffix  = "DOMAIN-SUFFIX"
	RuleDomain        = "DOMAIN"
	RuleDomainKeyword = "DOMAIN-KEYWORD"
	RuleGeoIP         = "GEOIP"
	RuleFinal         = "FINAL"
	RuleIPCIDR        = "IP-CIDR"

	ConnModeDirect = "DIRECT"
	ConnModeRemote = "REMOTE"
	ConnModeRule   = "RULE"
	ConnModeReject = "REJECT"

	OptionTunMode = "tun-mode"
)

Variables

View Source
var (
	FailedRule = &Rule{Type: "FAILED", Policy: "FAILED"}
	DirectRule = &Rule{Type: "GLOBAL", Policy: PolicyDirect}
	RemoteRule = &Rule{Type: "GLOBAL", Policy: PolicyGlobal}
	RejectRule = &Rule{Type: "GLOBAL", Policy: PolicyReject}
	MockRule   = &Rule{Type: "MOCK", Policy: PolicyMock}
)

Functions

func ApplyConfig

func ApplyConfig(config IRuleConfig) error

func GetConnMode

func GetConnMode() string

func SetConnMode

func SetConnMode(mode string) error

Types

type IRequest

type IRequest interface {
	Network() string
	Domain() string
	IP() string
	Port() string
	Answer() *dns.Answer
}

type IRuleConfig

type IRuleConfig interface {
	GetRule() [][]string
	SetRule([][]string)
}

type Rule

type Rule struct {
	Type    string
	Value   string
	Policy  string
	Options []string
	Comment string
}

func RuleFilter

func RuleFilter(req IRequest) (*Rule, error)

Jump to

Keyboard shortcuts

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