Documentation ¶
Index ¶
- Variables
- type AnyCondition
- type CIDR
- type CIDRMatcher
- type Condition
- type ConditionChan
- type Config
- type Config_DomainStrategy
- type Domain
- type Domain_Type
- type IPv4Matcher
- type InboundTagMatcher
- type NetworkMatcher
- type PlainDomainMatcher
- type PortMatcher
- type RegexpDomainMatcher
- type Router
- type RoutingRule
- func (rr *RoutingRule) BuildCondition() (Condition, error)
- func (*RoutingRule) Descriptor() ([]byte, []int)
- func (m *RoutingRule) GetCidr() []*CIDR
- func (m *RoutingRule) GetDomain() []*Domain
- func (m *RoutingRule) GetInboundTag() []string
- func (m *RoutingRule) GetNetworkList() *v2ray_core_common_net1.NetworkList
- func (m *RoutingRule) GetPortRange() *v2ray_core_common_net.PortRange
- func (m *RoutingRule) GetSourceCidr() []*CIDR
- func (m *RoutingRule) GetTag() string
- func (m *RoutingRule) GetUserEmail() []string
- func (*RoutingRule) ProtoMessage()
- func (m *RoutingRule) Reset()
- func (m *RoutingRule) String() string
- type Rule
- type SubDomainMatcher
- type UserMatcher
Constants ¶
This section is empty.
Variables ¶
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",
2: "Domain",
}
View Source
var Domain_Type_value = map[string]int32{
"Plain": 0,
"Regex": 1,
"Domain": 2,
}
View Source
var (
ErrNoRuleApplicable = newError("No rule applicable")
)
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) 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) ProtoMessage ¶
func (*CIDR) ProtoMessage()
type CIDRMatcher ¶
type CIDRMatcher struct {
// contains filtered or unexported fields
}
func NewCIDRMatcher ¶
func NewCIDRMatcher(ip []byte, mask uint32, onSource bool) (*CIDRMatcher, error)
type ConditionChan ¶
type ConditionChan []Condition
func NewConditionChan ¶
func NewConditionChan() *ConditionChan
func (*ConditionChan) Add ¶
func (v *ConditionChan) Add(cond Condition) *ConditionChan
func (*ConditionChan) Len ¶
func (v *ConditionChan) Len() int
type Config ¶ added in v1.1.1
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 ¶
func (*Config) GetDomainStrategy ¶
func (m *Config) GetDomainStrategy() Config_DomainStrategy
func (*Config) GetRule ¶
func (m *Config) GetRule() []*RoutingRule
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
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) GetType ¶
func (m *Domain) GetType() Domain_Type
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 // The value is a domain. Domain_Domain Domain_Type = 2 )
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 *net.IPNetTable, onSource bool) *IPv4Matcher
type InboundTagMatcher ¶
type InboundTagMatcher struct {
// contains filtered or unexported fields
}
func NewInboundTagMatcher ¶
func NewInboundTagMatcher(tags []string) *InboundTagMatcher
type NetworkMatcher ¶
type NetworkMatcher struct {
// contains filtered or unexported fields
}
func NewNetworkMatcher ¶
func NewNetworkMatcher(network *net.NetworkList) *NetworkMatcher
type PlainDomainMatcher ¶
type PlainDomainMatcher string
type PortMatcher ¶
type PortMatcher struct {
// contains filtered or unexported fields
}
func NewPortMatcher ¶
func NewPortMatcher(portRange net.PortRange) *PortMatcher
type RegexpDomainMatcher ¶
type RegexpDomainMatcher struct {
// contains filtered or unexported fields
}
func NewRegexpDomainMatcher ¶
func NewRegexpDomainMatcher(pattern string) (*RegexpDomainMatcher, error)
type RoutingRule ¶
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 ¶
func (rr *RoutingRule) BuildCondition() (Condition, error)
func (*RoutingRule) Descriptor ¶
func (*RoutingRule) Descriptor() ([]byte, []int)
func (*RoutingRule) GetCidr ¶
func (m *RoutingRule) GetCidr() []*CIDR
func (*RoutingRule) GetDomain ¶
func (m *RoutingRule) GetDomain() []*Domain
func (*RoutingRule) GetInboundTag ¶
func (m *RoutingRule) GetInboundTag() []string
func (*RoutingRule) GetNetworkList ¶
func (m *RoutingRule) GetNetworkList() *v2ray_core_common_net1.NetworkList
func (*RoutingRule) GetPortRange ¶
func (m *RoutingRule) GetPortRange() *v2ray_core_common_net.PortRange
func (*RoutingRule) GetSourceCidr ¶
func (m *RoutingRule) GetSourceCidr() []*CIDR
func (*RoutingRule) GetTag ¶
func (m *RoutingRule) GetTag() string
func (*RoutingRule) GetUserEmail ¶
func (m *RoutingRule) GetUserEmail() []string
func (*RoutingRule) ProtoMessage ¶
func (*RoutingRule) ProtoMessage()
func (*RoutingRule) Reset ¶
func (m *RoutingRule) Reset()
func (*RoutingRule) String ¶
func (m *RoutingRule) String() string
type SubDomainMatcher ¶
type SubDomainMatcher string
type UserMatcher ¶
type UserMatcher struct {
// contains filtered or unexported fields
}
func NewUserMatcher ¶
func NewUserMatcher(users []string) *UserMatcher
Click to show internal directories.
Click to hide internal directories.