model

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StrategyFullest
	StrategyFastest
	StrategyAnyResult
)

Variables

This section is empty.

Functions

func GetDomainNameFronDnsMsg added in v1.3.0

func GetDomainNameFronDnsMsg(msg *dns.Msg) string

Types

type Config

type Config struct {
	ServeAddr    string           `json:"serve_addr,omitempty"`
	DohServer    *DohServerConfig `json:"doh_server,omitempty"`
	Strategy     int              `json:"strategy,omitempty"`
	Timeout      int              `json:"timeout,omitempty"`
	SocksProxy   string           `json:"socks_proxy,omitempty"`
	BuiltInCache bool             `json:"built_in_cache,omitempty"`
	Upstreams    []*Upstream      `json:"upstreams,omitempty"`
	Bootstrap    []*Upstream      `json:"bootstrap,omitempty"`
	Blacklist    []string         `json:"blacklist,omitempty"`

	Debug     bool `json:"debug,omitempty"`
	Profiling bool `json:"profiling,omitempty"`

	BlacklistSplited [][]string `json:"-"`
}

func (*Config) GetDialerContext added in v1.1.0

func (c *Config) GetDialerContext(d *net.Dialer) (proxy.Dialer, proxy.ContextDialer, error)

func (*Config) ReadInConfig

func (c *Config) ReadInConfig(path string, ipRanger cidranger.Ranger) error

func (*Config) StrategyName

func (c *Config) StrategyName() string

type DohServerConfig added in v1.2.6

type DohServerConfig struct {
	Host     string `json:"host,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

type Upstream

type Upstream struct {
	IsPrimary bool     `json:"is_primary,omitempty"`
	UseSocks  bool     `json:"use_socks,omitempty"`
	Address   string   `json:"address,omitempty"`
	Match     []string `json:"match,omitempty"`
	// contains filtered or unexported fields
}

func (*Upstream) Exchange

func (up *Upstream) Exchange(req *dns.Msg) (*dns.Msg, time.Duration, error)

func (*Upstream) Init added in v1.0.6

func (up *Upstream) Init(config *Config, ipRanger cidranger.Ranger)

func (*Upstream) InitConnectionPool

func (up *Upstream) InitConnectionPool(bootstrap func(host string) (net.IP, error))

func (*Upstream) IsMatch added in v1.4.1

func (up *Upstream) IsMatch(domain string) bool

func (*Upstream) IsValidMsg

func (up *Upstream) IsValidMsg(debug bool, r *dns.Msg) bool

func (*Upstream) Validate added in v1.0.6

func (up *Upstream) Validate() error

Jump to

Keyboard shortcuts

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