dnscrypt

package
v0.0.0-...-b68fa22 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: ISC Imports: 61 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxTimeout             = 3600
	DefaultNetprobeAddress = "9.9.9.9:53"
)
View Source
const (
	NonceSize        = xsecretbox.NonceSize
	HalfNonceSize    = xsecretbox.NonceSize / 2
	TagSize          = xsecretbox.TagSize
	PublicKeySize    = 32
	QueryOverhead    = ClientMagicLen + PublicKeySize + HalfNonceSize + TagSize
	ResponseOverhead = len(ServerMagic) + NonceSize + TagSize
)
View Source
const (
	AppVersion            = "2.1.1"
	DefaultConfigFileName = "dnscrypt-proxy.toml"
)
View Source
const (
	PluginsActionNone     = 0
	PluginsActionContinue = 1
	PluginsActionDrop     = 2
	PluginsActionReject   = 3
	PluginsActionSynth    = 4
)
View Source
const (
	PluginsReturnCodePass = iota
	PluginsReturnCodeForward
	PluginsReturnCodeDrop
	PluginsReturnCodeReject
	PluginsReturnCodeSynth
	PluginsReturnCodeParseError
	PluginsReturnCodeNXDomain
	PluginsReturnCodeResponseError
	PluginsReturnCodeServFail
	PluginsReturnCodeNetworkError
	PluginsReturnCodeCloak
	PluginsReturnCodeServerTimeout
	PluginsReturnCodeNotReady
)
View Source
const (
	DefaultPrefetchDelay    time.Duration = 24 * time.Hour
	MinimumPrefetchInterval time.Duration = 10 * time.Minute
)
View Source
const (
	DefaultBootstrapResolver = "9.9.9.9:53"
	DefaultKeepAlive         = 5 * time.Second
	DefaultTimeout           = 30 * time.Second
	SystemResolverIPTTL      = 24 * time.Hour
	MinResolverIPTTL         = 12 * time.Hour
	ExpiredCachedIPGraceTTL  = 15 * time.Minute
)
View Source
const (
	ClientMagicLen = 8
)
View Source
const (
	InheritedDescriptorsBase = uintptr(50)
)
View Source
const (
	MaxHTTPBodyLength = 1000000
)
View Source
const (
	RTTEwmaDecay = 10.0
)
View Source
const (
	SizeEstimatorEwmaDecay = 100.0
)
View Source
const (
	SourceFormatV2 = iota
)
View Source
const StaleResponseTTL = 30 * time.Second

Variables

View Source
var (
	CertMagic               = [4]byte{0x44, 0x4e, 0x53, 0x43}
	ServerMagic             = [8]byte{0x72, 0x36, 0x66, 0x6e, 0x76, 0x57, 0x6a, 0x38}
	MinDNSPacketSize        = 12 + 5
	MaxDNSPacketSize        = 4096
	MaxDNSUDPPacketSize     = 4096
	MaxDNSUDPSafePacketSize = 1252
	InitialMinQuestionSize  = 512
)
View Source
var (
	FileDescriptors   = make([]*os.File, 0)
	FileDescriptorNum = uintptr(0)
)
View Source
var DefaultLBStrategy = LBStrategyP2{}

Functions

func ComputeSharedKey

func ComputeSharedKey(cryptoConstruction CryptoConstruction, secretKey *[32]byte, serverPk *[32]byte, providerName *string) (sharedKey [32]byte)

func ConfigLoad

func ConfigLoad(proxy *Proxy, flags *ConfigFlags) error

func DNSExchange

func DNSExchange(proxy *Proxy, proto string, query *dns.Msg, serverAddress string, relay *DNSCryptRelay, serverName *string, tryFragmentsSupport bool) (*dns.Msg, time.Duration, bool, error)

func EmptyResponseFromMessage

func EmptyResponseFromMessage(srcMsg *dns.Msg) *dns.Msg

func ExtractHostAndPort

func ExtractHostAndPort(str string, defaultPort int) (host string, port int)

func HandleCaptivePortalQuery

func HandleCaptivePortalQuery(msg *dns.Msg, question *dns.Question, ips *CaptivePortalEntryIPs) *dns.Msg

func HasTCFlag

func HasTCFlag(packet []byte) bool

func Logger

func Logger(logMaxSize int, logMaxAge int, logMaxBackups int, fileName string) io.Writer

func Max

func Max(a, b int) int

func MaxF

func MaxF(a, b float64) float64

func Min

func Min(a, b int) int

func MinF

func MinF(a, b float64) float64

func NetProbe

func NetProbe(proxy *Proxy, address string, timeout int) error

func NormalizeQName

func NormalizeQName(str string) (string, error)

func NormalizeRawQName

func NormalizeRawQName(name *[]byte)

func PackTXTRR

func PackTXTRR(s string) []byte

func ParseAllWeeklyRanges

func ParseAllWeeklyRanges(allWeeklyRangesStr map[string]WeeklyRangesStr) (*map[string]WeeklyRanges, error)

