Documentation ¶
Index ¶
- Variables
- type AttributeMatcher
- type Balancer
- type BalancingPrincipleTarget
- type BalancingRule
- func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatcher) (*Balancer, error)
- func (*BalancingRule) Descriptor() ([]byte, []int)deprecated
- func (x *BalancingRule) GetFallbackTag() string
- func (x *BalancingRule) GetOutboundSelector() []string
- func (x *BalancingRule) GetStrategy() string
- func (x *BalancingRule) GetStrategySettings() *serial.TypedMessage
- func (x *BalancingRule) GetTag() string
- func (*BalancingRule) ProtoMessage()
- func (x *BalancingRule) ProtoReflect() protoreflect.Message
- func (x *BalancingRule) Reset()
- func (x *BalancingRule) String() string
- type BalancingStrategy
- type CIDR
- type Condition
- type ConditionChan
- type Config
- func (*Config) Descriptor() ([]byte, []int)deprecated
- func (x *Config) GetBalancingRule() []*BalancingRule
- func (x *Config) GetDomainStrategy() Config_DomainStrategy
- func (x *Config) GetRule() []*RoutingRule
- func (*Config) ProtoMessage()
- func (x *Config) ProtoReflect() protoreflect.Message
- func (x *Config) Reset()
- func (x *Config) String() string
- type Config_DomainStrategy
- func (Config_DomainStrategy) Descriptor() protoreflect.EnumDescriptor
- func (x Config_DomainStrategy) Enum() *Config_DomainStrategy
- func (Config_DomainStrategy) EnumDescriptor() ([]byte, []int)deprecated
- func (x Config_DomainStrategy) Number() protoreflect.EnumNumber
- func (x Config_DomainStrategy) String() string
- func (Config_DomainStrategy) Type() protoreflect.EnumType
- type Domain
- func (*Domain) Descriptor() ([]byte, []int)deprecated
- func (x *Domain) GetAttribute() []*Domain_Attribute
- func (x *Domain) GetType() Domain_Type
- func (x *Domain) GetValue() string
- func (*Domain) ProtoMessage()
- func (x *Domain) ProtoReflect() protoreflect.Message
- func (x *Domain) Reset()
- func (x *Domain) String() string
- type DomainMatcher
- type Domain_Attribute
- func (*Domain_Attribute) Descriptor() ([]byte, []int)deprecated
- func (x *Domain_Attribute) GetBoolValue() bool
- func (x *Domain_Attribute) GetIntValue() int64
- func (x *Domain_Attribute) GetKey() string
- func (m *Domain_Attribute) GetTypedValue() isDomain_Attribute_TypedValue
- func (*Domain_Attribute) ProtoMessage()
- func (x *Domain_Attribute) ProtoReflect() protoreflect.Message
- func (x *Domain_Attribute) Reset()
- func (x *Domain_Attribute) String() string
- type Domain_Attribute_BoolValue
- type Domain_Attribute_IntValue
- type Domain_Type
- func (Domain_Type) Descriptor() protoreflect.EnumDescriptor
- func (x Domain_Type) Enum() *Domain_Type
- func (Domain_Type) EnumDescriptor() ([]byte, []int)deprecated
- func (x Domain_Type) Number() protoreflect.EnumNumber
- func (x Domain_Type) String() string
- func (Domain_Type) Type() protoreflect.EnumType
- type GeoIP
- func (*GeoIP) Descriptor() ([]byte, []int)deprecated
- func (x *GeoIP) GetCidr() []*CIDR
- func (x *GeoIP) GetCountryCode() string
- func (x *GeoIP) GetReverseMatch() bool
- func (*GeoIP) ProtoMessage()
- func (x *GeoIP) ProtoReflect() protoreflect.Message
- func (x *GeoIP) Reset()
- func (x *GeoIP) String() string
- type GeoIPList
- type GeoIPMatcher
- type GeoIPMatcherContainer
- type GeoSite
- type GeoSiteList
- type InboundTagMatcher
- type LeastLoadStrategy
- type LeastPingStrategy
- type MultiGeoIPMatcher
- type NetworkMatcher
- type PortMatcher
- type ProtocolMatcher
- type RandomStrategy
- type RoundRobinStrategy
- type Route
- type Router
- func (r *Router) AddRule(config *serial.TypedMessage, shouldAppend bool) error
- func (r *Router) Close() error
- func (r *Router) GetOverrideTarget(tag string) (string, error)
- func (r *Router) GetPrincipleTarget(tag string) ([]string, error)
- func (r *Router) Init(ctx context.Context, config *Config, d dns.Client, ohm outbound.Manager, ...) error
- func (r *Router) OverrideBalancer(balancer string, target string) error
- func (r *Router) PickRoute(ctx routing.Context) (routing.Route, error)
- func (r *Router) ReloadRules(config *Config, shouldAppend bool) error
- func (r *Router) RemoveRule(tag string) error
- func (r *Router) RuleExists(tag string) bool
- func (r *Router) SetOverrideTarget(tag, target string) error
- func (r *Router) Start() error
- func (*Router) Type() interface{}
- type RoutingRule
- func (rr *RoutingRule) BuildCondition() (Condition, error)
- func (*RoutingRule) Descriptor() ([]byte, []int)deprecated
- func (x *RoutingRule) GetAttributes() map[string]string
- func (x *RoutingRule) GetBalancingTag() string
- func (x *RoutingRule) GetDomain() []*Domain
- func (x *RoutingRule) GetDomainMatcher() string
- func (x *RoutingRule) GetGeoip() []*GeoIP
- func (x *RoutingRule) GetInboundTag() []string
- func (x *RoutingRule) GetNetworks() []net.Network
- func (x *RoutingRule) GetPortList() *net.PortList
- func (x *RoutingRule) GetProtocol() []string
- func (x *RoutingRule) GetRuleTag() string
- func (x *RoutingRule) GetSourceGeoip() []*GeoIP
- func (x *RoutingRule) GetSourcePortList() *net.PortList
- func (x *RoutingRule) GetTag() string
- func (m *RoutingRule) GetTargetTag() isRoutingRule_TargetTag
- func (x *RoutingRule) GetUserEmail() []string
- func (*RoutingRule) ProtoMessage()
- func (x *RoutingRule) ProtoReflect() protoreflect.Message
- func (x *RoutingRule) Reset()
- func (x *RoutingRule) String() string
- type RoutingRule_BalancingTag
- type RoutingRule_Tag
- type Rule
- type StrategyLeastLoadConfig
- func (*StrategyLeastLoadConfig) Descriptor() ([]byte, []int)deprecated
- func (x *StrategyLeastLoadConfig) GetBaselines() []int64
- func (x *StrategyLeastLoadConfig) GetCosts() []*StrategyWeight
- func (x *StrategyLeastLoadConfig) GetExpected() int32
- func (x *StrategyLeastLoadConfig) GetMaxRTT() int64
- func (x *StrategyLeastLoadConfig) GetTolerance() float32
- func (*StrategyLeastLoadConfig) ProtoMessage()
- func (x *StrategyLeastLoadConfig) ProtoReflect() protoreflect.Message
- func (x *StrategyLeastLoadConfig) Reset()
- func (x *StrategyLeastLoadConfig) String() string
- type StrategyWeight
- func (*StrategyWeight) Descriptor() ([]byte, []int)deprecated
- func (x *StrategyWeight) GetMatch() string
- func (x *StrategyWeight) GetRegexp() bool
- func (x *StrategyWeight) GetValue() float32
- func (*StrategyWeight) ProtoMessage()
- func (x *StrategyWeight) ProtoReflect() protoreflect.Message
- func (x *StrategyWeight) Reset()
- func (x *StrategyWeight) String() string
- type UserMatcher
- type WeightManager
Constants ¶
This section is empty.
Variables ¶
var ( Domain_Type_name = map[int32]string{ 0: "Plain", 1: "Regex", 2: "Domain", 3: "Full", } Domain_Type_value = map[string]int32{ "Plain": 0, "Regex": 1, "Domain": 2, "Full": 3, } )
Enum value maps for Domain_Type.
var ( Config_DomainStrategy_name = map[int32]string{ 0: "AsIs", 1: "UseIp", 2: "IpIfNonMatch", 3: "IpOnDemand", } Config_DomainStrategy_value = map[string]int32{ "AsIs": 0, "UseIp": 1, "IpIfNonMatch": 2, "IpOnDemand": 3, } )
Enum value maps for Config_DomainStrategy.
var File_app_router_config_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type AttributeMatcher ¶
type AttributeMatcher struct {
// contains filtered or unexported fields
}
type Balancer ¶
type Balancer struct {
// contains filtered or unexported fields
}
func (*Balancer) InjectContext ¶
func (*Balancer) PickOutbound ¶
PickOutbound picks the tag of a outbound
func (*Balancer) SelectOutbounds ¶
SelectOutbounds select outbounds with selectors of the Balancer
type BalancingRule ¶
type BalancingRule struct { Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"` OutboundSelector []string `protobuf:"bytes,2,rep,name=outbound_selector,json=outboundSelector,proto3" json:"outbound_selector,omitempty"` Strategy string `protobuf:"bytes,3,opt,name=strategy,proto3" json:"strategy,omitempty"` StrategySettings *serial.TypedMessage `protobuf:"bytes,4,opt,name=strategy_settings,json=strategySettings,proto3" json:"strategy_settings,omitempty"` FallbackTag string `protobuf:"bytes,5,opt,name=fallback_tag,json=fallbackTag,proto3" json:"fallback_tag,omitempty"` // contains filtered or unexported fields }
func (*BalancingRule) Build ¶
func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatcher) (*Balancer, error)
Build builds the balancing rule
func (*BalancingRule) Descriptor
deprecated
func (*BalancingRule) Descriptor() ([]byte, []int)
Deprecated: Use BalancingRule.ProtoReflect.Descriptor instead.
func (*BalancingRule) GetFallbackTag ¶
func (x *BalancingRule) GetFallbackTag() string
func (*BalancingRule) GetOutboundSelector ¶
func (x *BalancingRule) GetOutboundSelector() []string
func (*BalancingRule) GetStrategy ¶
func (x *BalancingRule) GetStrategy() string
func (*BalancingRule) GetStrategySettings ¶
func (x *BalancingRule) GetStrategySettings() *serial.TypedMessage
func (*BalancingRule) GetTag ¶
func (x *BalancingRule) GetTag() string
func (*BalancingRule) ProtoMessage ¶
func (*BalancingRule) ProtoMessage()
func (*BalancingRule) ProtoReflect ¶
func (x *BalancingRule) ProtoReflect() protoreflect.Message
func (*BalancingRule) Reset ¶
func (x *BalancingRule) Reset()
func (*BalancingRule) String ¶
func (x *BalancingRule) String() string
type BalancingStrategy ¶
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"` // contains filtered or unexported fields }
IP for routing decision, in CIDR form.
func (*CIDR) Descriptor
deprecated
func (*CIDR) ProtoMessage ¶
func (*CIDR) ProtoMessage()
func (*CIDR) ProtoReflect ¶
func (x *CIDR) ProtoReflect() protoreflect.Message
type ConditionChan ¶
type ConditionChan []Condition
func NewConditionChan ¶
func NewConditionChan() *ConditionChan
func (*ConditionChan) Add ¶
func (v *ConditionChan) Add(cond Condition) *ConditionChan
func (*ConditionChan) Apply ¶
func (v *ConditionChan) Apply(ctx routing.Context) bool
Apply applies all conditions registered in this chan.
func (*ConditionChan) Len ¶
func (v *ConditionChan) Len() int
type Config ¶
type Config struct { DomainStrategy Config_DomainStrategy `` /* 147-byte string literal not displayed */ Rule []*RoutingRule `protobuf:"bytes,2,rep,name=rule,proto3" json:"rule,omitempty"` BalancingRule []*BalancingRule `protobuf:"bytes,3,rep,name=balancing_rule,json=balancingRule,proto3" json:"balancing_rule,omitempty"` // contains filtered or unexported fields }
func (*Config) Descriptor
deprecated
func (*Config) GetBalancingRule ¶
func (x *Config) GetBalancingRule() []*BalancingRule
func (*Config) GetDomainStrategy ¶
func (x *Config) GetDomainStrategy() Config_DomainStrategy
func (*Config) GetRule ¶
func (x *Config) GetRule() []*RoutingRule
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) ProtoReflect ¶
func (x *Config) ProtoReflect() protoreflect.Message
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) Descriptor ¶
func (Config_DomainStrategy) Descriptor() protoreflect.EnumDescriptor
func (Config_DomainStrategy) Enum ¶
func (x Config_DomainStrategy) Enum() *Config_DomainStrategy
func (Config_DomainStrategy) EnumDescriptor
deprecated
func (Config_DomainStrategy) EnumDescriptor() ([]byte, []int)
Deprecated: Use Config_DomainStrategy.Descriptor instead.
func (Config_DomainStrategy) Number ¶
func (x Config_DomainStrategy) Number() protoreflect.EnumNumber
func (Config_DomainStrategy) String ¶
func (x Config_DomainStrategy) String() string
func (Config_DomainStrategy) Type ¶
func (Config_DomainStrategy) Type() protoreflect.EnumType
type Domain ¶
type Domain struct { // Domain matching type. Type Domain_Type `protobuf:"varint,1,opt,name=type,proto3,enum=xray.app.router.Domain_Type" json:"type,omitempty"` // Domain value. Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // Attributes of this domain. May be used for filtering. Attribute []*Domain_Attribute `protobuf:"bytes,3,rep,name=attribute,proto3" json:"attribute,omitempty"` // contains filtered or unexported fields }
Domain for routing decision.
func (*Domain) Descriptor
deprecated
func (*Domain) GetAttribute ¶
func (x *Domain) GetAttribute() []*Domain_Attribute
func (*Domain) GetType ¶
func (x *Domain) GetType() Domain_Type
func (*Domain) ProtoMessage ¶
func (*Domain) ProtoMessage()
func (*Domain) ProtoReflect ¶
func (x *Domain) ProtoReflect() protoreflect.Message
type DomainMatcher ¶
type DomainMatcher struct {
// contains filtered or unexported fields
}
func NewDomainMatcher ¶
func NewDomainMatcher(domains []*Domain) (*DomainMatcher, error)
func NewMphMatcherGroup ¶
func NewMphMatcherGroup(domains []*Domain) (*DomainMatcher, error)
func (*DomainMatcher) Apply ¶
func (m *DomainMatcher) Apply(ctx routing.Context) bool
Apply implements Condition.
func (*DomainMatcher) ApplyDomain ¶
func (m *DomainMatcher) ApplyDomain(domain string) bool
type Domain_Attribute ¶
type Domain_Attribute struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Types that are assignable to TypedValue: // // *Domain_Attribute_BoolValue // *Domain_Attribute_IntValue TypedValue isDomain_Attribute_TypedValue `protobuf_oneof:"typed_value"` // contains filtered or unexported fields }
func (*Domain_Attribute) Descriptor
deprecated
func (*Domain_Attribute) Descriptor() ([]byte, []int)
Deprecated: Use Domain_Attribute.ProtoReflect.Descriptor instead.
func (*Domain_Attribute) GetBoolValue ¶
func (x *Domain_Attribute) GetBoolValue() bool
func (*Domain_Attribute) GetIntValue ¶
func (x *Domain_Attribute) GetIntValue() int64
func (*Domain_Attribute) GetKey ¶
func (x *Domain_Attribute) GetKey() string
func (*Domain_Attribute) GetTypedValue ¶
func (m *Domain_Attribute) GetTypedValue() isDomain_Attribute_TypedValue
func (*Domain_Attribute) ProtoMessage ¶
func (*Domain_Attribute) ProtoMessage()
func (*Domain_Attribute) ProtoReflect ¶
func (x *Domain_Attribute) ProtoReflect() protoreflect.Message
func (*Domain_Attribute) Reset ¶
func (x *Domain_Attribute) Reset()
func (*Domain_Attribute) String ¶
func (x *Domain_Attribute) String() string
type Domain_Attribute_BoolValue ¶
type Domain_Attribute_BoolValue struct {
BoolValue bool `protobuf:"varint,2,opt,name=bool_value,json=boolValue,proto3,oneof"`
}
type Domain_Attribute_IntValue ¶
type Domain_Attribute_IntValue struct {
IntValue int64 `protobuf:"varint,3,opt,name=int_value,json=intValue,proto3,oneof"`
}
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) Descriptor ¶
func (Domain_Type) Descriptor() protoreflect.EnumDescriptor
func (Domain_Type) Enum ¶
func (x Domain_Type) Enum() *Domain_Type
func (Domain_Type) EnumDescriptor
deprecated
func (Domain_Type) EnumDescriptor() ([]byte, []int)
Deprecated: Use Domain_Type.Descriptor instead.
func (Domain_Type) Number ¶
func (x Domain_Type) Number() protoreflect.EnumNumber
func (Domain_Type) String ¶
func (x Domain_Type) String() string
func (Domain_Type) Type ¶
func (Domain_Type) Type() protoreflect.EnumType
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"` ReverseMatch bool `protobuf:"varint,3,opt,name=reverse_match,json=reverseMatch,proto3" json:"reverse_match,omitempty"` // contains filtered or unexported fields }
func (*GeoIP) Descriptor
deprecated
func (*GeoIP) GetCountryCode ¶
func (*GeoIP) GetReverseMatch ¶
func (*GeoIP) ProtoMessage ¶
func (*GeoIP) ProtoMessage()
func (*GeoIP) ProtoReflect ¶
func (x *GeoIP) ProtoReflect() protoreflect.Message
type GeoIPList ¶
type GeoIPList struct { Entry []*GeoIP `protobuf:"bytes,1,rep,name=entry,proto3" json:"entry,omitempty"` // contains filtered or unexported fields }
func (*GeoIPList) Descriptor
deprecated
func (*GeoIPList) ProtoMessage ¶
func (*GeoIPList) ProtoMessage()
func (*GeoIPList) ProtoReflect ¶
func (x *GeoIPList) ProtoReflect() protoreflect.Message
type GeoIPMatcher ¶
type GeoIPMatcher struct {
// contains filtered or unexported fields
}
func (*GeoIPMatcher) Init ¶
func (m *GeoIPMatcher) Init(cidrs []*CIDR) error
func (*GeoIPMatcher) Match ¶
func (m *GeoIPMatcher) Match(ip net.IP) bool
Match returns true if the given ip is included by the GeoIP.
func (*GeoIPMatcher) SetReverseMatch ¶
func (m *GeoIPMatcher) SetReverseMatch(isReverseMatch bool)
type GeoIPMatcherContainer ¶
type GeoIPMatcherContainer struct {
// contains filtered or unexported fields
}
GeoIPMatcherContainer is a container for GeoIPMatchers. It keeps unique copies of GeoIPMatcher by country code.
func (*GeoIPMatcherContainer) Add ¶
func (c *GeoIPMatcherContainer) Add(geoip *GeoIP) (*GeoIPMatcher, error)
Add adds a new GeoIP set into the container. If the country code of GeoIP is not empty, GeoIPMatcherContainer will try to find an existing one, instead of adding a new one.
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"` // contains filtered or unexported fields }
func (*GeoSite) Descriptor
deprecated
func (*GeoSite) GetCountryCode ¶
func (*GeoSite) ProtoMessage ¶
func (*GeoSite) ProtoMessage()
func (*GeoSite) ProtoReflect ¶
func (x *GeoSite) ProtoReflect() protoreflect.Message
type GeoSiteList ¶
type GeoSiteList struct { Entry []*GeoSite `protobuf:"bytes,1,rep,name=entry,proto3" json:"entry,omitempty"` // contains filtered or unexported fields }
func (*GeoSiteList) Descriptor
deprecated
func (*GeoSiteList) Descriptor() ([]byte, []int)
Deprecated: Use GeoSiteList.ProtoReflect.Descriptor instead.
func (*GeoSiteList) GetEntry ¶
func (x *GeoSiteList) GetEntry() []*GeoSite
func (*GeoSiteList) ProtoMessage ¶
func (*GeoSiteList) ProtoMessage()
func (*GeoSiteList) ProtoReflect ¶
func (x *GeoSiteList) ProtoReflect() protoreflect.Message
func (*GeoSiteList) Reset ¶
func (x *GeoSiteList) Reset()
func (*GeoSiteList) String ¶
func (x *GeoSiteList) String() string
type InboundTagMatcher ¶
type InboundTagMatcher struct {
// contains filtered or unexported fields
}
func NewInboundTagMatcher ¶
func NewInboundTagMatcher(tags []string) *InboundTagMatcher
type LeastLoadStrategy ¶
type LeastLoadStrategy struct {
// contains filtered or unexported fields
}
LeastLoadStrategy represents a least load balancing strategy
func NewLeastLoadStrategy ¶
func NewLeastLoadStrategy(settings *StrategyLeastLoadConfig) *LeastLoadStrategy
NewLeastLoadStrategy creates a new LeastLoadStrategy with settings
func (*LeastLoadStrategy) GetPrincipleTarget ¶
func (l *LeastLoadStrategy) GetPrincipleTarget(strings []string) []string
func (*LeastLoadStrategy) InjectContext ¶
func (s *LeastLoadStrategy) InjectContext(ctx context.Context)
func (*LeastLoadStrategy) PickOutbound ¶
func (s *LeastLoadStrategy) PickOutbound(candidates []string) string
type LeastPingStrategy ¶
type LeastPingStrategy struct {
// contains filtered or unexported fields
}
func (*LeastPingStrategy) GetPrincipleTarget ¶
func (l *LeastPingStrategy) GetPrincipleTarget(strings []string) []string
func (*LeastPingStrategy) InjectContext ¶
func (l *LeastPingStrategy) InjectContext(ctx context.Context)
func (*LeastPingStrategy) PickOutbound ¶
func (l *LeastPingStrategy) PickOutbound(strings []string) string
type MultiGeoIPMatcher ¶
type MultiGeoIPMatcher struct {
// contains filtered or unexported fields
}
func NewMultiGeoIPMatcher ¶
func NewMultiGeoIPMatcher(geoips []*GeoIP, onSource bool) (*MultiGeoIPMatcher, error)
type NetworkMatcher ¶
type NetworkMatcher struct {
// contains filtered or unexported fields
}
func NewNetworkMatcher ¶
func NewNetworkMatcher(network []net.Network) NetworkMatcher
type PortMatcher ¶
type PortMatcher struct {
// contains filtered or unexported fields
}
func NewPortMatcher ¶
func NewPortMatcher(list *net.PortList, onSource bool) *PortMatcher
NewPortMatcher create a new port matcher that can match source or destination port
type ProtocolMatcher ¶
type ProtocolMatcher struct {
// contains filtered or unexported fields
}
func NewProtocolMatcher ¶
func NewProtocolMatcher(protocols []string) *ProtocolMatcher
type RandomStrategy ¶
type RandomStrategy struct { FallbackTag string // contains filtered or unexported fields }
RandomStrategy represents a random balancing strategy
func (*RandomStrategy) GetPrincipleTarget ¶
func (s *RandomStrategy) GetPrincipleTarget(strings []string) []string
func (*RandomStrategy) InjectContext ¶
func (s *RandomStrategy) InjectContext(ctx context.Context)
func (*RandomStrategy) PickOutbound ¶
func (s *RandomStrategy) PickOutbound(candidates []string) string
type RoundRobinStrategy ¶
type RoundRobinStrategy struct { FallbackTag string // contains filtered or unexported fields }
func (*RoundRobinStrategy) GetPrincipleTarget ¶
func (s *RoundRobinStrategy) GetPrincipleTarget(strings []string) []string
func (*RoundRobinStrategy) InjectContext ¶
func (s *RoundRobinStrategy) InjectContext(ctx context.Context)
func (*RoundRobinStrategy) PickOutbound ¶
func (s *RoundRobinStrategy) PickOutbound(tags []string) string
type Route ¶
Route is an implementation of routing.Route.
func (*Route) GetOutboundGroupTags ¶
GetOutboundGroupTags implements routing.Route.
func (*Route) GetOutboundTag ¶
GetOutboundTag implements routing.Route.
func (*Route) GetRuleTag ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is an implementation of routing.Router.
func (*Router) AddRule ¶
func (r *Router) AddRule(config *serial.TypedMessage, shouldAppend bool) error
AddRule implements routing.Router.
func (*Router) GetOverrideTarget ¶
GetOverrideTarget implements routing.BalancerOverrider
func (*Router) GetPrincipleTarget ¶
GetPrincipleTarget implements routing.BalancerPrincipleTarget
func (*Router) Init ¶
func (r *Router) Init(ctx context.Context, config *Config, d dns.Client, ohm outbound.Manager, dispatcher routing.Dispatcher) error
Init initializes the Router.
func (*Router) OverrideBalancer ¶
func (*Router) RemoveRule ¶
RemoveRule implements routing.Router.
func (*Router) RuleExists ¶
func (*Router) SetOverrideTarget ¶
SetOverrideTarget implements routing.BalancerOverrider
type RoutingRule ¶
type RoutingRule struct { // Types that are assignable to TargetTag: // // *RoutingRule_Tag // *RoutingRule_BalancingTag TargetTag isRoutingRule_TargetTag `protobuf_oneof:"target_tag"` RuleTag string `protobuf:"bytes,18,opt,name=rule_tag,json=ruleTag,proto3" json:"rule_tag,omitempty"` // List of domains for target domain matching. Domain []*Domain `protobuf:"bytes,2,rep,name=domain,proto3" json:"domain,omitempty"` // List of GeoIPs for target IP address matching. If this entry exists, the // cidr above will have no effect. GeoIP fields with the same country code are // supposed to contain exactly same content. They will be merged during // runtime. For customized GeoIPs, please leave country code empty. Geoip []*GeoIP `protobuf:"bytes,10,rep,name=geoip,proto3" json:"geoip,omitempty"` // List of ports. PortList *net.PortList `protobuf:"bytes,14,opt,name=port_list,json=portList,proto3" json:"port_list,omitempty"` // List of networks for matching. Networks []net.Network `protobuf:"varint,13,rep,packed,name=networks,proto3,enum=xray.common.net.Network" json:"networks,omitempty"` // List of GeoIPs for source IP address matching. If this entry exists, the // source_cidr above will have no effect. SourceGeoip []*GeoIP `protobuf:"bytes,11,rep,name=source_geoip,json=sourceGeoip,proto3" json:"source_geoip,omitempty"` // List of ports for source port matching. SourcePortList *net.PortList `protobuf:"bytes,16,opt,name=source_port_list,json=sourcePortList,proto3" json:"source_port_list,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"` Attributes map[string]string `` /* 162-byte string literal not displayed */ DomainMatcher string `protobuf:"bytes,17,opt,name=domain_matcher,json=domainMatcher,proto3" json:"domain_matcher,omitempty"` // contains filtered or unexported fields }
func (*RoutingRule) BuildCondition ¶
func (rr *RoutingRule) BuildCondition() (Condition, error)
func (*RoutingRule) Descriptor
deprecated
func (*RoutingRule) Descriptor() ([]byte, []int)
Deprecated: Use RoutingRule.ProtoReflect.Descriptor instead.
func (*RoutingRule) GetAttributes ¶
func (x *RoutingRule) GetAttributes() map[string]string
func (*RoutingRule) GetBalancingTag ¶
func (x *RoutingRule) GetBalancingTag() string
func (*RoutingRule) GetDomain ¶
func (x *RoutingRule) GetDomain() []*Domain
func (*RoutingRule) GetDomainMatcher ¶
func (x *RoutingRule) GetDomainMatcher() string
func (*RoutingRule) GetGeoip ¶
func (x *RoutingRule) GetGeoip() []*GeoIP
func (*RoutingRule) GetInboundTag ¶
func (x *RoutingRule) GetInboundTag() []string
func (*RoutingRule) GetNetworks ¶
func (x *RoutingRule) GetNetworks() []net.Network
func (*RoutingRule) GetPortList ¶
func (x *RoutingRule) GetPortList() *net.PortList
func (*RoutingRule) GetProtocol ¶
func (x *RoutingRule) GetProtocol() []string
func (*RoutingRule) GetRuleTag ¶
func (x *RoutingRule) GetRuleTag() string
func (*RoutingRule) GetSourceGeoip ¶
func (x *RoutingRule) GetSourceGeoip() []*GeoIP
func (*RoutingRule) GetSourcePortList ¶
func (x *RoutingRule) GetSourcePortList() *net.PortList
func (*RoutingRule) GetTag ¶
func (x *RoutingRule) GetTag() string
func (*RoutingRule) GetTargetTag ¶
func (m *RoutingRule) GetTargetTag() isRoutingRule_TargetTag
func (*RoutingRule) GetUserEmail ¶
func (x *RoutingRule) GetUserEmail() []string
func (*RoutingRule) ProtoMessage ¶
func (*RoutingRule) ProtoMessage()
func (*RoutingRule) ProtoReflect ¶
func (x *RoutingRule) ProtoReflect() protoreflect.Message
func (*RoutingRule) Reset ¶
func (x *RoutingRule) Reset()
func (*RoutingRule) String ¶
func (x *RoutingRule) String() string
type RoutingRule_BalancingTag ¶
type RoutingRule_BalancingTag struct { // Tag of routing balancer. BalancingTag string `protobuf:"bytes,12,opt,name=balancing_tag,json=balancingTag,proto3,oneof"` }
type RoutingRule_Tag ¶
type RoutingRule_Tag struct { // Tag of outbound that this rule is pointing to. Tag string `protobuf:"bytes,1,opt,name=tag,proto3,oneof"` }
type StrategyLeastLoadConfig ¶
type StrategyLeastLoadConfig struct { // weight settings Costs []*StrategyWeight `protobuf:"bytes,2,rep,name=costs,proto3" json:"costs,omitempty"` // RTT baselines for selecting, int64 values of time.Duration Baselines []int64 `protobuf:"varint,3,rep,packed,name=baselines,proto3" json:"baselines,omitempty"` // expected nodes count to select Expected int32 `protobuf:"varint,4,opt,name=expected,proto3" json:"expected,omitempty"` // max acceptable rtt, filter away high delay nodes. default 0 MaxRTT int64 `protobuf:"varint,5,opt,name=maxRTT,proto3" json:"maxRTT,omitempty"` // acceptable failure rate Tolerance float32 `protobuf:"fixed32,6,opt,name=tolerance,proto3" json:"tolerance,omitempty"` // contains filtered or unexported fields }
func (*StrategyLeastLoadConfig) Descriptor
deprecated
func (*StrategyLeastLoadConfig) Descriptor() ([]byte, []int)
Deprecated: Use StrategyLeastLoadConfig.ProtoReflect.Descriptor instead.
func (*StrategyLeastLoadConfig) GetBaselines ¶
func (x *StrategyLeastLoadConfig) GetBaselines() []int64
func (*StrategyLeastLoadConfig) GetCosts ¶
func (x *StrategyLeastLoadConfig) GetCosts() []*StrategyWeight
func (*StrategyLeastLoadConfig) GetExpected ¶
func (x *StrategyLeastLoadConfig) GetExpected() int32
func (*StrategyLeastLoadConfig) GetMaxRTT ¶
func (x *StrategyLeastLoadConfig) GetMaxRTT() int64
func (*StrategyLeastLoadConfig) GetTolerance ¶
func (x *StrategyLeastLoadConfig) GetTolerance() float32
func (*StrategyLeastLoadConfig) ProtoMessage ¶
func (*StrategyLeastLoadConfig) ProtoMessage()
func (*StrategyLeastLoadConfig) ProtoReflect ¶
func (x *StrategyLeastLoadConfig) ProtoReflect() protoreflect.Message
func (*StrategyLeastLoadConfig) Reset ¶
func (x *StrategyLeastLoadConfig) Reset()
func (*StrategyLeastLoadConfig) String ¶
func (x *StrategyLeastLoadConfig) String() string
type StrategyWeight ¶
type StrategyWeight struct { Regexp bool `protobuf:"varint,1,opt,name=regexp,proto3" json:"regexp,omitempty"` Match string `protobuf:"bytes,2,opt,name=match,proto3" json:"match,omitempty"` Value float32 `protobuf:"fixed32,3,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*StrategyWeight) Descriptor
deprecated
func (*StrategyWeight) Descriptor() ([]byte, []int)
Deprecated: Use StrategyWeight.ProtoReflect.Descriptor instead.
func (*StrategyWeight) GetMatch ¶
func (x *StrategyWeight) GetMatch() string
func (*StrategyWeight) GetRegexp ¶
func (x *StrategyWeight) GetRegexp() bool
func (*StrategyWeight) GetValue ¶
func (x *StrategyWeight) GetValue() float32
func (*StrategyWeight) ProtoMessage ¶
func (*StrategyWeight) ProtoMessage()
func (*StrategyWeight) ProtoReflect ¶
func (x *StrategyWeight) ProtoReflect() protoreflect.Message
func (*StrategyWeight) Reset ¶
func (x *StrategyWeight) Reset()
func (*StrategyWeight) String ¶
func (x *StrategyWeight) String() string
type UserMatcher ¶
type UserMatcher struct {
// contains filtered or unexported fields
}
func NewUserMatcher ¶
func NewUserMatcher(users []string) *UserMatcher
type WeightManager ¶
type WeightManager struct {
// contains filtered or unexported fields
}
WeightManager manages weights for specific settings
func NewWeightManager ¶
func NewWeightManager(s []*StrategyWeight, defaultWeight float64, scaler weightScaler) *WeightManager
NewWeightManager creates a new WeightManager with settings
func (*WeightManager) Apply ¶
func (s *WeightManager) Apply(tag string, value float64) float64
Apply applies weight to the value
func (*WeightManager) Get ¶
func (s *WeightManager) Get(tag string) float64
Get get the weight of specified tag