router

package
v2.11.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2016 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package router is a generated protocol buffer package.

It is generated from these files:

v2ray.com/core/app/router/config.proto

It has these top-level messages:

Domain
CIDR
RoutingRule
Config

Index

Constants

View Source
const (
	APP_ID = app.ID(3)
)

Variables

View Source
var (
	ErrInvalidRule      = errors.New("Invalid Rule")
	ErrNoRuleApplicable = errors.New("No rule applicable")
)
View Source
var Config_DomainStrategy_name = map[int32]string{
	0: "AsIs",
	1: "UseIp",
	2: "IpIfNonMatch",
}
View Source
var Config_DomainStrategy_value = map[string]int32{
	"AsIs":         0,
	"UseIp":        1,
	"IpIfNonMatch": 2,
}
View Source
var Domain_Type_name = map[int32]string{
	0: "Plain",
	1: "Regex",
}
View Source
var Domain_Type_value = map[string]int32{
	"Plain": 0,
	"Regex": 1,
}

Functions

This section is empty.

Types

type AnyCondition

type AnyCondition []Condition

func NewAnyCondition

func NewAnyCondition() *AnyCondition

func (*AnyCondition) Add

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

func (*AnyCondition) Apply

func (v *AnyCondition) Apply(session *proxy.SessionInfo) bool

func (*AnyCondition) Len

func (v *AnyCondition) Len() int

type CIDR

type CIDR struct {
	// IP address, should be either 4 or 16 bytes.
	Ip []byte `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"`
	// Number of leading ones in the network mask.
	Prefix uint32 `protobuf:"varint,2,opt,name=prefix" json:"prefix,omitempty"`
}

IP for routing decision, in CIDR form.

func (*CIDR) Descriptor

func (*CIDR) Descriptor() ([]byte, []int)

func (*CIDR) ProtoMessage

func (*CIDR) ProtoMessage()

func (*CIDR) Reset

func (m *CIDR) Reset()

func (*CIDR) String

func (m *CIDR) String() string

type CIDRMatcher

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

func NewCIDRMatcher

func NewCIDRMatcher(ip []byte, mask uint32, onSource bool) (*CIDRMatcher, error)

func (*CIDRMatcher) Apply

func (v *CIDRMatcher) Apply(session *proxy.SessionInfo) bool

type Condition added in v1.1.0

type Condition interface {
	Apply(session *proxy.SessionInfo) bool
}

type ConditionChan added in v1.1.0

type ConditionChan []Condition

func NewConditionChan added in v1.1.0

func NewConditionChan() *ConditionChan

func (*ConditionChan) Add added in v1.1.0

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

func (*ConditionChan) Apply added in v1.1.0

func (v *ConditionChan) Apply(session *proxy.SessionInfo) bool

func (*ConditionChan) Len added in v1.1.0

func (v *ConditionChan) Len() int

type Config added in v1.1.0

type Config struct {
	DomainStrategy Config_DomainStrategy `` /* 146-byte string literal not displayed */
	Rule           []*RoutingRule        `protobuf:"bytes,2,rep,name=rule" json:"rule,omitempty"`
}

func (*Config) Descriptor added in v1.1.0

func (*Config) Descriptor() ([]byte, []int)

func (*Config) GetRule added in v1.1.0

func (m *Config) GetRule() []*RoutingRule

func (*Config) ProtoMessage added in v1.1.0

func (*Config) ProtoMessage()

func (*Config) Reset added in v1.1.0

func (m *Config) Reset()

func (*Config) String added in v1.1.0

func (m *Config) String() string

type Config_DomainStrategy

type Config_DomainStrategy int32
const (
	// Use domain as is.
	Config_AsIs Config_DomainStrategy = 0
	// Always resolve IP for domains.
	Config_UseIp Config_DomainStrategy = 1
	// Resolve to IP if the domain doesn't match any rules.
	Config_IpIfNonMatch Config_DomainStrategy = 2
)

func (Config_DomainStrategy) EnumDescriptor

func (Config_DomainStrategy) EnumDescriptor() ([]byte, []int)

func (Config_DomainStrategy) String

func (x Config_DomainStrategy) String() string

type Domain

type Domain struct {
	// Domain matching type.
	Type Domain_Type `protobuf:"varint,1,opt,name=type,enum=v2ray.core.app.router.Domain_Type" json:"type,omitempty"`
	// Domain value.
	Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
}

Domain for routing decision.

func (*Domain) Descriptor

func (*Domain) Descriptor() ([]byte, []int)

func (*Domain) ProtoMessage

func (*Domain) ProtoMessage()

func (*Domain) Reset

func (m *Domain) Reset()

func (*Domain) String

func (m *Domain) String() string

type Domain_Type

type Domain_Type int32

Type of domain value.

const (
	// The value is used as is.
	Domain_Plain Domain_Type = 0
	// The value is used as a regular expression.
	Domain_Regex Domain_Type = 1
)

func (Domain_Type) EnumDescriptor

func (Domain_Type) EnumDescriptor() ([]byte, []int)

func (Domain_Type) String

func (x Domain_Type) String() string

type IPv4Matcher

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

func NewIPv4Matcher

func NewIPv4Matcher(ipnet *v2net.IPNet, onSource bool) *IPv4Matcher

func (*IPv4Matcher) Apply

func (v *IPv4Matcher) Apply(session *proxy.SessionInfo) bool

