config

package
v0.0.0-...-97a175b Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BlockLists []string  `yaml:"blockLists"`
	Local      Local     `yaml:"local"`
	Metrics    Metrics   `yaml:"metrics"`
	Transport  Transport `yaml:"transport"`
	Upstream   Upstream  `yaml:"upstream"`
}

func Load

func Load() (*Config, error)

Load reads the configuration file and unmarshals it into the Config struct.

type DOHProtocol

type DOHProtocol struct {
	Protocol    `yaml:",inline"`
	TLSCertFile string `yaml:"tlsCertFile"`
	TLSKeyFile  string `yaml:"tlsKeyFile"`
	Endpoint    string `yaml:"endpoint"`
}

type DOTProtocol

type DOTProtocol struct {
	Protocol    `yaml:",inline"`
	TLSCertFile string `yaml:"tlsCertFile"`
	TLSKeyFile  string `yaml:"tlsKeyFile"`
	StrictSNI   bool   `yaml:"strictSNI"`
}

type Local

type Local struct {
	Standard []StandardRecord `yaml:"standard"`
}

Local groups DNS records by their type for easy management and parsing.

type Metrics

type Metrics struct {
	Enabled bool   `yaml:"enabled"`
	Route   string `yaml:"route"`
	Port    int    `yaml:"port"`
}

type Protocol

type Protocol struct {
	Enabled bool `yaml:"enabled"`
	Port    int  `yaml:"port"`
}

type StandardRecord

type StandardRecord struct {
	Domain string `yaml:"domain"`
	Type   string `yaml:"type"`
	Value  string `yaml:"value"`
	TTL    int    `yaml:"ttl"`
}

DNSRecord represents a DNS record with common fields.

func (StandardRecord) ToMsg

func (sr StandardRecord) ToMsg() (*dns.Msg, error)

type Strategy

type Strategy string
const (
	StrategyRandom     Strategy = "random"
	StrategyRoundRobin Strategy = "round_robin"
	StrategyLatency    Strategy = "latency"
	StrategySequential Strategy = "sequential"
)

type Transport

type Transport struct {
	UDP Protocol    `yaml:"udp"`
	TCP Protocol    `yaml:"tcp"`
	DOT DOTProtocol `yaml:"dot"`
	DOH DOHProtocol `yaml:"doh"`
}

type Upstream

type Upstream struct {
	Strategy Strategy         `yaml:"strategy"`
	Servers  []UpstreamServer `yaml:"servers"`
}

type UpstreamServer

type UpstreamServer struct {
	Name    string `yaml:"name"`
	IP      string `yaml:"ip"`
	Port    int    `yaml:"port"`
	Timeout int    `yaml:"timeout"`
}

Jump to

Keyboard shortcuts

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