func ParseIP

func ParseIP(ipStr string) net.IP

func PidFileCreate

func PidFileCreate() error

func PidFileRemove

func PidFileRemove() error

func PrefetchSources

func PrefetchSources(xTransport *XTransport, sources []*Source) time.Duration

PrefetchSources downloads latest versions of given sources, ensuring they have a valid signature before caching

func PrefixWithSize

func PrefixWithSize(packet []byte) ([]byte, error)

func Rcode

func Rcode(packet []byte) uint8

func ReadPrefixed

func ReadPrefixed(conn *net.Conn) ([]byte, error)

func ReadTextFile

func ReadTextFile(filename string) (string, error)

func RefusedResponseFromMessage

func RefusedResponseFromMessage(srcMsg *dns.Msg, refusedCode bool, ipv4 net.IP, ipv6 net.IP, ttl uint32) *dns.Msg

func Resolve

func Resolve(server string, name string, singleResolver bool)

func Run

func Run(configFile string)

func ServiceManagerReadyNotify

func ServiceManagerReadyNotify() error

func ServiceManagerStartNotify

func ServiceManagerStartNotify() error

func SetTransactionID

func SetTransactionID(packet []byte, tid uint16)

func StringQuote

func StringQuote(str string) string

func StringReverse

func StringReverse(s string) string

func StringStripSpaces

func StringStripSpaces(str string) string

func StringTwoFields

func StringTwoFields(str string) (string, string, bool)

func TimezoneSetup

func TimezoneSetup() error

func TransactionID

func TransactionID(packet []byte) uint16

func TrimAndStripInlineComments

func TrimAndStripInlineComments(str string) string

func TruncatedResponse

func TruncatedResponse(packet []byte) ([]byte, error)

Types

type AllowIPConfig

type AllowIPConfig struct {
	File    string `toml:"allowed_ips_file"`
	LogFile string `toml:"log_file"`
	Format  string `toml:"log_format"`
}

type AllowedNameConfig

type AllowedNameConfig struct {
	File    string `toml:"allowed_names_file"`
	LogFile string `toml:"log_file"`
	Format  string `toml:"log_format"`
}

type AnonymizedDNSConfig

type AnonymizedDNSConfig struct {
	Routes             []AnonymizedDNSRouteConfig `toml:"routes"`
	SkipIncompatible   bool                       `toml:"skip_incompatible"`
	DirectCertFallback bool                       `toml:"direct_cert_fallback"`
}

type AnonymizedDNSRouteConfig

type AnonymizedDNSRouteConfig struct {
	ServerName string   `toml:"server_name"`
	RelayNames []string `toml:"via"`
}

type App

type App struct {
	// contains filtered or unexported fields
}

func (*App) AppMain

func (app *App) AppMain()

func (*App) Start

func (app *App) Start(service service.Service) error

func (*App) Stop

func (app *App) Stop(service service.Service) error

type BlockIPConfig

type BlockIPConfig struct {
	File    string `toml:"blocked_ips_file"`
	LogFile string `toml:"log_file"`
	Format  string `toml:"log_format"`
}

type BlockIPConfigLegacy

type BlockIPConfigLegacy struct {
	File    string `toml:"blacklist_file"`
	LogFile string `toml:"log_file"`
	Format  string `toml:"log_format"`
}

type BlockNameConfig

type BlockNameConfig struct {
	File    string `toml:"blocked_names_file"`
	LogFile string `toml:"log_file"`
	Format  string `toml:"log_format"`
}

type BlockNameConfigLegacy

type BlockNameConfigLegacy struct {
	File    string `toml:"blacklist_file"`
	LogFile string `toml:"log_file"`
	Format  string `toml:"log_format"`
}

type BlockedNames

type BlockedNames struct {
	// contains filtered or unexported fields
}

type BrokenImplementationsConfig

type BrokenImplementationsConfig struct {
	BrokenQueryPadding []string `toml:"broken_query_padding"`
	FragmentsBlocked   []string `toml:"fragments_blocked"`
}

type CachedIPItem

type CachedIPItem struct {
	// contains filtered or unexported fields
}

type CachedIPs

type CachedIPs struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type CachedResponse

type CachedResponse struct {
	// contains filtered or unexported fields
}

type CachedResponses

type CachedResponses struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type CaptivePortalEntryIPs

type CaptivePortalEntryIPs []net.IP

type CaptivePortalHandler

type CaptivePortalHandler struct {
	// contains filtered or unexported fields
}

func ColdStart

func ColdStart(proxy *Proxy) (*CaptivePortalHandler, error)

func (*CaptivePortalHandler) Stop

func (captivePortalHandler *CaptivePortalHandler) Stop()

type CaptivePortalMap

type CaptivePortalMap map[string]CaptivePortalEntryIPs

func (*CaptivePortalMap) GetEntry