type InboundTagMatcher added in v1.1.0

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

func NewInboundTagMatcher added in v1.1.0

func NewInboundTagMatcher(tags []string) *InboundTagMatcher

func (*InboundTagMatcher) Apply added in v1.1.0

func (v *InboundTagMatcher) Apply(session *proxy.SessionInfo) bool

type NetworkMatcher added in v1.1.0

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

func NewNetworkMatcher added in v1.1.0

func NewNetworkMatcher(network *v2net.NetworkList) *NetworkMatcher

func (*NetworkMatcher) Apply added in v1.1.0

func (v *NetworkMatcher) Apply(session *proxy.SessionInfo) bool

type PlainDomainMatcher

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

func NewPlainDomainMatcher

func NewPlainDomainMatcher(pattern string) *PlainDomainMatcher

func (*PlainDomainMatcher) Apply

func (v *PlainDomainMatcher) Apply(session *proxy.SessionInfo) bool

type PortMatcher added in v1.1.0

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

func NewPortMatcher added in v1.1.0

func NewPortMatcher(portRange v2net.PortRange) *PortMatcher

func (*PortMatcher) Apply added in v1.1.0

func (v *PortMatcher) Apply(session *proxy.SessionInfo) bool

type RegexpDomainMatcher

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

func NewRegexpDomainMatcher

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

func (*RegexpDomainMatcher) Apply

func (v *RegexpDomainMatcher) Apply(session *proxy.SessionInfo) bool

type Router

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

func NewRouter

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

func (*Router) Release

func (v *Router) Release()

func (*Router) ResolveIP

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

Private: Visible for testing.

func (*Router) TakeDetour

func (v *Router) TakeDetour(session *proxy.SessionInfo) (string, error)

type RouterFactory

type RouterFactory struct{}

func (RouterFactory) AppId

func (RouterFactory) AppId() app.ID

func (RouterFactory) Create

func (RouterFactory) Create(space app.Space, config interface{}) (app.Application, error)

type RoutingEntry

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

func (*RoutingEntry) Expired

func (v *RoutingEntry) Expired() bool

func (*RoutingEntry) Extend

func (v *RoutingEntry) Extend()

type RoutingRule added in v1.1.0

type RoutingRule struct {
	Tag         string                              `protobuf:"bytes,1,opt,name=tag" json:"tag,omitempty"`
	Domain      []*Domain                           `protobuf:"bytes,2,rep,name=domain" json:"domain,omitempty"`
	Cidr        []*CIDR                             `protobuf:"bytes,3,rep,name=cidr" json:"cidr,omitempty"`
	PortRange   *v2ray_core_common_net.PortRange    `protobuf:"bytes,4,opt,name=port_range,json=portRange" json:"port_range,omitempty"`
	NetworkList *v2ray_core_common_net1.NetworkList `protobuf:"bytes,5,opt,name=network_list,json=networkList" json:"network_list,omitempty"`
	SourceCidr  []*CIDR                             `protobuf:"bytes,6,rep,name=source_cidr,json=sourceCidr" json:"source_cidr,omitempty"`
	UserEmail   []string                            `protobuf:"bytes,7,rep,name=user_email,json=userEmail" json:"user_email,omitempty"`
	InboundTag  []string                            `protobuf:"bytes,8,rep,name=inbound_tag,json=inboundTag" json:"inbound_tag,omitempty"`
}

func (*RoutingRule) BuildCondition added in v1.1.0

func (v *RoutingRule) BuildCondition() (Condition, error)

func (*RoutingRule) Descriptor added in v1.1.0

func (*RoutingRule) Descriptor() ([]byte, []int)

func (*RoutingRule) GetCidr added in v1.1.0

func (m *RoutingRule) GetCidr() []*CIDR

func (*RoutingRule) GetDomain added in v1.1.0

func (m *RoutingRule) GetDomain() []*Domain

func (*RoutingRule) GetNetworkList added in v1.1.0

func (m *RoutingRule) GetNetworkList() *v2ray_core_common_net1.NetworkList

func (*RoutingRule) GetPortRange added in v1.1.0

func (m *RoutingRule) GetPortRange() *v2ray_core_common_net.PortRange

func (*RoutingRule) GetSourceCidr added in v1.1.0

func (m *RoutingRule) GetSourceCidr() []*CIDR

func (*RoutingRule) ProtoMessage added in v1.1.0

func (*RoutingRule) ProtoMessage()

func (*RoutingRule) Reset added in v1.1.0

func (m *RoutingRule) Reset()

func (*RoutingRule) String added in v1.1.0

func (m *RoutingRule) String() string

type RoutingTable

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

func NewRoutingTable

func NewRoutingTable() *RoutingTable

func (*RoutingTable) Cleanup

func (v *RoutingTable) Cleanup()

func (*RoutingTable) Get

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

func (*RoutingTable) Set

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

type Rule added in v1.1.0

type Rule struct {
	Tag       string
	Condition Condition
}

func (*Rule) Apply added in v1.1.0

func (v *Rule) Apply(session *proxy.SessionInfo) bool

type UserMatcher added in v1.1.0

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

func NewUserMatcher added in v1.1.0

func NewUserMatcher(users []string) *UserMatcher

func (*UserMatcher) Apply added in v1.1.0

func (v *UserMatcher) Apply(session *proxy.SessionInfo) bool

Jump to

Keyboard shortcuts

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