Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(key, data []byte) ([]byte, error)
- func Encrypt(key, data []byte) ([]byte, error)
- func FlushCache() error
- func GetServers() ([]string, error)
- func RestoreServers(servers []string) error
- func SetServers(servers []string) error
- type Certificate
- type Client
- type CreateSA
- type DoHClient
- func (doh *DoHClient) AddCertificate(data []byte) (*Certificate, error)
- func (doh *DoHClient) AddPassthrough(u string) error
- func (doh *DoHClient) Certificate() ([]*Certificate, error)
- func (doh *DoHClient) CreateSA(sa *SA) error
- func (doh *DoHClient) Do(data []byte) ([]byte, error)
- func (doh *DoHClient) Passthrough(host string) bool
- func (doh *DoHClient) SA() (*SA, error)
- func (doh *DoHClient) Token() (string, error)
- type Envelope
- type Event
- type EventType
- type Labels
- type Pending
- type Proxy
- type ResolveResult
- type SA
- type UDPClient
Constants ¶
const ( NonceLen = 12 RetryCount = 10 )
DoH client constants.
Variables ¶
var ( // ErrorTimeout defines a timeout error. ErrorTimeout = errors.New("timeout") )
Functions ¶
func GetServers ¶
GetServers returns the list of system DNS servers.
func RestoreServers ¶
RestoreServers restores the system DNS servers.
Types ¶
type Certificate ¶
type Certificate struct { X509 *x509.Certificate LastSeen time.Time }
Certificate defines a certificate.
func (*Certificate) Encrypt ¶
func (cert *Certificate) Encrypt(data []byte) ([]byte, error)
Encrypt encrypts the data with the certificate.
func (*Certificate) ID ¶
func (cert *Certificate) ID() string
ID returns the certificate ID as string.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements DNS client.
type DoHClient ¶
type DoHClient struct { URL string OAuth2 *auth.OAuth2Client Proxy string Encrypt bool // contains filtered or unexported fields }
DoHClient implements a DoH client.
func NewDoHClient ¶
NewDoHClient creates a new DoH client.
func (*DoHClient) AddCertificate ¶
func (doh *DoHClient) AddCertificate(data []byte) (*Certificate, error)
AddCertificate adds certificates to the DoH client.
func (*DoHClient) AddPassthrough ¶
AddPassthrough adds a passthrough name for the client.
func (*DoHClient) Certificate ¶
func (doh *DoHClient) Certificate() ([]*Certificate, error)
Certificate returns certificates.
func (*DoHClient) Passthrough ¶
Passthrough tests if the host is passed through to the system DNS resolver instead of using the DoH server.
type Labels ¶
type Labels []string
Labels define DNS labels.
func ReadBlacklist ¶
ReadBlacklist reads the blacklist from the file.
type Pending ¶
type Pending struct {
// contains filtered or unexported fields
}
Pending defines a pending DNS query.
type Proxy ¶
type Proxy struct { Verbose int Blacklist []Labels Events chan Event DoH *DoHClient NoPad bool // contains filtered or unexported fields }
Proxy defines a DNS proxy.
type ResolveResult ¶
ResolveResult provides DNS resolve results.
type UDPClient ¶
UDPClient implements an UDP client.
func NewUDPClient ¶
NewUDPClient creates a new UDP client.