func (ipsMap *CaptivePortalMap) GetEntry(msg *dns.Msg) (*dns.Question, *CaptivePortalEntryIPs)

type CaptivePortalsConfig

type CaptivePortalsConfig struct {
	MapFile string `toml:"map_file"`
}

type CertInfo

type CertInfo struct {
	ServerPk           [32]byte
	SharedKey          [32]byte
	MagicQuery         [ClientMagicLen]byte
	CryptoConstruction CryptoConstruction
	ForwardSecurity    bool
}

func FetchCurrentDNSCryptCert

func FetchCurrentDNSCryptCert(proxy *Proxy, serverName *string, proto string, pk ed25519.PublicKey, serverAddress string, providerName string, isNew bool, relay *DNSCryptRelay, knownBugs ServerBugs) (CertInfo, int, bool, error)

type CloakedName

type CloakedName struct {
	// contains filtered or unexported fields
}

type Config

type Config struct {
	LogLevel                 int            `toml:"log_level"`
	LogFile                  *string        `toml:"log_file"`
	LogFileLatest            bool           `toml:"log_file_latest"`
	UseSyslog                bool           `toml:"use_syslog"`
	ServerNames              []string       `toml:"server_names"`
	DisabledServerNames      []string       `toml:"disabled_server_names"`
	ListenAddresses          []string       `toml:"listen_addresses"`
	LocalDoH                 LocalDoHConfig `toml:"local_doh"`
	UserName                 string         `toml:"user_name"`
	ForceTCP                 bool           `toml:"force_tcp"`
	Timeout                  int            `toml:"timeout"`
	KeepAlive                int            `toml:"keepalive"`
	Proxy                    string         `toml:"proxy"`
	CertRefreshDelay         int            `toml:"cert_refresh_delay"`
	CertIgnoreTimestamp      bool           `toml:"cert_ignore_timestamp"`
	EphemeralKeys            bool           `toml:"dnscrypt_ephemeral_keys"`
	LBStrategy               string         `toml:"lb_strategy"`
	LBEstimator              bool           `toml:"lb_estimator"`
	BlockIPv6                bool           `toml:"block_ipv6"`
	BlockUnqualified         bool           `toml:"block_unqualified"`
	BlockUndelegated         bool           `toml:"block_undelegated"`
	Cache                    bool
	CacheSize                int                         `toml:"cache_size"`
	CacheNegTTL              uint32                      `toml:"cache_neg_ttl"`
	CacheNegMinTTL           uint32                      `toml:"cache_neg_min_ttl"`
	CacheNegMaxTTL           uint32                      `toml:"cache_neg_max_ttl"`
	CacheMinTTL              uint32                      `toml:"cache_min_ttl"`
	CacheMaxTTL              uint32                      `toml:"cache_max_ttl"`
	RejectTTL                uint32                      `toml:"reject_ttl"`
	CloakTTL                 uint32                      `toml:"cloak_ttl"`
	QueryLog                 QueryLogConfig              `toml:"query_log"`
	NxLog                    NxLogConfig                 `toml:"nx_log"`
	BlockName                BlockNameConfig             `toml:"blocked_names"`
	BlockNameLegacy          BlockNameConfigLegacy       `toml:"blacklist"`
	WhitelistNameLegacy      WhitelistNameConfigLegacy   `toml:"whitelist"`
	AllowedName              AllowedNameConfig           `toml:"allowed_names"`
	BlockIP                  BlockIPConfig               `toml:"blocked_ips"`
	BlockIPLegacy            BlockIPConfigLegacy         `toml:"ip_blacklist"`
	AllowIP                  AllowIPConfig               `toml:"allowed_ips"`
	ForwardFile              string                      `toml:"forwarding_rules"`
	CloakFile                string                      `toml:"cloaking_rules"`
	CaptivePortals           CaptivePortalsConfig        `toml:"captive_portals"`
	StaticsConfig            map[string]StaticConfig     `toml:"static"`
	SourcesConfig            map[string]SourceConfig     `toml:"sources"`
	BrokenImplementations    BrokenImplementationsConfig `toml:"broken_implementations"`
	SourceRequireDNSSEC      bool                        `toml:"require_dnssec"`
	SourceRequireNoLog       bool                        `toml:"require_nolog"`
	SourceRequireNoFilter    bool                        `toml:"require_nofilter"`
	SourceDNSCrypt           bool                        `toml:"dnscrypt_servers"`
	SourceDoH                bool                        `toml:"doh_servers"`
	SourceODoH               bool                        `toml:"odoh_servers"`
	SourceIPv4               bool                        `toml:"ipv4_servers"`
	SourceIPv6               bool                        `toml:"ipv6_servers"`
	MaxClients               uint32                      `toml:"max_clients"`
	BootstrapResolversLegacy []string                    `toml:"fallback_resolvers"`
	BootstrapResolvers       []string                    `toml:"bootstrap_resolvers"`
	IgnoreSystemDNS          bool                        `toml:"ignore_system_dns"`
	AllWeeklyRanges          map[string]WeeklyRangesStr  `toml:"schedules"`
	LogMaxSize               int                         `toml:"log_files_max_size"`
	LogMaxAge                int                         `toml:"log_files_max_age"`
	LogMaxBackups            int                         `toml:"log_files_max_backups"`
	TLSDisableSessionTickets bool                        `toml:"tls_disable_session_tickets"`
	TLSCipherSuite           []uint16                    `toml:"tls_cipher_suite"`
	NetprobeAddress          string                      `toml:"netprobe_address"`
	NetprobeTimeout          int                         `toml:"netprobe_timeout"`
	OfflineMode              bool                        `toml:"offline_mode"`
	HTTPProxyURL             string                      `toml:"http_proxy"`
	RefusedCodeInResponses   bool                        `toml:"refused_code_in_responses"`
	BlockedQueryResponse     string                      `toml:"blocked_query_response"`
	QueryMeta                []string                    `toml:"query_meta"`
	AnonymizedDNS            AnonymizedDNSConfig         `toml:"anonymized_dns"`
	DoHClientX509Auth        DoHClientX509AuthConfig     `toml:"doh_client_x509_auth"`
	DoHClientX509AuthLegacy  DoHClientX509AuthConfig     `toml:"tls_client_auth"`
	DNS64                    DNS64Config                 `toml:"dns64"`
	EDNSClientSubnet         []string                    `toml:"edns_client_subnet"`
}

