distribution

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: GPL-3.0 Imports: 13 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 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 Config

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

func New

func New(
	rule configuration.RuleCfg,
	trueProxyServer string,
	dnsTable Cache,
) (Config, error)

func (Config) GetDns

func (c Config) GetDns(domain string, isPrimary bool) resolver.Client

func (Config) GetRule

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

type DnsDistribution

type DnsDistribution struct {
	Local  SubDnsDistribution
	Remote SubDnsDistribution
	Cache  Cache
}

func NewDnsDistribution

func NewDnsDistribution(
	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