Documentation ¶
Overview ¶
Package client provides a DNS client to send and receive DNS messages
Index ¶
- Variables
- type Client
- func (c *Client) Configure(opts ...OptionFunc) error
- func (c *Client) Dial(network string, addr netip.AddrPort) (net.Conn, error)
- func (c *Client) GetID() uint16
- func (c *Client) Query(name string, class, t uint16, addr netip.Addr) (*dns.Message, error)
- func (c *Client) QueryTCP(query *dns.Message, addrPort netip.AddrPort) (*dns.Message, error)
- func (c *Client) QueryUDP(query *dns.Message, addrPort netip.AddrPort) (*dns.Message, error)
- type OptionFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidNetwork = errors.New("invalid network") ErrNoMatchHeaderID = errors.New("header ids don't match") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the default DNS client to query and retrieve DNS messages
func (*Client) Configure ¶
func (c *Client) Configure(opts ...OptionFunc) error
Configure configures available client options
func (*Client) Query ¶
Query sends a DNS query for 'name' with 'class' and 'type' to the remote DNS server with 'ip' and returns the answer message and any encountered error
type OptionFunc ¶
func WithDialTimeout ¶
func WithDialTimeout(timeout time.Duration) OptionFunc
func WithNetwork ¶
func WithNetwork(network string) OptionFunc
func WithReadTimeout ¶
func WithReadTimeout(timeout time.Duration) OptionFunc
func WithWriteTimeout ¶
func WithWriteTimeout(timeout time.Duration) OptionFunc
Click to show internal directories.
Click to hide internal directories.