type ConfigFlags

type ConfigFlags struct {
	Resolve                 *string
	List                    *bool
	ListAll                 *bool
	JSONOutput              *bool
	Check                   *bool
	ConfigFile              *string
	Child                   *bool
	NetprobeTimeoutOverride *int
	ShowCerts               *bool
}

type CryptoConstruction

type CryptoConstruction uint16
const (
	UndefinedConstruction CryptoConstruction = iota
	XSalsa20Poly1305
	XChacha20Poly1305
)

type DNS64Config

type DNS64Config struct {
	Prefixes  []string `toml:"prefix"`
	Resolvers []string `toml:"resolver"`
}

type DNSCryptRelay

type DNSCryptRelay struct {
	RelayUDPAddr *net.UDPAddr
	RelayTCPAddr *net.TCPAddr
}

type DNSExchangeResponse

type DNSExchangeResponse struct {
	// contains filtered or unexported fields
}

type DOHClientCreds

type DOHClientCreds struct {
	// contains filtered or unexported fields
}

type DoHClientX509AuthConfig

type DoHClientX509AuthConfig struct {
	Creds []TLSClientAuthCredsConfig `toml:"creds"`
}

type LBStrategy

type LBStrategy interface {
	// contains filtered or unexported methods
}

type LBStrategyFirst

type LBStrategyFirst struct{}

type LBStrategyP2

type LBStrategyP2 struct{}

type LBStrategyPH

type LBStrategyPH struct{}

type LBStrategyPN

type LBStrategyPN struct {
	// contains filtered or unexported fields
}

type LBStrategyRandom

type LBStrategyRandom struct{}

type LocalDoHConfig

type LocalDoHConfig struct {
	ListenAddresses []string `toml:"listen_addresses"`
	Path            string   `toml:"path"`
	CertFile        string   `toml:"cert_file"`
	CertKeyFile     string   `toml:"cert_key_file"`
}

type NxLogConfig

type NxLogConfig struct {
	File   string
	Format string
}

type ODoHQuery

type ODoHQuery struct {
	// contains filtered or unexported fields
}

type ODoHRelay

type ODoHRelay struct {
	URL *url.URL
}

type ODoHTargetConfig

type ODoHTargetConfig struct {
	// contains filtered or unexported fields
}

type PatternMatcher

type PatternMatcher struct {
	// contains filtered or unexported fields
}

func NewPatternMatcher

func NewPatternMatcher() *PatternMatcher

func (*PatternMatcher) Add

func (patternMatcher *PatternMatcher) Add(pattern string, val interface{}, position int) error

func (*PatternMatcher) Eval

func (patternMatcher *PatternMatcher) Eval(qName string) (reject bool, reason string, val interface{})

type PatternType

type PatternType int
const (
	PatternTypeNone PatternType = iota
	PatternTypePrefix
	PatternTypeSuffix
	PatternTypeSubstring
	PatternTypePattern
	PatternTypeExact
)

type Plugin

type Plugin interface {
	Name() string
	Description() string
	Init(proxy *Proxy) error
	Drop() error
	Reload() error
	Eval(pluginsState *PluginsState, msg *dns.Msg) error
}

type PluginAllowName

type PluginAllowName struct {
	// contains filtered or unexported fields
}

func (*PluginAllowName) Description

func (plugin *PluginAllowName) Description() string

func (*PluginAllowName) Drop

func (plugin *PluginAllowName) Drop() error

func (*PluginAllowName) Eval

