distribution

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCachedDnsItem

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

type CacheItem struct {
	Domain string
	Rule   constants.DnsRule
}

func GetCachedDnsItem

func GetCachedDnsItem(ip string) (CacheItem, bool)

type Config

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

func New

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

func (Config) GetDns

func (c Config) GetDns(domain string) (resolver.Resolver, constants.DnsRule)

func (Config) GetDnsRule

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

func (Config) GetDnsServerRule

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

func (Config) GetGeoRule

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

func (Config) GetRule

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

func (Config) GetSubnetRule

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

type DnsDistribution

type DnsDistribution struct {
	Local  SubDnsDistribution
	Remote SubDnsDistribution
	Boost  SubDnsDistribution
}

func NewDnsDistribution

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

type IpDistribution

type IpDistribution struct {
	Subnet       IpMatcher
	GeoIps       IpMatcher
	GeoSites     IpMatcher
	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   cResolver.Resolver
}

Jump to

Keyboard shortcuts

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