rules

package
v2.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DomainAsIs      = DomainStrategy(0)
	AlwaysUseIP     = DomainStrategy(1)
	UseIPIfNonMatch = DomainStrategy(2)
)
View Source
var (
	ErrInvalidRule      = errors.New("Invalid Rule")
	ErrNoRuleApplicable = errors.New("No rule applicable")
)

Functions

This section is empty.

Types

type AnyCondition added in v1.9.1

type AnyCondition []Condition

func NewAnyCondition added in v1.9.1

func NewAnyCondition() *AnyCondition

func (*AnyCondition) Add added in v1.9.1

func (this *AnyCondition) Add(cond Condition) *AnyCondition

func (*AnyCondition) Apply added in v1.9.1

func (this *AnyCondition) Apply(dest v2net.Destination) bool

func (*AnyCondition) Len added in v1.9.1

func (this *AnyCondition) Len() int

type CIDRMatcher added in v1.9.1

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

func NewCIDRMatcher added in v1.9.1

func NewCIDRMatcher(ipnet string) (*CIDRMatcher, error)

func (*CIDRMatcher) Apply added in v1.9.1

func (this *CIDRMatcher) Apply(dest v2net.Destination) bool

type Condition added in v1.9.1

type Condition interface {
	Apply(dest v2net.Destination) bool
}

type ConditionChan added in v1.9.1

type ConditionChan []Condition

func NewConditionChan added in v1.9.1

func NewConditionChan() *ConditionChan

func (*ConditionChan) Add added in v1.9.1

func (this *ConditionChan) Add(cond Condition) *ConditionChan

func (*ConditionChan) Apply added in v1.9.1

func (this *ConditionChan) Apply(dest v2net.Destination) bool

func (*ConditionChan) Len added in v1.9.1

func (this *ConditionChan) Len() int

type DomainStrategy added in v1.13.1

type DomainStrategy int

type IPv4Matcher added in v1.9.1

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

func NewIPv4Matcher added in v1.9.1

func NewIPv4Matcher(ipnet *v2net.IPNet) *IPv4Matcher

func (*IPv4Matcher) Apply added in v1.9.1

func (this *IPv4Matcher) Apply(dest v2net.Destination) bool

type NetworkMatcher added in v1.9.1

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

func NewNetworkMatcher added in v1.9.1

func NewNetworkMatcher(network *v2net.NetworkList) *NetworkMatcher

func (*NetworkMatcher) Apply added in v1.9.1

func (this *NetworkMatcher) Apply(dest v2net.Destination) bool

type PlainDomainMatcher added in v1.9.1

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

func NewPlainDomainMatcher added in v1.9.1

func NewPlainDomainMatcher(pattern string) *PlainDomainMatcher

func (*PlainDomainMatcher) Apply added in v1.9.1

func (this *PlainDomainMatcher) Apply(dest v2net.Destination) bool

type PortMatcher added in v1.9.1

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

func NewPortMatcher added in v1.9.1

func NewPortMatcher(portRange v2net.PortRange) *PortMatcher

func (*PortMatcher) Apply added in v1.9.1

func (this *PortMatcher) Apply(dest v2net.Destination) bool

type RegexpDomainMatcher added in v1.9.1

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

func NewRegexpDomainMatcher added in v1.9.1

func NewRegexpDomainMatcher(pattern string) (*RegexpDomainMatcher, error)

func (*RegexpDomainMatcher) Apply added in v1.9.1

func (this *RegexpDomainMatcher) Apply(dest v2net.Destination) bool

type Router

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

func NewRouter added in v1.1.1

func NewRouter(config *RouterRuleConfig, space app.Space) *Router

func (*Router) Release added in v1.13.1

func (this *Router) Release()

func (*Router) ResolveIP added in v1.13.1

func (this *Router) ResolveIP(dest v2net.Destination) []v2net.Destination

Private: Visible for testing.

func (*Router) TakeDetour

func (this *Router) TakeDetour(dest v2net.Destination) (string, error)

type RouterFactory

type RouterFactory struct {
}

func (*RouterFactory) Create

func (this *RouterFactory) Create(rawConfig interface{}, space app.Space) (router.Router, error)

type RouterRuleConfig added in v1.1.1

type RouterRuleConfig struct {
	Rules          []*Rule
	DomainStrategy DomainStrategy
}

type RoutingEntry added in v1.17.2

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

func (*RoutingEntry) Expired added in v1.17.2

func (this *RoutingEntry) Expired() bool

func (*RoutingEntry) Extend added in v1.17.2

func (this *RoutingEntry) Extend()

type RoutingTable added in v1.17.2

type RoutingTable struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewRoutingTable added in v1.17.2

func NewRoutingTable() *RoutingTable

func (*RoutingTable) Cleanup added in v1.17.2

func (this *RoutingTable) Cleanup()

func (*RoutingTable) Get added in v1.17.2

func (this *RoutingTable) Get(destination string) (bool, string, error)

func (*RoutingTable) Set added in v1.17.2

func (this *RoutingTable) Set(destination string, tag string, err error)

type Rule added in v1.1.1

type Rule struct {
	Tag       string
	Condition Condition
}

func NewChinaIPRule added in v1.9.1

func NewChinaIPRule(tag string) *Rule

func NewChinaSitesRule added in v1.9.1

func NewChinaSitesRule(tag string) *Rule

func (*Rule) Apply added in v1.1.1

func (this *Rule) Apply(dest v2net.Destination) bool

Jump to

Keyboard shortcuts

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