router

package
v1.16.4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
var File_component_geodata_router_config_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

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) Descriptor() ([]byte, []int)

Deprecated: Use CIDR.ProtoReflect.Descriptor instead.

func (*CIDR) GetIp

func (x *CIDR) GetIp() []byte

func (*CIDR) GetPrefix

func (x *CIDR) GetPrefix() uint32

func (*CIDR) ProtoMessage

func (*CIDR) ProtoMessage()

func (*CIDR) ProtoReflect

func (x *CIDR) ProtoReflect() protoreflect.Message

func (*CIDR) Reset

func (x *CIDR) Reset()

func (*CIDR) String

func (x *CIDR) String() string

type CIDRList

type CIDRList []*CIDR

CIDRList is an alias of []*CIDR to provide sort.Interface.

func (*CIDRList) Len

func (l *CIDRList) Len() int

Len implements sort.Interface.

func (*CIDRList) Less

func (l *CIDRList) Less(i int, j int) bool

Less implements sort.Interface.

func (*CIDRList) Swap

func (l *CIDRList) Swap(i int, j int)

Swap implements sort.Interface.

type Domain

type Domain struct {

	// Domain matching type.
	Type Domain_Type `protobuf:"varint,1,opt,name=type,proto3,enum=clash.component.geodata.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) Descriptor() ([]byte, []int)

Deprecated: Use Domain.ProtoReflect.Descriptor instead.

func (*Domain) GetAttribute

func (x *Domain) GetAttribute() []*Domain_Attribute

func (*Domain) GetType

func (x *Domain) GetType() Domain_Type

func (*Domain) GetValue

func (x *Domain) GetValue() string

func (*Domain) ProtoMessage

func (*Domain) ProtoMessage()

func (*Domain) ProtoReflect

func (x *Domain) ProtoReflect() protoreflect.Message

func (*Domain) Reset

func (x *Domain) Reset()

func (*Domain) String

func (x *Domain) String() string

type DomainMatcher

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

func NewDomainMatcher

func NewDomainMatcher(domains []*Domain, not bool) (*DomainMatcher, error)

NewDomainMatcher new domain matcher.

func NewMphMatcherGroup

func NewMphMatcherGroup(domains []*Domain, not bool) (*DomainMatcher, error)

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) 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

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) Descriptor() ([]byte, []int)

Deprecated: Use GeoIP.ProtoReflect.Descriptor instead.

func (*GeoIP) GetCidr

func (x *GeoIP) GetCidr() []*CIDR

func (*GeoIP) GetCountryCode

func (x *GeoIP) GetCountryCode() string

func (*GeoIP) GetReverseMatch

func (x *GeoIP) GetReverseMatch() bool

func (*GeoIP) ProtoMessage

func (*GeoIP) ProtoMessage()

func (*GeoIP) ProtoReflect

func (x *GeoIP) ProtoReflect() protoreflect.Message

func (*GeoIP) Reset

func (x *GeoIP) Reset()

func (*GeoIP) String

func (x *GeoIP) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use GeoIPList.ProtoReflect.Descriptor instead.

func (*GeoIPList) GetEntry

func (x *GeoIPList) GetEntry() []*GeoIP

func (*GeoIPList) ProtoMessage

func (*GeoIPList) ProtoMessage()

func (*GeoIPList) ProtoReflect

func (x *GeoIPList) ProtoReflect() protoreflect.Message

func (*GeoIPList) Reset

func (x *GeoIPList) Reset()

func (*GeoIPList) String

func (x *GeoIPList) String() string

type GeoIPMatcher

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

func NewGeoIPMatcher

func NewGeoIPMatcher(geoip *GeoIP) (*GeoIPMatcher, error)

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) Descriptor() ([]byte, []int)

Deprecated: Use GeoSite.ProtoReflect.Descriptor instead.

func (*GeoSite) GetCountryCode

func (x *GeoSite) GetCountryCode() string

func (*GeoSite) GetDomain

func (x *GeoSite) GetDomain() []*Domain

func (*GeoSite) ProtoMessage

func (*GeoSite) ProtoMessage()

func (*GeoSite) ProtoReflect

func (x *GeoSite) ProtoReflect() protoreflect.Message

func (*GeoSite) Reset

func (x *GeoSite) Reset()

func (*GeoSite) String

func (x *GeoSite) String() string

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 MultiGeoIPMatcher

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

func NewMultiGeoIPMatcher

func NewMultiGeoIPMatcher(geoips []*GeoIP) (*MultiGeoIPMatcher, error)

func (*MultiGeoIPMatcher) ApplyIp

func (m *MultiGeoIPMatcher) ApplyIp(ip net.IP) bool

Jump to

Keyboard shortcuts

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