config

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenConfig

func GenConfig(p string) error

GenConfig generates a template config to path p.

Types

type BasicUpstreamConfig

type BasicUpstreamConfig struct {
	Addr     string `yaml:"addr"`
	Protocol string `yaml:"protocol"`
	Socks5   string `yaml:"socks5"`

	TCP struct {
		IdleTimeout uint `yaml:"idle_timeout"`
	} `yaml:"tcp"`

	DoT struct {
		ServerName  string `yaml:"server_name"`
		IdleTimeout uint   `yaml:"idle_timeout"`
	} `yaml:"dot"`

	DoH struct {
		URL string `yaml:"url"`
	} `yaml:"doh"`

	// for test and experts only, we add `omitempty`
	InsecureSkipVerify bool `yaml:"insecure_skip_verify,omitempty"`

	Deduplicate bool `yaml:"deduplicate"`

	EDNS0 struct {
		ClientSubnet struct {
			Ipv4 string `yaml:"ipv4"`
			Ipv6 string `yaml:"ipv6"`
		} `yaml:"client_subnet"`
		OverwriteECS bool `yaml:"overwrite_ecs"`
	} `yaml:"edns0"`
}

BasicUpstreamConfig is a basic config for a dns upstream.

type Config

type Config struct {
	Dispatcher struct {
		Bind       []string `yaml:"bind"`
		MaxUDPSize int      `yaml:"max_udp_size"`
	} `yaml:"dispatcher"`

	Upstream map[string]*UpstreamEntryConfig `yaml:"upstream"`
	Server   map[string]*BasicUpstreamConfig `yaml:"server"`

	IPSet struct {
		CheckCNAME bool         `yaml:"check_cname"`
		Mask4      uint8        `yaml:"mask4"`
		Mask6      uint8        `yaml:"mask6"`
		Rule       []*IPSetRule `yaml:"rule"`
	} `yaml:"ipset"`

	CA struct {
		Path []string `yaml:"path"`
	} `yaml:"ca"`
}

Config is config

func LoadConfig

func LoadConfig(p string) (*Config, error)

LoadConfig loads a yaml config from path p.

type IPSetRule added in v1.5.6

type IPSetRule struct {
	SetName4 string `yaml:"set_name4"`
	SetName6 string `yaml:"set_name6"`
	Domain   string `yaml:"domain"`
}

type UpstreamEntryConfig

type UpstreamEntryConfig struct {
	ServerTag string `yaml:"server"`
	Policies  struct {
		Query struct {
			UnhandlableTypes string `yaml:"unhandlable_types"`
			Domain           string `yaml:"domain"`
		} `yaml:"query"`
		Reply struct {
			ErrorRcode string `yaml:"error_rcode"`
			CNAME      string `yaml:"cname"`
			WithoutIP  string `yaml:"without_ip"`
			IP         string `yaml:"ip"`
		} `yaml:"reply"`
	} `yaml:"policies"`
}

UpstreamEntryConfig is a dns upstream.

Jump to

Keyboard shortcuts

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