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 IP RoutingRule Config
Index ¶
- Constants
- Variables
- type AnyCondition
- type CIDRMatcher
- type Condition
- type ConditionChan
- type Config
- type Config_DomainStrategy
- type Domain
- type Domain_Type
- type IP
- type IPv4Matcher
- type NetworkMatcher
- type PlainDomainMatcher
- type PortMatcher
- type RegexpDomainMatcher
- type Router
- type RouterFactory
- type RoutingEntry
- type RoutingRule
- func (this *RoutingRule) BuildCondition() (Condition, error)
- func (*RoutingRule) Descriptor() ([]byte, []int)
- func (m *RoutingRule) GetDomain() []*Domain
- func (m *RoutingRule) GetIp() []*IP
- func (m *RoutingRule) GetNetworkList() *v2ray_core_common_net1.NetworkList
- func (m *RoutingRule) GetPortRange() *v2ray_core_common_net.PortRange
- func (*RoutingRule) ProtoMessage()
- func (m *RoutingRule) Reset()
- func (m *RoutingRule) String() string
- type RoutingTable
- type Rule
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 (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(ip []byte, mask uint32) (*CIDRMatcher, error)
func (*CIDRMatcher) Apply ¶
func (this *CIDRMatcher) Apply(dest v2net.Destination) bool
type Condition ¶ added in v1.1.0
type Condition interface {
Apply(dest v2net.Destination) 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 (this *ConditionChan) Add(cond Condition) *ConditionChan
func (*ConditionChan) Apply ¶ added in v1.1.0
func (this *ConditionChan) Apply(dest v2net.Destination) bool
func (*ConditionChan) Len ¶ added in v1.1.0
func (this *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) GetRule ¶ added in v1.1.0
func (m *Config) GetRule() []*RoutingRule
func (*Config) ProtoMessage ¶ added in v1.1.0
func (*Config) ProtoMessage()
type Config_DomainStrategy ¶
type Config_DomainStrategy int32
const ( Config_AsIs Config_DomainStrategy = 0 Config_UseIp Config_DomainStrategy = 1 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) ProtoMessage ¶
func (*Domain) ProtoMessage()
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 IP ¶
type IP struct { // IP address, should be either 4 or 16 bytes. Ip []byte `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"` // Number of right-most bits in IP matching that is allowed. // Single IP address like 127.0.0.1 should use unmatching_bits = 0. // CIDR 10.0.0.0/8 should use unmatching_bits = 32-8 = 24. UnmatchingBits uint32 `protobuf:"varint,2,opt,name=unmatching_bits,json=unmatchingBits" json:"unmatching_bits,omitempty"` }
IP for routing decision.
func (*IP) Descriptor ¶
func (*IP) ProtoMessage ¶
func (*IP) ProtoMessage()
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 ¶ 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 (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 ¶ 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 (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 (*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) 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 (this *RoutingEntry) Expired() bool
func (*RoutingEntry) Extend ¶
func (this *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"` Ip []*IP `protobuf:"bytes,3,rep,name=ip" json:"ip,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"` }
func (*RoutingRule) BuildCondition ¶ added in v1.1.0
func (this *RoutingRule) BuildCondition() (Condition, error)
func (*RoutingRule) Descriptor ¶ added in v1.1.0
func (*RoutingRule) Descriptor() ([]byte, []int)
func (*RoutingRule) GetDomain ¶ added in v1.1.0
func (m *RoutingRule) GetDomain() []*Domain
func (*RoutingRule) GetIp ¶
func (m *RoutingRule) GetIp() []*IP
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) 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 ¶
func NewRoutingTable ¶
func NewRoutingTable() *RoutingTable
func (*RoutingTable) Cleanup ¶
func (this *RoutingTable) Cleanup()
Click to show internal directories.
Click to hide internal directories.