distribution

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsContainsDomain

func IsContainsDomain(domain string, s string) bool

func IsDomainMatchRule

func IsDomainMatchRule(pattern string, domain string) bool

func IsDomainsContain

func IsDomainsContain(items []string, value string) bool

func IsSliceContain

func IsSliceContain(items []string, value string) bool

func IsSubnetContainsIp

func IsSubnetContainsIp(s string, i string) bool

Types

type Cache

type Cache interface {
	Get(key interface{}) (interface{}, bool)
	Add(key interface{}, val interface{}) bool
}

type Distribution

type Distribution struct {
	Dns            DnsDistribution
	Ip             IpDistribution
	PrimaryDomains []string
	// contains filtered or unexported fields
}

func NewDistribution

func NewDistribution(
	rule dbTypes.RuleCfg,
	primaryDomains []string,
	directInterfaceName string,
	dnsTable Cache,
) (Distribution, error)

func (Distribution) GetDns

func (d Distribution) GetDns(domain string, isPrimary bool) resolver.Client

func (Distribution) GetRule

func (d Distribution) GetRule(ip string) (result constants.IpRule)

type DnsDistribution

type DnsDistribution struct {
	Primary   SubDnsDistribution
	Secondary SubDnsDistribution
	Cache     Cache
}

func NewDnsDistribution

func NewDnsDistribution(
	config dbTypes.DnsItem,
	directInterfaceName string,
) (DnsDistribution, error)

type IpDistribution

type IpDistribution struct {
	Subnet       IpMatcher
	GeoIps       IpMatcher
	GeoSites     IpMatcher
	Cache        Cache
	DefaultProxy bool
}

func NewIpDistribution

func NewIpDistribution(
	config dbTypes.IpItem,
) (IpDistribution, error)

type IpMatcher

type IpMatcher struct {
	Proxy  list.List
	Bypass list.List
}

func (*IpMatcher) LookUp

func (s *IpMatcher) LookUp(ip string) constants.IpRule

type MatcherList

type MatcherList interface {
	Has(s string) bool
}

type SubDnsDistribution

type SubDnsDistribution struct {
	Domains  MatcherList
	GeoSites MatcherList
	Address  string
	Client   resolver.Client
}

Jump to

Keyboard shortcuts

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