func (plugin *PluginAllowName) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginAllowName) Init

func (plugin *PluginAllowName) Init(proxy *Proxy) error

func (*PluginAllowName) Name

func (plugin *PluginAllowName) Name() string

func (*PluginAllowName) Reload

func (plugin *PluginAllowName) Reload() error

type PluginAllowedIP

type PluginAllowedIP struct {
	// contains filtered or unexported fields
}

func (*PluginAllowedIP) Description

func (plugin *PluginAllowedIP) Description() string

func (*PluginAllowedIP) Drop

func (plugin *PluginAllowedIP) Drop() error

func (*PluginAllowedIP) Eval

func (plugin *PluginAllowedIP) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginAllowedIP) Init

func (plugin *PluginAllowedIP) Init(proxy *Proxy) error

func (*PluginAllowedIP) Name

func (plugin *PluginAllowedIP) Name() string

func (*PluginAllowedIP) Reload

func (plugin *PluginAllowedIP) Reload() error

type PluginBlockIP

type PluginBlockIP struct {
	// contains filtered or unexported fields
}

func (*PluginBlockIP) Description

func (plugin *PluginBlockIP) Description() string

func (*PluginBlockIP) Drop

func (plugin *PluginBlockIP) Drop() error

func (*PluginBlockIP) Eval

func (plugin *PluginBlockIP) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginBlockIP) Init

func (plugin *PluginBlockIP) Init(proxy *Proxy) error

func (*PluginBlockIP) Name

func (plugin *PluginBlockIP) Name() string

func (*PluginBlockIP) Reload

func (plugin *PluginBlockIP) Reload() error

type PluginBlockIPv6

type PluginBlockIPv6 struct{}

func (*PluginBlockIPv6) Description

func (plugin *PluginBlockIPv6) Description() string

func (*PluginBlockIPv6) Drop

func (plugin *PluginBlockIPv6) Drop() error

func (*PluginBlockIPv6) Eval

func (plugin *PluginBlockIPv6) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginBlockIPv6) Init

func (plugin *PluginBlockIPv6) Init(proxy *Proxy) error

func (*PluginBlockIPv6) Name

func (plugin *PluginBlockIPv6) Name() string

func (*PluginBlockIPv6) Reload

func (plugin *PluginBlockIPv6) Reload() error

type PluginBlockName

type PluginBlockName struct {
}

func (*PluginBlockName) Description

func (plugin *PluginBlockName) Description() string

func (*PluginBlockName) Drop

func (plugin *PluginBlockName) Drop() error

func (*PluginBlockName) Eval

func (plugin *PluginBlockName) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginBlockName) Init

func (plugin *PluginBlockName) Init(proxy *Proxy) error

func (*PluginBlockName) Name

func (plugin *PluginBlockName) Name() string

func (*PluginBlockName) Reload

func (plugin *PluginBlockName) Reload() error

type PluginBlockNameResponse

type PluginBlockNameResponse struct {
}

func (*PluginBlockNameResponse) Description

func (plugin *PluginBlockNameResponse) Description() string

func (*PluginBlockNameResponse) Drop

func (plugin *PluginBlockNameResponse) Drop() error

func (*PluginBlockNameResponse) Eval

func (plugin *PluginBlockNameResponse) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginBlockNameResponse) Init

func (plugin *PluginBlockNameResponse) Init(proxy *Proxy) error

func (*PluginBlockNameResponse) Name

func (plugin *PluginBlockNameResponse) Name() string

func (*PluginBlockNameResponse) Reload

func (plugin *PluginBlockNameResponse) Reload() error

type PluginBlockUndelegated

type PluginBlockUndelegated struct {
	// contains filtered or unexported fields
}

func (*PluginBlockUndelegated) Description

func (plugin *PluginBlockUndelegated) Description() string

func (*PluginBlockUndelegated) Drop

func (plugin *PluginBlockUndelegated) Drop() error

func (*PluginBlockUndelegated) Eval

func (plugin *PluginBlockUndelegated) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginBlockUndelegated) Init

func (plugin *PluginBlockUndelegated) Init(proxy *Proxy) error

func (*PluginBlockUndelegated) Name

func (plugin *PluginBlockUndelegated) Name() string

func (*PluginBlockUndelegated) Reload

func (plugin *PluginBlockUndelegated) Reload() error

type PluginBlockUnqualified

type PluginBlockUnqualified struct {
}

func (*PluginBlockUnqualified) Description

func (plugin *PluginBlockUnqualified) Description() string

func (*PluginBlockUnqualified) Drop

func (plugin *PluginBlockUnqualified) Drop() error

func (*PluginBlockUnqualified) Eval

func (plugin *PluginBlockUnqualified) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginBlockUnqualified) Init

func (plugin *PluginBlockUnqualified) Init(proxy *Proxy) error

func (*PluginBlockUnqualified) Name

func (plugin *PluginBlockUnqualified) Name() string

