client

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: BSD-3-Clause, MPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TSIGGSS = tsig.GSS
)

Variables

This section is empty.

Functions

func TsigGenerate

func TsigGenerate(m *dns.Msg, secret, requestMAC string, timersOnly bool) ([]byte, string, error)

TsigGenerate fills out the TSIG record attached to the message. The message should contain a "stub" TSIG RR with the algorithm, key name (owner name of the RR), time fudge (defaults to 300 seconds) and the current time The TSIG MAC is saved in that Tsig RR. When TsigGenerate is called for the first time requestMAC is set to the empty string and timersOnly is false. If something goes wrong an error is returned, otherwise it is nil.

func TsigGenerateByAlgorithm

func TsigGenerateByAlgorithm(m *dns.Msg, cb TsigGenerateFn, name, secret, requestMAC string, timersOnly bool) ([]byte, string, error)

TsigGenerateByAlgorithm fills out the TSIG record attached to the message using a callback to implement the algorithm-specific generation. The message should contain a "stub" TSIG RR with the algorithm, key name (owner name of the RR), time fudge (defaults to 300 seconds) and the current time The TSIG MAC is saved in that Tsig RR. When TsigGenerate is called for the first time requestMAC is set to the empty string and timersOnly is false. If something goes wrong an error is returned, otherwise it is nil.

func TsigVerify

func TsigVerify(msg []byte, secret, requestMAC string, timersOnly bool) error

TsigVerify verifies the TSIG on a message. If the signature does not validate err contains the error, otherwise it is nil.

func TsigVerifyByAlgorithm

func TsigVerifyByAlgorithm(msg []byte, cb TsigVerifyFn, name, secret, requestMAC string, timersOnly bool) error

TsigVerifyByAlgorithm verifies the TSIG on a message using a callback to implement the algorithm-specific verification. If the signature does not validate err contains the error, otherwise it is nil.

Types

type Client

type Client struct {
	dns.Client
	Config

	SkipVerify bool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg *Config) *Client

func (*Client) Dial

func (c *Client) Dial(address string) (conn *Conn, err error)

Dial connects to the address on the named network.

func (*Client) Exchange

func (c *Client) Exchange(m *dns.Msg) (r *dns.Msg, rtt time.Duration, err error)

func (*Client) NegotiateContext

func (c *Client) NegotiateContext(username, password string) (string, *time.Time, error)

type Config

type Config struct {
	HostIP   string `json:"ip"`
	Hostname string `json:"hostname"`
	Port     string `json:"port"`
	Realm    string `json:"realm"`
}

type Conn

type Conn struct {
	dns.Conn
	// contains filtered or unexported fields
}

func (*Conn) ReadMsg

func (co *Conn) ReadMsg() (*dns.Msg, error)

ReadMsg reads a message from the connection co. If the received message contains a TSIG record the transaction signature is verified. This method always tries to return the message, however if an error is returned there are no guarantees that the returned message is a valid representation of the packet read.

func (*Conn) SetupTSIG

func (co *Conn) SetupTSIG(keyname string, generate TsigGenerateFn, verify TsigVerifyFn)

func (*Conn) WriteMsg

func (co *Conn) WriteMsg(m *dns.Msg) (err error)

WriteMsg sends a message through the connection co. If the message m contains a TSIG record the transaction signature is calculated.

type TSIG

type TSIG struct {
	dns.TSIG
}

TSIG is the RR the holds the transaction signature of a message. See RFC 2845 and RFC 4635.

type TsigGenerateFn

type TsigGenerateFn func(msg []byte, algorithm, name, secret string) ([]byte, error)

type TsigVerifyFn

type TsigVerifyFn func(msg []byte, tsig *dns.TSIG, name, secret string) error

Jump to

Keyboard shortcuts

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