internal

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromURL

func FromURL(u *url.URL, forward proxy.Dialer) (proxy.Dialer, error)

Types

type SocksClient

type SocksClient struct {
	Client *dns.Client
}

func (*SocksClient) Dial

func (c *SocksClient) Dial(proxyUri *url.URL, address string) (conn *dns.Conn, err error)

Dial connects to the address on the named network.

func (*SocksClient) DialContext

func (c *SocksClient) DialContext(ctx context.Context, proxyUri *url.URL, address string) (conn *dns.Conn, err error)

DialContext connects to the address on the named network, with a context.Context.

func (*SocksClient) Exchange

func (c *SocksClient) Exchange(m *dns.Msg, proxyUri *url.URL, address string) (*dns.Msg, error)

Exchange performs a synchronous query. It sends the message m to the address contained in a and waits for a reply. Basic use pattern with a *dns.Client:

c := new(dns.Client)
in, rtt, err := c.Exchange(message, "127.0.0.1:53")

Exchange does not retry a failed query, nor will it fall back to TCP in case of truncation. It is up to the caller to create a message that allows for larger responses to be returned. Specifically this means adding an EDNS0 OPT RR that will advertise a larger buffer, see SetEdns0. Messages without an OPT RR will fallback to the historic limit of 512 bytes To specify a local address or a timeout, the caller has to set the `Client.Dialer` attribute appropriately

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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