Documentation ¶
Index ¶
- Variables
- func ContextWithResolveIPs(ctx context.Context, f IPResolver) context.Context
- type AnyCondition
- type CIDR
- func (*CIDR) Descriptor() ([]byte, []int)
- func (m *CIDR) GetIp() []byte
- func (m *CIDR) GetPrefix() uint32
- func (*CIDR) ProtoMessage()
- func (m *CIDR) Reset()
- func (m *CIDR) String() string
- func (m *CIDR) XXX_DiscardUnknown()
- func (m *CIDR) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CIDR) XXX_Merge(src proto.Message)
- func (m *CIDR) XXX_Size() int
- func (m *CIDR) XXX_Unmarshal(b []byte) error
- type CIDRMatcher
- type Condition
- type ConditionChan
- type Config
- func (*Config) Descriptor() ([]byte, []int)
- func (m *Config) GetDomainStrategy() Config_DomainStrategy
- func (m *Config) GetRule() []*RoutingRule
- func (*Config) ProtoMessage()
- func (m *Config) Reset()
- func (m *Config) String() string
- func (m *Config) XXX_DiscardUnknown()
- func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Config) XXX_Merge(src proto.Message)
- func (m *Config) XXX_Size() int
- func (m *Config) XXX_Unmarshal(b []byte) error
- type Config_DomainStrategy
- type Domain
- func (*Domain) Descriptor() ([]byte, []int)
- func (m *Domain) GetType() Domain_Type
- func (m *Domain) GetValue() string
- func (*Domain) ProtoMessage()
- func (m *Domain) Reset()
- func (m *Domain) String() string
- func (m *Domain) XXX_DiscardUnknown()
- func (m *Domain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Domain) XXX_Merge(src proto.Message)
- func (m *Domain) XXX_Size() int
- func (m *Domain) XXX_Unmarshal(b []byte) error
- type DomainMatcher
- type Domain_Type
- type GeoIP
- func (*GeoIP) Descriptor() ([]byte, []int)
- func (m *GeoIP) GetCidr() []*CIDR
- func (m *GeoIP) GetCountryCode() string
- func (*GeoIP) ProtoMessage()
- func (m *GeoIP) Reset()
- func (m *GeoIP) String() string
- func (m *GeoIP) XXX_DiscardUnknown()
- func (m *GeoIP) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GeoIP) XXX_Merge(src proto.Message)
- func (m *GeoIP) XXX_Size() int
- func (m *GeoIP) XXX_Unmarshal(b []byte) error
- type GeoIPList
- func (*GeoIPList) Descriptor() ([]byte, []int)
- func (m *GeoIPList) GetEntry() []*GeoIP
- func (*GeoIPList) ProtoMessage()
- func (m *GeoIPList) Reset()
- func (m *GeoIPList) String() string
- func (m *GeoIPList) XXX_DiscardUnknown()
- func (m *GeoIPList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GeoIPList) XXX_Merge(src proto.Message)
- func (m *GeoIPList) XXX_Size() int
- func (m *GeoIPList) XXX_Unmarshal(b []byte) error
- type GeoSite
- func (*GeoSite) Descriptor() ([]byte, []int)
- func (m *GeoSite) GetCountryCode() string
- func (m *GeoSite) GetDomain() []*Domain
- func (*GeoSite) ProtoMessage()
- func (m *GeoSite) Reset()
- func (m *GeoSite) String() string
- func (m *GeoSite) XXX_DiscardUnknown()
- func (m *GeoSite) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GeoSite) XXX_Merge(src proto.Message)
- func (m *GeoSite) XXX_Size() int
- func (m *GeoSite) XXX_Unmarshal(b []byte) error
- type GeoSiteList
- func (*GeoSiteList) Descriptor() ([]byte, []int)
- func (m *GeoSiteList) GetEntry() []*GeoSite
- func (*GeoSiteList) ProtoMessage()
- func (m *GeoSiteList) Reset()
- func (m *GeoSiteList) String() string
- func (m *GeoSiteList) XXX_DiscardUnknown()
- func (m *GeoSiteList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GeoSiteList) XXX_Merge(src proto.Message)
- func (m *GeoSiteList) XXX_Size() int
- func (m *GeoSiteList) XXX_Unmarshal(b []byte) error
- type IPResolver
- type IPv4Matcher
- type InboundTagMatcher
- type NetworkMatcher
- type PortMatcher
- type ProtocolMatcher
- 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() *net.NetworkList
- func (m *RoutingRule) GetPortRange() *net.PortRange
- func (m *RoutingRule) GetProtocol() []string
- 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
- func (m *RoutingRule) XXX_DiscardUnknown()
- func (m *RoutingRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *RoutingRule) XXX_Merge(src proto.Message)
- func (m *RoutingRule) XXX_Size() int
- func (m *RoutingRule) XXX_Unmarshal(b []byte) error
- type Rule
- type UserMatcher
Constants ¶
This section is empty.
Variables ¶
View Source
var Config_DomainStrategy_name = map[int32]string{
0: "AsIs",
1: "UseIp",
2: "IpIfNonMatch",
3: "IpOnDemand",
}
View Source
var Config_DomainStrategy_value = map[string]int32{
"AsIs": 0,
"UseIp": 1,
"IpIfNonMatch": 2,
"IpOnDemand": 3,
}
View Source
var Domain_Type_name = map[int32]string{
0: "Plain",
1: "Regex",
2: "Domain",
3: "Full",
}
View Source
var Domain_Type_value = map[string]int32{
"Plain": 0,
"Regex": 1,
"Domain": 2,
"Full": 3,
}
Functions ¶
func ContextWithResolveIPs ¶
func ContextWithResolveIPs(ctx context.Context, f IPResolver) context.Context
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,proto3" json:"prefix,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
IP for routing decision, in CIDR form.
func (*CIDR) Descriptor ¶
func (*CIDR) ProtoMessage ¶
func (*CIDR) ProtoMessage()
func (*CIDR) XXX_DiscardUnknown ¶
func (m *CIDR) XXX_DiscardUnknown()
func (*CIDR) XXX_Unmarshal ¶
type CIDRMatcher ¶
type CIDRMatcher struct {
// contains filtered or unexported fields
}
func NewCIDRMatcher ¶
func NewCIDRMatcher(ip []byte, mask uint32, onSource bool) (*CIDRMatcher, error)
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(ctx context.Context) 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 `` /* 153-byte string literal not displayed */ Rule []*RoutingRule `protobuf:"bytes,2,rep,name=rule,proto3" json:"rule,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Config) Descriptor ¶ added in v1.1.0
func (*Config) GetDomainStrategy ¶ added in v1.1.0
func (m *Config) GetDomainStrategy() Config_DomainStrategy
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) XXX_DiscardUnknown ¶
func (m *Config) XXX_DiscardUnknown()
func (*Config) XXX_Marshal ¶
func (*Config) XXX_Unmarshal ¶
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 // Resolve to IP if any rule requires IP matching. Config_IpOnDemand Config_DomainStrategy = 3 )
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,proto3,enum=v2ray.core.app.router.Domain_Type" json:"type,omitempty"` // Domain value. Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Domain for routing decision.
func (*Domain) Descriptor ¶
func (*Domain) GetType ¶
func (m *Domain) GetType() Domain_Type
func (*Domain) ProtoMessage ¶
func (*Domain) ProtoMessage()
func (*Domain) XXX_DiscardUnknown ¶
func (m *Domain) XXX_DiscardUnknown()
func (*Domain) XXX_Marshal ¶
func (*Domain) XXX_Unmarshal ¶
type DomainMatcher ¶ added in v1.1.0
type DomainMatcher struct {
// contains filtered or unexported fields
}
func NewDomainMatcher ¶ added in v1.1.0
func NewDomainMatcher(domains []*Domain) (*DomainMatcher, error)
func (*DomainMatcher) Apply ¶ added in v1.1.0
func (m *DomainMatcher) Apply(ctx context.Context) bool
func (*DomainMatcher) ApplyDomain ¶
func (m *DomainMatcher) ApplyDomain(domain string) bool
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 root domain. Domain_Domain Domain_Type = 2 // The value is a domain. Domain_Full Domain_Type = 3 )
func (Domain_Type) EnumDescriptor ¶
func (Domain_Type) EnumDescriptor() ([]byte, []int)
func (Domain_Type) String ¶
func (x Domain_Type) String() string
type GeoIP ¶
type GeoIP struct { CountryCode string `protobuf:"bytes,1,opt,name=country_code,json=countryCode,proto3" json:"country_code,omitempty"` Cidr []*CIDR `protobuf:"bytes,2,rep,name=cidr,proto3" json:"cidr,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*GeoIP) Descriptor ¶
func (*GeoIP) GetCountryCode ¶
func (*GeoIP) ProtoMessage ¶
func (*GeoIP) ProtoMessage()
func (*GeoIP) XXX_DiscardUnknown ¶
func (m *GeoIP) XXX_DiscardUnknown()
func (*GeoIP) XXX_Marshal ¶
func (*GeoIP) XXX_Unmarshal ¶
type GeoIPList ¶
type GeoIPList struct { Entry []*GeoIP `protobuf:"bytes,1,rep,name=entry,proto3" json:"entry,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*GeoIPList) Descriptor ¶
func (*GeoIPList) ProtoMessage ¶
func (*GeoIPList) ProtoMessage()
func (*GeoIPList) XXX_DiscardUnknown ¶
func (m *GeoIPList) XXX_DiscardUnknown()
func (*GeoIPList) XXX_Marshal ¶
func (*GeoIPList) XXX_Unmarshal ¶
type GeoSite ¶
type GeoSite struct { CountryCode string `protobuf:"bytes,1,opt,name=country_code,json=countryCode,proto3" json:"country_code,omitempty"` Domain []*Domain `protobuf:"bytes,2,rep,name=domain,proto3" json:"domain,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*GeoSite) Descriptor ¶
func (*GeoSite) GetCountryCode ¶
func (*GeoSite) ProtoMessage ¶
func (*GeoSite) ProtoMessage()
func (*GeoSite) XXX_DiscardUnknown ¶
func (m *GeoSite) XXX_DiscardUnknown()
func (*GeoSite) XXX_Marshal ¶
func (*GeoSite) XXX_Unmarshal ¶
type GeoSiteList ¶
type GeoSiteList struct { Entry []*GeoSite `protobuf:"bytes,1,rep,name=entry,proto3" json:"entry,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*GeoSiteList) Descriptor ¶
func (*GeoSiteList) Descriptor() ([]byte, []int)
func (*GeoSiteList) GetEntry ¶
func (m *GeoSiteList) GetEntry() []*GeoSite
func (*GeoSiteList) ProtoMessage ¶
func (*GeoSiteList) ProtoMessage()
func (*GeoSiteList) Reset ¶
func (m *GeoSiteList) Reset()
func (*GeoSiteList) String ¶
func (m *GeoSiteList) String() string
func (*GeoSiteList) XXX_DiscardUnknown ¶
func (m *GeoSiteList) XXX_DiscardUnknown()
func (*GeoSiteList) XXX_Marshal ¶
func (m *GeoSiteList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GeoSiteList) XXX_Merge ¶
func (m *GeoSiteList) XXX_Merge(src proto.Message)
func (*GeoSiteList) XXX_Size ¶
func (m *GeoSiteList) XXX_Size() int
func (*GeoSiteList) XXX_Unmarshal ¶
func (m *GeoSiteList) XXX_Unmarshal(b []byte) error
type IPResolver ¶
func ResolvedIPsFromContext ¶
func ResolvedIPsFromContext(ctx context.Context) (IPResolver, bool)
type IPv4Matcher ¶
type IPv4Matcher struct {
// contains filtered or unexported fields
}
func NewIPv4Matcher ¶
func NewIPv4Matcher(ipnet *net.IPNetTable, onSource bool) *IPv4Matcher
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
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 *net.NetworkList) *NetworkMatcher
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 net.PortRange) *PortMatcher
type ProtocolMatcher ¶ added in v1.1.0
type ProtocolMatcher struct {
// contains filtered or unexported fields
}
func NewProtocolMatcher ¶ added in v1.1.0
func NewProtocolMatcher(protocols []string) *ProtocolMatcher
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is an implementation of routing.Router.
type RoutingRule ¶ added in v1.1.0
type RoutingRule struct { Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"` Domain []*Domain `protobuf:"bytes,2,rep,name=domain,proto3" json:"domain,omitempty"` Cidr []*CIDR `protobuf:"bytes,3,rep,name=cidr,proto3" json:"cidr,omitempty"` PortRange *net.PortRange `protobuf:"bytes,4,opt,name=port_range,json=portRange,proto3" json:"port_range,omitempty"` NetworkList *net.NetworkList `protobuf:"bytes,5,opt,name=network_list,json=networkList,proto3" json:"network_list,omitempty"` SourceCidr []*CIDR `protobuf:"bytes,6,rep,name=source_cidr,json=sourceCidr,proto3" json:"source_cidr,omitempty"` UserEmail []string `protobuf:"bytes,7,rep,name=user_email,json=userEmail,proto3" json:"user_email,omitempty"` InboundTag []string `protobuf:"bytes,8,rep,name=inbound_tag,json=inboundTag,proto3" json:"inbound_tag,omitempty"` Protocol []string `protobuf:"bytes,9,rep,name=protocol,proto3" json:"protocol,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*RoutingRule) BuildCondition ¶ added in v1.1.0
func (rr *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) GetInboundTag ¶ added in v1.1.0
func (m *RoutingRule) GetInboundTag() []string
func (*RoutingRule) GetNetworkList ¶ added in v1.1.0
func (m *RoutingRule) GetNetworkList() *net.NetworkList
func (*RoutingRule) GetPortRange ¶ added in v1.1.0
func (m *RoutingRule) GetPortRange() *net.PortRange
func (*RoutingRule) GetProtocol ¶ added in v1.1.0
func (m *RoutingRule) GetProtocol() []string
func (*RoutingRule) GetSourceCidr ¶ added in v1.1.0
func (m *RoutingRule) GetSourceCidr() []*CIDR
func (*RoutingRule) GetTag ¶ added in v1.1.0
func (m *RoutingRule) GetTag() string
func (*RoutingRule) GetUserEmail ¶ added in v1.1.0
func (m *RoutingRule) GetUserEmail() []string
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
func (*RoutingRule) XXX_DiscardUnknown ¶
func (m *RoutingRule) XXX_DiscardUnknown()
func (*RoutingRule) XXX_Marshal ¶
func (m *RoutingRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RoutingRule) XXX_Merge ¶
func (m *RoutingRule) XXX_Merge(src proto.Message)
func (*RoutingRule) XXX_Size ¶
func (m *RoutingRule) XXX_Size() int
func (*RoutingRule) XXX_Unmarshal ¶
func (m *RoutingRule) XXX_Unmarshal(b []byte) error
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
Click to show internal directories.
Click to hide internal directories.