proxy

package
v0.0.0-...-db220da Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: ISC Imports: 54 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 (
	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
)
View Source
const (
	DefaultPrefetchDelay    time.Duration = 24 * time.Hour
	MinimumPrefetchInterval time.Duration = 10 * time.Minute
)
View Source
const (
	DefaultFallbackResolver = "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 (
	MaxHTTPBodyLength = 4000000
)
View Source
const (
	RTTEwmaDecay = 10.0
)
View Source
const (
	SizeEstimatorEwmaDecay = 100.0
)
View Source
const (
	SourceFormatV2 = iota
)

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 = 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) error

func EmptyResponseFromMessage

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

func ExtractHostAndPort

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

func HasTCFlag

func HasTCFlag(packet []byte) bool

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(address string, timeout int) error

func NormalizeQName

func NormalizeQName(str string) (string, error)

func NormalizeRawQName

func NormalizeRawQName(name *[]byte)

func ParseAllWeeklyRanges

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

func ParseIP

func ParseIP(ipStr string) net.IP

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(name 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 TransactionID

func TransactionID(packet []byte) uint16

func TrimAndStripInlineComments

func TrimAndStripInlineComments(str string) string

func TruncatedResponse

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

Types

type AnonymizedDNSConfig

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

type AnonymizedDNSRouteConfig

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

type BlockIPConfig

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

type BlockNameConfig

type BlockNameConfig 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 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, relayUDPAddr *net.UDPAddr, relayTCPAddr *net.TCPAddr, 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"`
	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"`
	Daemonize                bool
	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:"blacklist"`
	WhitelistName            WhitelistNameConfig         `toml:"whitelist"`
	BlockIP                  BlockIPConfig               `toml:"ip_blacklist"`
	ForwardFile              string                      `toml:"forwarding_rules"`
	CloakFile                string                      `toml:"cloaking_rules"`
	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"`
	SourceIPv4               bool                        `toml:"ipv4_servers"`
	SourceIPv6               bool                        `toml:"ipv6_servers"`
	MaxClients               uint32                      `toml:"max_clients"`
	FallbackResolver         string                      `toml:"fallback_resolver"`
	FallbackResolvers        []string                    `toml:"fallback_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"`
	TLSClientAuth            TLSClientAuthConfig         `toml:"tls_client_auth"`
}

type ConfigFlags

type ConfigFlags struct {
	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 DOHClientCreds

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

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 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 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 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 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 PluginWhitelistName

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

func (*PluginWhitelistName) Description

func (plugin *PluginWhitelistName) Description() string

func (*PluginWhitelistName) Drop

func (plugin *PluginWhitelistName) Drop() error

func (*PluginWhitelistName) Eval

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

func (*PluginWhitelistName) Init

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

func (*PluginWhitelistName) Name

func (plugin *PluginWhitelistName) Name() string

func (*PluginWhitelistName) Reload

func (plugin *PluginWhitelistName) 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, 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 {
	// 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()

func (*Proxy) SystemDListeners

func (proxy *Proxy) SystemDListeners() error

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 ServerBugs

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

type ServerInfo

type ServerInfo struct {
	Proto              stamps.StampProtoType
	MagicQuery         [8]byte
	ServerPk           [32]byte
	SharedKey          [32]byte
	CryptoConstruction CryptoConstruction
	Name               string
	Timeout            time.Duration
	URL                *url.URL
	HostName           string
	UDPAddr            *net.UDPAddr
	TCPAddr            *net.TCPAddr
	RelayUDPAddr       *net.UDPAddr
	RelayTCPAddr       *net.TCPAddr

	DOHClientCreds DOHClientCreds
	// 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) (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(prefix string) ([]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 TLSClientAuthConfig

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

type TLSClientAuthCredsConfig

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

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 WhitelistNameConfig

type WhitelistNameConfig 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, *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, *tls.ConnectionState, time.Duration, error)

func (*XTransport) Get

func (xTransport *XTransport) Get(url *url.URL, accept string, timeout time.Duration) ([]byte, *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, *tls.ConnectionState, time.Duration, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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