func (*PluginBlockUnqualified) Reload

func (plugin *PluginBlockUnqualified) Reload() error

type PluginCache

type PluginCache struct {
}

func (*PluginCache) Description

func (plugin *PluginCache) Description() string

func (*PluginCache) Drop

func (plugin *PluginCache) Drop() error

func (*PluginCache) Eval

func (plugin *PluginCache) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginCache) Init

func (plugin *PluginCache) Init(proxy *Proxy) error

func (*PluginCache) Name

func (plugin *PluginCache) Name() string

func (*PluginCache) Reload

func (plugin *PluginCache) Reload() error

type PluginCacheResponse

type PluginCacheResponse struct {
}

func (*PluginCacheResponse) Description

func (plugin *PluginCacheResponse) Description() string

func (*PluginCacheResponse) Drop

func (plugin *PluginCacheResponse) Drop() error

func (*PluginCacheResponse) Eval

func (plugin *PluginCacheResponse) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginCacheResponse) Init

func (plugin *PluginCacheResponse) Init(proxy *Proxy) error

func (*PluginCacheResponse) Name

func (plugin *PluginCacheResponse) Name() string

func (*PluginCacheResponse) Reload

func (plugin *PluginCacheResponse) Reload() error

type PluginCaptivePortal

type PluginCaptivePortal struct {
	// contains filtered or unexported fields
}

func (*PluginCaptivePortal) Description

func (plugin *PluginCaptivePortal) Description() string

func (*PluginCaptivePortal) Drop

func (plugin *PluginCaptivePortal) Drop() error

func (*PluginCaptivePortal) Eval

func (plugin *PluginCaptivePortal) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginCaptivePortal) Init

func (plugin *PluginCaptivePortal) Init(proxy *Proxy) error

func (*PluginCaptivePortal) Name

func (plugin *PluginCaptivePortal) Name() string

func (*PluginCaptivePortal) Reload

func (plugin *PluginCaptivePortal) Reload() error

type PluginCloak

type PluginCloak struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*PluginCloak) Description

func (plugin *PluginCloak) Description() string

func (*PluginCloak) Drop

func (plugin *PluginCloak) Drop() error

func (*PluginCloak) Eval

func (plugin *PluginCloak) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginCloak) Init

func (plugin *PluginCloak) Init(proxy *Proxy) error

func (*PluginCloak) Name

func (plugin *PluginCloak) Name() string

func (*PluginCloak) Reload

func (plugin *PluginCloak) Reload() error

type PluginDNS64

type PluginDNS64 struct {
	// contains filtered or unexported fields
}

func (*PluginDNS64) Description

func (plugin *PluginDNS64) Description() string

func (*PluginDNS64) Drop

func (plugin *PluginDNS64) Drop() error

func (*PluginDNS64) Eval

func (plugin *PluginDNS64) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginDNS64) Init

func (plugin *PluginDNS64) Init(proxy *Proxy) error

func (*PluginDNS64) Name

func (plugin *PluginDNS64) Name() string

func (*PluginDNS64) Reload

func (plugin *PluginDNS64) Reload() error

type PluginECS

type PluginECS struct {
	// contains filtered or unexported fields
}

func (*PluginECS) Description

func (plugin *PluginECS) Description() string

func (*PluginECS) Drop

func (plugin *PluginECS) Drop() error

func (*PluginECS) Eval

func (plugin *PluginECS) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginECS) Init

func (plugin *PluginECS) Init(proxy *Proxy) error

func (*PluginECS) Name

func (plugin *PluginECS) Name() string

func (*PluginECS) Reload

func (plugin *PluginECS) Reload() error

type PluginFirefox

type PluginFirefox struct {
}

func (*PluginFirefox) Description

func (plugin *PluginFirefox) Description() string

func (*PluginFirefox) Drop

func (plugin *PluginFirefox) Drop() error

func (*PluginFirefox) Eval

func (plugin *PluginFirefox) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginFirefox) Init

func (plugin *PluginFirefox) Init(proxy *Proxy) error

func (*PluginFirefox) Name

func (plugin *PluginFirefox) Name() string

func (*PluginFirefox) Reload

func (plugin *PluginFirefox) Reload() error

type PluginForward

type PluginForward struct {
	// contains filtered or unexported fields
}

func (*PluginForward) Description

func (plugin *PluginForward) Description() string

func (*PluginForward) Drop

func (plugin *PluginForward) Drop() error

func (*PluginForward) Eval

func (plugin *PluginForward) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginForward) Init

func (plugin *PluginForward) Init(proxy *Proxy) error

func (*PluginForward) Name

func (plugin *PluginForward) Name() string

func (*PluginForward) Reload

func (plugin *PluginForward) Reload() error

type PluginForwardEntry

type PluginForwardEntry struct {
	// contains filtered or unexported fields
}

type PluginGetSetPayloadSize

type PluginGetSetPayloadSize struct{}

