transport

package
v0.0.0-...-97a175b Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UDPBufferSize = 512 // For UDP packet size
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	SendResponse(msg *dns.Msg) error
}

type QueueItem

type QueueItem struct {
	Msg        dns.Msg
	Connection Connection
}

func (*QueueItem) Message

func (qi *QueueItem) Message() *dns.Msg

func (*QueueItem) Question

func (qi *QueueItem) Question() *dns.Question

func (*QueueItem) Respond

func (qi *QueueItem) Respond(msg *dns.Msg) error

type TCPConnection

type TCPConnection struct {
	Conn net.Conn
}

func (*TCPConnection) SendResponse

func (tc *TCPConnection) SendResponse(msg *dns.Msg) error

type TCPTransport

type TCPTransport struct {
	Listener net.Listener
	Queue    chan QueueItem
}

func NewTCP

func NewTCP(c config.Protocol, q chan QueueItem) (*TCPTransport, error)

func (*TCPTransport) Close

func (t *TCPTransport) Close() error

func (*TCPTransport) Listen

func (t *TCPTransport) Listen() error

type Transport

type Transport interface {
	Listen() error
	Close() error
}

func NewUDP

func NewUDP(c config.Protocol, q chan QueueItem) (Transport, error)

type Transports

type Transports struct {
	Transports map[common.Protocol]Transport
	Queue      chan QueueItem
}

Transports now uses a map for dynamic transport management.

func New

func New(cfg *config.Transport) *Transports

Initializes Transports with enabled transports from configuration.

func (*Transports) Listen

func (t *Transports) Listen() error

Listen on all initialized transports.

func (*Transports) Start

func (t *Transports) Start()

func (*Transports) Stop

func (t *Transports) Stop() error

Stop all initialized transports.

type UDPConnection

type UDPConnection struct {
	Addr net.Addr
	Conn net.PacketConn
}

func (*UDPConnection) SendResponse

func (uc *UDPConnection) SendResponse(msg *dns.Msg) error

type UDPTransport

type UDPTransport struct {
	Conn  net.PacketConn
	Queue chan QueueItem
}

func (*UDPTransport) Close

func (ut *UDPTransport) Close() error

func (*UDPTransport) Listen

func (ut *UDPTransport) Listen() error

Bind reads from the connection and enqueues received DNS queries.

Jump to

Keyboard shortcuts

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