Documentation ¶
Index ¶
- Constants
- Variables
- func AddQuicPrefix(b []byte) (m []byte)
- func GetPathParamFromDoHPath(uri string) (path string, param string, err *custom_errors.DoEError)
- type CertificateQuery
- type CertificateQueryHandler
- type CertificateResponse
- type Conn
- type ConventionalDNSQuery
- type ConventionalDNSQueryHandler
- type ConventionalDNSQueryHandlerI
- type ConventionalDNSResponse
- type DNSQuery
- type DNSResponse
- type DefaultQueryHandlerDNS
- type DefaultQuicDialHandler
- type DialHandler
- type DoEQuery
- type DoEResponse
- type DoHQuery
- type DoHQueryHandler
- type DoHResponse
- type DoQQuery
- type DoQQueryHandler
- type DoQResponse
- type DoTQuery
- type DoTQueryHandler
- type DoTResponse
- type HttpHandler
- type PTRQuery
- type QueryHandler
- type QueryHandlerDNS
- type QueryResponse
- type QuicConn
- type QuicDialHandler
Constants ¶
View Source
const DEFAULT_BACKOFF_TIME time.Duration = 2500 * time.Millisecond
View Source
const DEFAULT_DNS_PORT = 53
View Source
const DEFAULT_DOH_PARAM = "dns"
View Source
const DEFAULT_DOH_PATH = "/dns-query{?dns}"
View Source
const DEFAULT_DOH_PORT = 443
View Source
const DEFAULT_DOH_TIMEOUT = 5000 * time.Millisecond
View Source
const DEFAULT_DOQ_PORT = 853
see https://www.rfc-editor.org/rfc/rfc9250.html#section-4.1.1
View Source
const DEFAULT_DOQ_TIMEOUT time.Duration = 5000 * time.Millisecond
View Source
const DEFAULT_DOT_PORT = 853
View Source
const DEFAULT_DOT_TIMEOUT time.Duration = 5000 * time.Millisecond
View Source
const DEFAULT_RECURSIVE_RESOLVER = "8.8.8.8"
View Source
const DEFAULT_TCP_RETRIES = 1
View Source
const DEFAULT_TCP_TIMEOUT time.Duration = 2500 * time.Millisecond
View Source
const DEFAULT_TLS_PORT = 443
View Source
const DEFAULT_TLS_TIMEOUT time.Duration = 2500 * time.Millisecond
View Source
const DEFAULT_UDP_RETRIES = 3
View Source
const DEFAULT_UDP_TIMEOUT time.Duration = 2500 * time.Millisecond
View Source
const DNS_DOT_PROTOCOL = "tcp-tls"
View Source
const DNS_TCP = "tcp"
View Source
const DNS_UDP = "udp"
View Source
const DOH_MEDIA_TYPE = "application/dns-message"
View Source
const HTTP_GET = "GET"
View Source
const HTTP_POST = "POST"
View Source
const HTTP_VERSION_1 = "HTTP/1.1"
View Source
const HTTP_VERSION_2 = "HTTP2"
View Source
const HTTP_VERSION_3 = "HTTP3"
View Source
const MAX_URI_LENGTH = 2048
View Source
const TLS_PROTOCOL_TCP = "tcp"
View Source
const TLS_PROTOCOL_UDP = "udp"
Variables ¶
View Source
var DOQ_TLS_PROTOCOLS = []string{"doq", "dq"}
nolint: gochecknoglobals
Functions ¶
func AddQuicPrefix ¶
AddQuicPrefix adds a 2-byte prefix with the DNS message length. see https://datatracker.ietf.org/doc/html/rfc9250#section-4.2-4
func GetPathParamFromDoHPath ¶
func GetPathParamFromDoHPath(uri string) (path string, param string, err *custom_errors.DoEError)
Types ¶
type CertificateQuery ¶
type CertificateQuery struct { // Host is the host for the dialer (required) Host string `json:"host"` // Port is the port for the dialer (default: 443) Port int `json:"port"` // Protocol is the protocol for the dialer (default: "tcp") Protocol string `json:"protocol"` // Timeout is the timeout in ms (default: 2500) Timeout time.Duration `json:"timeout"` // SNI SNI string `json:"sni"` // ALPN protocol ALPN []string `json:"alpn"` }
func NewCertificateQuery ¶
func NewCertificateQuery() (q *CertificateQuery)
func (*CertificateQuery) Check ¶
func (cq *CertificateQuery) Check() (err custom_errors.DoEErrors)
type CertificateQueryHandler ¶
type CertificateQueryHandler struct {
QueryHandler DialHandler
}
func NewCertificateQueryHandler ¶
func NewCertificateQueryHandler() (qh *CertificateQueryHandler)
func (*CertificateQueryHandler) Query ¶
func (qh *CertificateQueryHandler) Query(q *CertificateQuery) (*CertificateResponse, custom_errors.DoEErrors)
type CertificateResponse ¶
type CertificateResponse struct { // Certificate is the certificate Certificates []*x509.Certificate `json:"certificates"` RetryWithoutCertificateVerification bool `json:"retry_without_certificate_verification"` }
type Conn ¶
type Conn interface { Close() error ConnectionState() tls.ConnectionState }
type ConventionalDNSQuery ¶
type ConventionalDNSQuery struct { DNSQuery // protocol to use (default: udp) Protocol string `json:"protocol"` // maximum number of UDP retries (default: 3) MaxUDPRetries int `json:"max_udp_retries"` // fallback to TCP if UDP fails (default: true) AutoFallbackTCP bool `json:"auto_fallback_tcp"` // maximum number of TCP retries (default: 1) MaxTCPRetries int `json:"max_tcp_retries"` // timeout in ms for UDP (default: 2500) // // if Timeout is set, it will overwrite this value TimeoutUDP time.Duration `json:"timeout_udp"` // timeout in ms for TCP (default: 2500) // // if Timeout is set, it will overwrite this value TimeoutTCP time.Duration `json:"timeout_tcp"` // maximum backoff time in ms (default: 2500) MaxBackoffTime time.Duration `json:"max_backoff_time"` }
func NewConventionalQuery ¶
func NewConventionalQuery() *ConventionalDNSQuery
func NewDDRQuery ¶
func NewDDRQuery() *ConventionalDNSQuery
type ConventionalDNSQueryHandler ¶
type ConventionalDNSQueryHandler struct { ConventionalDNSQueryHandlerI Sleeper sleeper QueryHandler QueryHandlerDNS }
func NewConventionalDNSQueryHandler ¶
func NewConventionalDNSQueryHandler() *ConventionalDNSQueryHandler
func NewDDRQueryHandler ¶
func NewDDRQueryHandler() *ConventionalDNSQueryHandler
func NewPTRQueryHandler ¶
func NewPTRQueryHandler() (qh *ConventionalDNSQueryHandler)
func (*ConventionalDNSQueryHandler) Query ¶
func (dq *ConventionalDNSQueryHandler) Query(query *ConventionalDNSQuery) (res *ConventionalDNSResponse, err custom_errors.DoEErrors)
type ConventionalDNSQueryHandlerI ¶
type ConventionalDNSQueryHandlerI interface {
Query(query *ConventionalDNSQuery) (res *ConventionalDNSResponse, err custom_errors.DoEErrors)
}
type ConventionalDNSResponse ¶
type ConventionalDNSResponse struct { Response *DNSResponse `json:"response"` UDPAttempts int `json:"udp_attempts"` TCPAttempts int `json:"tcp_attempts"` AttemptErrors []string `json:"attempt_errors"` }
type DNSQuery ¶
type DNSQuery struct { // Host is the nameserver to query Host string `json:"host"` // QueryMsg is the DNS message to send QueryMsg *dns.Msg `json:"query_msg"` // Port is the port number (default: 443) Port int `json:"port"` // Timeout is the timeout in ms (default: 5000) Timeout time.Duration `json:"timeout"` }
type DNSResponse ¶
type DefaultQueryHandlerDNS ¶
type DefaultQueryHandlerDNS struct{}
func NewDefaultQueryHandler ¶
func NewDefaultQueryHandler() *DefaultQueryHandlerDNS
type DefaultQuicDialHandler ¶
type DefaultQuicDialHandler struct{}
type DialHandler ¶
type DoEResponse ¶
type DoEResponse struct { DNSResponse CertificateVerified bool `json:"certificate_verified"` CertificateValid bool `json:"certificate_valid"` }
type DoHQuery ¶
type DoHQuery struct { DoEQuery // the URI path for the DoH query, usually /dns-query{?dns} URI string `json:"uri"` // the full URI including the query param FullEndpointURI string `json:"full_endpoint_uri"` // HTTP method, either GET or POST Method string `json:"method"` // fallback to POST request if GET request is too long for URI (default: true) POSTFallback bool `json:"post_fallback"` // HTTP1, HTTP2 or HTTP3 support (default:HTTP2) HTTPVersion string `json:"http_version"` }
func NewDoHQuery ¶
func NewDoHQuery() (q *DoHQuery)
type DoHQueryHandler ¶
type DoHQueryHandler struct { // QueryHandler is an interface to execute HTTP requests QueryHandler HttpHandler }
func NewDoHQueryHandler ¶
func NewDoHQueryHandler() (qh *DoHQueryHandler)
func (*DoHQueryHandler) Query ¶
func (qh *DoHQueryHandler) Query(query *DoHQuery) (*DoHResponse, custom_errors.DoEErrors)
type DoHResponse ¶
type DoHResponse struct {
DoEResponse
}
type DoQQuery ¶
type DoQQuery struct {
DoEQuery
}
func NewDoQQuery ¶
func NewDoQQuery() (q *DoQQuery)
type DoQQueryHandler ¶
type DoQQueryHandler struct { // QueryHandler is the QUIC dial handler (defaults to quic.DialAddr) QueryHandler QuicDialHandler }
func NewDoQQueryHandler ¶
func NewDoQQueryHandler() (qh *DoQQueryHandler)
func (*DoQQueryHandler) Query ¶
func (qh *DoQQueryHandler) Query(query *DoQQuery) (*DoQResponse, custom_errors.DoEErrors)
This DoQ implementation is inspired by the q library, see https://github.com/natesales/q/blob/main/transport/quic.go
type DoQResponse ¶
type DoQResponse struct {
DoEResponse
}
type DoTQuery ¶
type DoTQuery struct {
DoEQuery
}
func NewDoTQuery ¶
func NewDoTQuery() (q *DoTQuery)
type DoTQueryHandler ¶
type DoTQueryHandler struct {
QueryHandler QueryHandlerDNS
}
func NewDoTQueryHandler ¶
func NewDoTQueryHandler() (h *DoTQueryHandler)
func (*DoTQueryHandler) Query ¶
func (qh *DoTQueryHandler) Query(query *DoTQuery) (*DoTResponse, custom_errors.DoEErrors)
type DoTResponse ¶
type DoTResponse struct {
DoEResponse
}
type HttpHandler ¶
type PTRQuery ¶
type PTRQuery struct {
ConventionalDNSQuery
}
func NewPTRQuery ¶
func NewPTRQuery() *PTRQuery
func (*PTRQuery) SetQueryMsg ¶
func (p *PTRQuery) SetQueryMsg(resolveIp string) custom_errors.DoEErrors
type QueryHandler ¶
type QueryHandler interface {
Query(query *DNSQuery) (res *QueryResponse, err error)
}
type QueryHandlerDNS ¶
type QueryResponse ¶
type QueryResponse struct {
DNSResponse
}
Click to show internal directories.
Click to hide internal directories.