func (*PluginGetSetPayloadSize) Description

func (plugin *PluginGetSetPayloadSize) Description() string

func (*PluginGetSetPayloadSize) Drop

func (plugin *PluginGetSetPayloadSize) Drop() error

func (*PluginGetSetPayloadSize) Eval

func (plugin *PluginGetSetPayloadSize) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginGetSetPayloadSize) Init

func (plugin *PluginGetSetPayloadSize) Init(proxy *Proxy) error

func (*PluginGetSetPayloadSize) Name

func (plugin *PluginGetSetPayloadSize) Name() string

func (*PluginGetSetPayloadSize) Reload

func (plugin *PluginGetSetPayloadSize) Reload() error

type PluginNxLog

type PluginNxLog struct {
	// contains filtered or unexported fields
}

func (*PluginNxLog) Description

func (plugin *PluginNxLog) Description() string

func (*PluginNxLog) Drop

func (plugin *PluginNxLog) Drop() error

func (*PluginNxLog) Eval

func (plugin *PluginNxLog) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginNxLog) Init

func (plugin *PluginNxLog) Init(proxy *Proxy) error

func (*PluginNxLog) Name

func (plugin *PluginNxLog) Name() string

func (*PluginNxLog) Reload

func (plugin *PluginNxLog) Reload() error

type PluginQueryLog

type PluginQueryLog struct {
	// contains filtered or unexported fields
}

func (*PluginQueryLog) Description

func (plugin *PluginQueryLog) Description() string

func (*PluginQueryLog) Drop

func (plugin *PluginQueryLog) Drop() error

func (*PluginQueryLog) Eval

func (plugin *PluginQueryLog) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginQueryLog) Init

func (plugin *PluginQueryLog) Init(proxy *Proxy) error

func (*PluginQueryLog) Name

func (plugin *PluginQueryLog) Name() string

func (*PluginQueryLog) Reload

func (plugin *PluginQueryLog) Reload() error

type PluginQueryMeta

type PluginQueryMeta struct {
	// contains filtered or unexported fields
}

func (*PluginQueryMeta) Description

func (plugin *PluginQueryMeta) Description() string

func (*PluginQueryMeta) Drop

func (plugin *PluginQueryMeta) Drop() error

func (*PluginQueryMeta) Eval

func (plugin *PluginQueryMeta) Eval(pluginsState *PluginsState, msg *dns.Msg) error

func (*PluginQueryMeta) Init

func (plugin *PluginQueryMeta) Init(proxy *Proxy) error

func (*PluginQueryMeta) Name

func (plugin *PluginQueryMeta) Name() string

func (*PluginQueryMeta) Reload

func (plugin *PluginQueryMeta) Reload() error

type PluginsAction

type PluginsAction int

type PluginsGlobals

type PluginsGlobals struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type PluginsReturnCode

type PluginsReturnCode int

type PluginsState

type PluginsState struct {
	// contains filtered or unexported fields
}

func NewPluginsState

func NewPluginsState(proxy *Proxy, clientProto string, clientAddr *net.Addr, serverProto string, start time.Time) PluginsState

func (*PluginsState) ApplyLoggingPlugins

func (pluginsState *PluginsState) ApplyLoggingPlugins(pluginsGlobals *PluginsGlobals) error

func (*PluginsState) ApplyQueryPlugins

func (pluginsState *PluginsState) ApplyQueryPlugins(pluginsGlobals *PluginsGlobals, packet []byte, needsEDNS0Padding bool) ([]byte, error)

func (*PluginsState) ApplyResponsePlugins

func (pluginsState *PluginsState) ApplyResponsePlugins(pluginsGlobals *PluginsGlobals, packet []byte, ttl *uint32) ([]byte, error)

type Proxy

type Proxy struct {
	ServerNames         []string
	DisabledServerNames []string
	SourceIPv4          bool
	SourceIPv6          bool
	SourceDNSCrypt      bool
	SourceDoH           bool
	SourceODoH          bool
	// contains filtered or unexported fields
}

func NewProxy

func NewProxy() *Proxy

func (*Proxy) Decrypt

func (proxy *Proxy) Decrypt(serverInfo *ServerInfo, sharedKey *[32]byte, encrypted []byte, nonce []byte) ([]byte, error)

func (*Proxy) Encrypt

func (proxy *Proxy) Encrypt(serverInfo *ServerInfo, packet []byte, proto string) (sharedKey *[32]byte, encrypted []byte, clientNonce []byte, err error)

func (*Proxy) InitPluginsGlobals

func (proxy *Proxy) InitPluginsGlobals() error

func (*Proxy) StartProxy

func (proxy *Proxy) StartProxy()

type QueryLogConfig

type QueryLogConfig struct {
	File          string
	Format        string
	IgnoredQtypes []string `toml:"ignored_qtypes"`
}

type QuestionSizeEstimator

type QuestionSizeEstimator struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewQuestionSizeEstimator

