dns

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Overview

Package dns provides utilities for DNS tests.

Index

Constants

View Source
const GoogleDoHProvider = "https://dns.google/dns-query"

GoogleDoHProvider is the Google DNS-over-HTTPS provider.

Variables

View Source
var DigProxyIPRE = regexp.MustCompile(`SERVER: 100.115.92.\d+#53`)

DigProxyIPRE is the regular expressions for DNS proxy IP inside dig output.

Functions

func DigMatch

func DigMatch(ctx context.Context, re *regexp.Regexp, match bool) error

DigMatch runs dig to check name resolution works and verifies the expected server was used.

func GetClientString

func GetClientString(c Client) string

GetClientString get the string representation of a DNS client.

func InstallDigInContainer

func InstallDigInContainer(ctx context.Context, cont *vm.Container) error

InstallDigInContainer installs dig in container.

func QueryDNS

func QueryDNS(ctx context.Context, c Client, a *arc.ARC, cont *vm.Container, domain string) error

QueryDNS resolves a domain through DNS with a specific client.

func SetDoHMode

func SetDoHMode(ctx context.Context, cr *chrome.Chrome, tconn *chrome.TestConn, mode DoHMode, dohProvider string) error

SetDoHMode updates Chrome OS setting to change DNS-over-HTTPS mode.

func TestQueryDNSProxy

func TestQueryDNSProxy(ctx context.Context, tcs []ProxyTestCase, a *arc.ARC, cont *vm.Container, domain string) []error

TestQueryDNSProxy runs a set of test cases for DNS proxy.

Types

type Client

type Client int

Client defines the client resolving DNS.

const (
	// System is a DNS client type for systems.
	System Client = iota
	// User is a DNS client type for users (e.g. cups, tlsdate).
	User
	// Chrome is a DNS client type with user 'chronos'.
	Chrome
	// Crostini is a DNS client type for Crostini.
	Crostini
	// ARC is a DNS client type for ARC.
	ARC
)

type DoHMode

type DoHMode int

DoHMode defines possible type of DNS-over-HTTPS.

const (
	// DoHOff is a mode that resolves DNS through plaintext.
	DoHOff DoHMode = iota
	// DoHAutomatic is a mode that automatically chose between plaintext and secure DNS.
	DoHAutomatic
	// DoHAlwaysOn is a mode that resolves DNS through secure DNS.
	DoHAlwaysOn
)

type ProxyTestCase

type ProxyTestCase struct {
	Client    Client
	ExpectErr bool
}

ProxyTestCase contains test case for DNS proxy tests.

Jump to

Keyboard shortcuts

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