v2geo

package
v0.0.0-...-0cae4bf Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 7 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: "RootDomain",
		3: "Full",
	}
	Domain_Type_value = map[string]int32{
		"Plain":      0,
		"Regex":      1,
		"RootDomain": 2,
		"Full":       3,
	}
)

Enum value maps for Domain_Type.

View Source
var File_v2geo_proto protoreflect.FileDescriptor

Functions

func LoadGeoIP

func LoadGeoIP(filename string) (map[string]*GeoIP, error)

LoadGeoIP loads a GeoIP data file and converts it to a map. The keys of the map (country codes) are all normalized to lowercase.

func LoadGeoSite

func LoadGeoSite(filename string) (map[string]*GeoSite, error)

LoadGeoSite loads a GeoSite data file and converts it to a map. The keys of the map (site keys) are all normalized to lowercase.

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 Domain

type Domain struct {

	// Domain matching type.
	Type Domain_Type `protobuf:"varint,1,opt,name=type,proto3,enum=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 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_RootDomain 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"`
	InverseMatch bool    `protobuf:"varint,3,opt,name=inverse_match,json=inverseMatch,proto3" json:"inverse_match,omitempty"`
	// resource_hash instruct simplified config converter to load domain from geo file.
	ResourceHash []byte `protobuf:"bytes,4,opt,name=resource_hash,json=resourceHash,proto3" json:"resource_hash,omitempty"`
	Code         string `protobuf:"bytes,5,opt,name=code,proto3" json:"code,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) GetCode

func (x *GeoIP) GetCode() string

func (*GeoIP) GetCountryCode

func (x *GeoIP) GetCountryCode() string

func (*GeoIP) GetInverseMatch

func (x *GeoIP) GetInverseMatch() bool

func (*GeoIP) GetResourceHash

func (x *GeoIP) GetResourceHash() []byte

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 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"`
	// resource_hash instruct simplified config converter to load domain from geo file.
	ResourceHash []byte `protobuf:"bytes,3,opt,name=resource_hash,json=resourceHash,proto3" json:"resource_hash,omitempty"`
	Code         string `protobuf:"bytes,4,opt,name=code,proto3" json:"code,omitempty"`
	// contains filtered or unexported fields
}

func (*GeoSite) Descriptor deprecated

func (*GeoSite) Descriptor() ([]byte, []int)

Deprecated: Use GeoSite.ProtoReflect.Descriptor instead.

func (*GeoSite) GetCode

func (x *GeoSite) GetCode() string

func (*GeoSite) GetCountryCode

func (x *GeoSite) GetCountryCode() string

func (*GeoSite) GetDomain

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

func (*GeoSite) GetResourceHash

func (x *GeoSite) GetResourceHash() []byte

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

Jump to

Keyboard shortcuts

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