Documentation
¶
Overview ¶
Package dio provides functions to read and write DNS messages from and to the wire
Index ¶
- type DefaultReader
- type DefaultWriter
- func (w *DefaultWriter) WriteTCP(conn *net.TCPConn, buf []byte) error
- func (w *DefaultWriter) WriteTCPClose(conn *net.TCPConn, buf []byte) error
- func (w *DefaultWriter) WriteUDP(conn *net.UDPConn, buf []byte, addrPort netip.AddrPort) error
- func (w *DefaultWriter) WriteUDPClose(conn *net.UDPConn, buf []byte, addrPort netip.AddrPort) error
- type Reader
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultReader ¶
type DefaultReader struct {
AncillarySize int
}
type DefaultWriter ¶
type DefaultWriter struct {
}
DefaultWriter is the default implementation of the 'Writer' interface
func NewDefaultWriter ¶
func NewDefaultWriter() *DefaultWriter
NewDefault returns a new default writer
func (*DefaultWriter) WriteTCP ¶
func (w *DefaultWriter) WriteTCP(conn *net.TCPConn, buf []byte) error
WriteTCP writes a byte slice back to a client with 'addr' via the provided TCP conn
func (*DefaultWriter) WriteTCPClose ¶
func (w *DefaultWriter) WriteTCPClose(conn *net.TCPConn, buf []byte) error
WriteTCPClose writes a byte slice back to a client with 'addr' via the provided TCP conn and closes it afterwards
func (*DefaultWriter) WriteUDP ¶
WriteUDP writes a byte slice back to a client with 'addr' via the provided UDP conn
func (*DefaultWriter) WriteUDPClose ¶
WriteUDPClose writes a byte slice back to a client with 'addr' via the provided UDP conn and closes it afterwards
type Reader ¶
type Reader interface {
// ReadUDP reads a single message from a UDP connection and
// returns the message as a slice of bytes, the length of the
// read message, session data or an error
ReadUDP(*net.UDPConn, []byte) (int, dns.Session, error)
ReadTCP(net.Conn) ([]byte, error)
}
Reader defines a reader interface which enbables implementers to read incoming TCP and UDP messages from listeners and return these messages as a byte slice, session data like remote IP address and additional data or an error.
func NewDefaultReader ¶
type Writer ¶
type Writer interface {
// WriteUDPClose writes a byte slice back to a client with
// 'addr' via the provided UDP conn and closes it afterwards
WriteUDPClose(*net.UDPConn, []byte, netip.AddrPort) error
// WriteUDP writes a byte slice back to a client with
// 'addr' via the provided UDP conn
WriteUDP(*net.UDPConn, []byte, netip.AddrPort) error
// WriteTCPClose writes a byte slice back to a client with
// 'addr' via the provided TCP conn and closes it afterwards
WriteTCPClose(*net.TCPConn, []byte) error
// WriteTCP writes a byte slice back to a client with
// 'addr' via the provided TCP conn
WriteTCP(*net.TCPConn, []byte) error
}
Writer describes an interface which allows to write DNS messages (byte slices) back to a client via UDP and TCP