dnssvctest

package
v0.0.0-...-b6e3791 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package dnssvctest contains common constants and utilities for the internal DNS-service packages.

Index

Constants

View Source
const (
	DeviceIDStr  = "dev1234"
	ProfileIDStr = "prof1234"
)

String representations of the common IDs for tests.

View Source
const (
	FilterListID1Str = "flt_1"
	FilterListID2Str = "flt_2"
)

String representations for the common filtering-rule list ID for tests.

View Source
const (
	FilterListID1 agd.FilterListID = FilterListID1Str
	FilterListID2 agd.FilterListID = FilterListID2Str
)

Common filtering-rule list ID for tests.

View Source
const (
	Domain               = "test.example"
	DomainAllowed        = "allowed.example"
	DomainBlocked        = "blocked.example"
	DomainRewritten      = "rewritten.example"
	DomainRewrittenCNAME = "rewritten-cname.example"

	DomainFQDN               = Domain + "."
	DomainAllowedFQDN        = DomainAllowed + "."
	DomainBlockedFQDN        = DomainBlocked + "."
	DomainRewrittenFQDN      = DomainRewritten + "."
	DomainRewrittenCNAMEFQDN = DomainRewrittenCNAME + "."
)

Common domains and FQDNs for tests.

View Source
const DeviceID agd.DeviceID = DeviceIDStr

DeviceID is the common device ID for tests.

View Source
const DeviceIDWildcard = "*.dns.example.com"

DeviceIDWildcard is the common wildcard domain for retrieving agd.DeviceID in tests. Use strings.ReplaceAll to replace the "*" symbol with the actual agd.DeviceID.

ProfileID is the common profile ID for tests.

View Source
const ServerName agd.ServerName = "test_server_dns_tls"

ServerName is the common server name for tests.

View Source
const Timeout time.Duration = 1 * time.Second

Timeout is the common timeout for tests.

Variables

View Source
var (
	ClientIP   = net.IP{1, 2, 3, 4}
	RemoteAddr = &net.TCPAddr{
		IP:   ClientIP,
		Port: 12345,
	}

	ClientAddrPort = RemoteAddr.AddrPort()
	ClientAddr     = ClientAddrPort.Addr()

	LocalAddr = &net.TCPAddr{
		IP:   net.IP{5, 6, 7, 8},
		Port: 54321,
	}

	ServerAddrPort = LocalAddr.AddrPort()
	ServerAddr     = ServerAddrPort.Addr()
)

Common addresses for tests.

Functions

func NewServer

func NewServer(
	name agd.ServerName,
	proto agd.Protocol,
	bindData ...*agd.ServerBindData,
) (srv *agd.Server)

NewServer is a helper that returns a new *agd.Server for tests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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