func NewQuestionSizeEstimator() QuestionSizeEstimator

func (*QuestionSizeEstimator) MinQuestionSize

func (questionSizeEstimator *QuestionSizeEstimator) MinQuestionSize() int

type RegisteredServer

type RegisteredServer struct {
	// contains filtered or unexported fields
}

type Relay

type Relay struct {
	Proto    stamps.StampProtoType
	Dnscrypt *DNSCryptRelay
	ODoH     *ODoHRelay
}

type ServerBugs

type ServerBugs struct {
	// contains filtered or unexported fields
}

type ServerInfo

type ServerInfo struct {
	DOHClientCreds DOHClientCreds

	Name     string
	HostName string
	UDPAddr  *net.UDPAddr
	TCPAddr  *net.TCPAddr
	Relay    *Relay
	URL      *url.URL

	Timeout            time.Duration
	CryptoConstruction CryptoConstruction
	ServerPk           [32]byte
	SharedKey          [32]byte
	MagicQuery         [8]byte

	Proto stamps.StampProtoType
	// contains filtered or unexported fields
}

type ServerSummary

type ServerSummary struct {
	Name        string   `json:"name"`
	Proto       string   `json:"proto"`
	IPv6        bool     `json:"ipv6"`
	Addrs       []string `json:"addrs,omitempty"`
	Ports       []int    `json:"ports"`
	DNSSEC      bool     `json:"dnssec"`
	NoLog       bool     `json:"nolog"`
	NoFilter    bool     `json:"nofilter"`
	Description string   `json:"description,omitempty"`
	Stamp       string   `json:"stamp"`
}

type ServersInfo

type ServersInfo struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewServersInfo

func NewServersInfo() ServersInfo

type Source

type Source struct {
	// contains filtered or unexported fields
}

func NewSource

func NewSource(name string, xTransport *XTransport, urls []string, minisignKeyStr string, cacheFile string, formatStr string, refreshDelay time.Duration, prefix string) (source *Source, err error)

NewSource loads a new source using the given cacheFile and urls, ensuring it has a valid signature

func (*Source) Parse

func (source *Source) Parse() ([]RegisteredServer, error)

type SourceConfig

type SourceConfig struct {
	URL            string
	URLs           []string
	MinisignKeyStr string `toml:"minisign_key"`
	CacheFile      string `toml:"cache_file"`
	FormatStr      string `toml:"format"`
	RefreshDelay   int    `toml:"refresh_delay"`
	Prefix         string
}

type SourceFormat

type SourceFormat int

type StaticConfig

type StaticConfig struct {
	Stamp string
}

type TLSClientAuthCredsConfig

type TLSClientAuthCredsConfig struct {
	ServerName string `toml:"server_name"`
	ClientCert string `toml:"client_cert"`
	ClientKey  string `toml:"client_key"`
	RootCA     string `toml:"root_ca"`
}

type TimeRange

type TimeRange struct {
	// contains filtered or unexported fields
}

type TimeRangeStr

type TimeRangeStr struct {
	After  string
	Before string
}

type WeeklyRanges

type WeeklyRanges struct {
	// contains filtered or unexported fields
}

func (*WeeklyRanges) Match

func (weeklyRanges *WeeklyRanges) Match() bool

type WeeklyRangesStr

type WeeklyRangesStr struct {
	Sun, Mon, Tue, Wed, Thu, Fri, Sat []TimeRangeStr
}

type WhitelistNameConfigLegacy

type WhitelistNameConfigLegacy struct {
	File    string `toml:"whitelist_file"`
	LogFile string `toml:"log_file"`
	Format  string `toml:"log_format"`
}

type XTransport

type XTransport struct {
	// contains filtered or unexported fields
}

func NewXTransport

func NewXTransport() *XTransport

func (*XTransport) DoHQuery

func (xTransport *XTransport) DoHQuery(useGet bool, url *url.URL, body []byte, timeout time.Duration) ([]byte, int, *tls.ConnectionState, time.Duration, error)

func (*XTransport) Fetch

func (xTransport *XTransport) Fetch(method string, url *url.URL, accept string, contentType string, body *[]byte, timeout time.Duration) ([]byte, int, *tls.ConnectionState, time.Duration, error)

func (*XTransport) Get

func (xTransport *XTransport) Get(url *url.URL, accept string, timeout time.Duration) ([]byte, int, *tls.ConnectionState, time.Duration, error)

func (*XTransport) ObliviousDoHQuery

func (xTransport *XTransport) ObliviousDoHQuery(useGet bool, url *url.URL, body []byte, timeout time.Duration) ([]byte, int, *tls.ConnectionState, time.Duration, error)

func (*XTransport) Post

func (xTransport *XTransport) Post(url *url.URL, accept string, contentType string, body *[]byte, timeout time.Duration) ([]byte, int, *tls.ConnectionState, time.Duration, error)

Jump to

Keyboard shortcuts

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