restore

package
v1.9.17 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 2 Imported by: 8

Documentation

Overview

The restore package provides data structures important to restoring DNS proxy rules. This package serves as a central source for these structures. Note that these are marshaled as JSON and any changes need to be compatible across an upgrade!

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSRules

type DNSRules map[uint16]IPRules

DNSRules contains IP-based DNS rules for a set of ports (e.g., 53)

func (DNSRules) Sort

func (r DNSRules) Sort() DNSRules

Sort is only used for testing Sorts in place, but returns DNSRules for convenience

type IPRule

type IPRule struct {
	Re  RuleRegex
	IPs map[string]struct{} // IPs, nil set is wildcard and allows all IPs!
}

IPRule stores the allowed destination IPs for a DNS names matching a regex

type IPRules

type IPRules []IPRule

IPRules is an unsorted collection of IPrules

func (IPRules) Sort

func (r IPRules) Sort() IPRules

Sort is only used for testing Sorts in place, but returns IPRules for convenience

type RuleRegex

type RuleRegex struct {
	*regexp.Regexp
}

RuleRegex is a wrapper for *regexp.Regexp so that we can define marshalers for it.

func (RuleRegex) MarshalText

func (r RuleRegex) MarshalText() ([]byte, error)

MarshalText marshals RuleRegex as string

func (*RuleRegex) UnmarshalText

func (r *RuleRegex) UnmarshalText(b []byte) error

UnmarshalText unmarshals json into a RuleRegex This must have a pointer receiver, otherwise the RuleRegex remains empty.

Jump to

Keyboard shortcuts

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