doh

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSION    = "2.3.10"
	USER_AGENT = "DNS-over-HTTPS/" + VERSION + " (+https://github.com/m13253/dns-over-https)"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(conf *Config, s selector.Selector) (c *Client, err error)

NewClient creates a new DoH client instance. conf: The configuration for the DoH client. s: The selector to be used for choosing upstream servers.

func (*Client) Exchange

func (c *Client) Exchange(ctx context.Context, m *dns.Msg) (*dns.Msg, error)

Exchange performs a DNS-over-HTTPS query using the client's internal HTTP client and selector. It uses the 'httpClient' field of the Client struct.

func (*Client) Get

func (c *Client) Get() *selector.Upstream

Get returns an upstream from the client's internal selector. It uses the 'selector' field of the Client struct.

func (*Client) Start

func (c *Client) Start() error

type Config

type Config struct {
	Listen   []string              `toml:"listen"`   // Listen addresses for the DoH server (not directly used by client part)
	Upstream UpstreamSectionConfig `toml:"upstream"` // Upstream server configurations
	Other    OtherConfig           `toml:"other"`    // Other miscellaneous settings
}

Config represents the overall configuration structure for the DoH client/server. This struct is used by doh.NewClient to initialize the DoH client.

type DNSRequest

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

type OtherConfig

type OtherConfig struct {
	NoECS                 bool     `toml:"no_ecs"`                   // Disable EDNS0-Client-Subnet
	NoIPv6                bool     `toml:"no_ipv6"`                  // Disable IPv6 when querying upstream
	NoUserAgent           bool     `toml:"no_user_agent"`            // Disable submitting User-Agent header
	Verbose               bool     `toml:"verbose"`                  // Enable verbose logging
	InsecureTLSSkipVerify bool     `toml:"insecure_tls_skip_verify"` // Skip TLS certificate verification (DANGEROUS IN PRODUCTION)
	Timeout               int      `toml:"timeout"`                  // Global timeout for HTTP requests made by the client (in seconds)
	Bootstrap             []string `toml:"bootstrap"`                // List of bootstrap DNS servers
	Passthrough           []string `toml:"passthrough"`              // List of domains to passthrough
	NoCookies             bool     `toml:"no_cookies"`               // Disable HTTP cookies
	DebugHTTPHeaders      []string `toml:"debug_http_headers"`       // Headers to log for debugging HTTP requests
}

OtherConfig represents the 'other' section of the DoH configuration, for miscellaneous settings.

type UpstreamConfig

type UpstreamConfig struct {
	URL    string `toml:"url"`    // URL of the upstream DoH server
	Weight int32  `toml:"weight"` // Weight for weighted load balancing
}

UpstreamConfig represents a single upstream server configuration.

type UpstreamSectionConfig

type UpstreamSectionConfig struct {
	UpstreamSelector string           `toml:"upstream_selector"` // Type of upstream selector (e.g., "random", "weighted_round_robin")
	UpstreamIETF     []UpstreamConfig `toml:"upstream_ietf"`     // List of IETF-style DoH upstreams
	UpstreamGoogle   []UpstreamConfig `toml:"upstream_google"`   // List of Google-style DoH upstreams
}

UpstreamSectionConfig represents the 'upstream' section of the DoH configuration.

Jump to

Keyboard shortcuts

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