distribution

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCachedDnsItem added in v0.2.6

func AddCachedDnsItem(ip, domain string, rule constants.DnsRule)

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 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 CacheItem added in v0.2.6

type CacheItem struct {
	Domain string
	Rule   constants.DnsRule
}

func GetCachedDnsItem added in v0.2.6

func GetCachedDnsItem(ip string) (CacheItem, bool)

type Config

type Config struct {
	Dns             DnsDistribution
	Ip              IpDistribution
	TrueProxyServer string
	// contains filtered or unexported fields
}

func New

func New(
	boostDns string,
	remoteDns string,
	localDns string,
	rule configuration.RuleCfg,
	trueProxyServer string,
) (Config, error)

func (Config) GetDns

func (c Config) GetDns(domain string, isLocal bool) (resolver.Client, constants.DnsRule)

func (Config) GetRule

func (c Config) GetRule(ip string) constants.IpRule

type DnsDistribution

type DnsDistribution struct {
	Local           SubDnsDistribution
	Remote          SubDnsDistribution
	BoostNameserver string
	Cache           Cache
}

func NewDnsDistribution

func NewDnsDistribution(
	bootDns string,
	remoteDns string,
	localDns string,
	config configuration.DnsItem,
) (DnsDistribution, error)

type IpDistribution

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

func NewIpDistribution

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

type IpMatcher

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

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