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

type AnyCondition []Condition

func NewAnyCondition

func NewAnyCondition() *AnyCondition

func (*AnyCondition) Add

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

func (*AnyCondition) Apply

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

func (*AnyCondition) Len

func (this *AnyCondition) Len() int

type CIDRMatcher

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

func NewCIDRMatcher

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

func (*CIDRMatcher) Apply

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

type Condition

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

type ConditionChan

type ConditionChan []Condition

func NewConditionChan

func NewConditionChan() *ConditionChan

func (*ConditionChan) Add

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

func (*ConditionChan) Apply

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

func (*ConditionChan) Len

func (this *ConditionChan) Len() int

type DomainStrategy

type DomainStrategy int

type IPv4Matcher

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

func NewIPv4Matcher

func NewIPv4Matcher(ipnet *v2net.IPNet) *IPv4Matcher

func (*IPv4Matcher) Apply

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

type NetworkMatcher

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

func NewNetworkMatcher

func NewNetworkMatcher(network *v2net.NetworkList) *NetworkMatcher

func (*NetworkMatcher) Apply

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

type PlainDomainMatcher

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

func NewPlainDomainMatcher

func NewPlainDomainMatcher(pattern string) *PlainDomainMatcher

func (*PlainDomainMatcher) Apply

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

type PortMatcher

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

func NewPortMatcher

func NewPortMatcher(portRange v2net.PortRange) *PortMatcher

func (*PortMatcher) Apply

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

type RegexpDomainMatcher

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

func NewRegexpDomainMatcher

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

func (*RegexpDomainMatcher) Apply

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

type Router

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

func NewRouter

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

func (*Router) Release

func (this *Router) Release()

func (*Router) ResolveIP

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

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

type RoutingEntry

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

func (*RoutingEntry) Expired

func (this *RoutingEntry) Expired() bool

func (*RoutingEntry) Extend

func (this *RoutingEntry) Extend()

type RoutingTable

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

func NewRoutingTable

func NewRoutingTable() *RoutingTable

func (*RoutingTable) Cleanup

func (this *RoutingTable) Cleanup()

func (*RoutingTable) Get

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

func (*RoutingTable) Set

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

type Rule

type Rule struct {
	Tag       string
	Condition Condition
}

func NewChinaIPRule

func NewChinaIPRule(tag string) *Rule

func NewChinaSitesRule

func NewChinaSitesRule(tag string) *Rule

func (*Rule) Apply

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