model

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr    string            `json:"addr"`
	Debug   bool              `json:"debug"`
	Domains map[string]Domain `json:"domains"`
	Redis   struct {
		Addr     string `json:"addr"`
		Password string `json:"password"`
		DB       int    `json:"db"`
	} `json:"redis"`
}

type Domain

type Domain struct {
	Rules         map[string]Rule   `json:"rules"`
	Authoritative bool              `json:"authoritative,default=true"`
	Recursion     bool              `json:"recursion,default=false"`
	Upstreams     []string          `json:"upstreams"`
	Providers     map[string]string `json:"providers"`
	TTL           uint32            `json:"ttl,default=60"`
	Tsig          *TSIG             `json:"tsig"`
}

type MXRecord added in v1.7.0

type MXRecord struct {
	Preference uint16 `json:"preference"`
	MX         string `json:"mx"`
}

type PortRule added in v1.6.0

type PortRule string

func (*PortRule) Contains added in v1.6.0

func (p *PortRule) Contains(port int) bool

type Record

type Record struct {
	Host     string      `json:"host"`
	Type     RecordType  `json:"type"`
	Value    RecordValue `json:"value"`
	Weight   uint16      `json:"weight,default=1"`
	Disabled bool        `json:"disabled,default=false"`
	Note     string      `json:"-"`
}

type RecordProvider added in v1.8.6

type RecordProvider interface {
	FindRecord(name string, t uint16) *Record
	FindRecords(name string, t uint16) []Record
	Header(r *Record) dns.RR_Header
	Recursion() bool
	Exchange(r *dns.Msg) (*dns.Msg, error)
}

type RecordType

type RecordType string
const (
	RecordTypeA     RecordType = "A"
	RecordTypeAAAA  RecordType = "AAAA"
	RecordTypeCNAME RecordType = "CNAME"
	RecordTypeMX    RecordType = "MX"
	RecordTypeNS    RecordType = "NS"
	RecordTypeSOA   RecordType = "SOA"
	RecordTypeSRV   RecordType = "SRV"
	RecordTypeTXT   RecordType = "TXT"
)

func ReadRecordType

func ReadRecordType(t uint16) RecordType

func (RecordType) DnsType

func (t RecordType) DnsType() uint16

func (RecordType) String

func (t RecordType) String() string

type RecordValue

type RecordValue string

func (*RecordValue) IP

func (v *RecordValue) IP() net.IP

func (*RecordValue) MX added in v1.7.0

func (v *RecordValue) MX() (*MXRecord, error)

func (*RecordValue) SOA

func (v *RecordValue) SOA() (*SOARecord, error)

func (*RecordValue) SRV

func (v *RecordValue) SRV() (*SRVRecord, error)

func (*RecordValue) String

func (v *RecordValue) String() string

type Rule

type Rule struct {
	CIDRs []string   `json:"cidrs"`
	Ports []PortRule `json:"ports"`
	Types []string   `json:"types"`
}

type SOARecord

type SOARecord struct {
	NS      string
	MBox    string
	Serial  uint32
	Refresh uint32
	Retry   uint32
	Expire  uint32
	MinTTL  uint32
}

type SRVRecord

type SRVRecord struct {
	Priority uint16
	Weight   uint16
	Port     uint16
	Target   string
}

type TSIG added in v1.8.3

type TSIG struct {
	Key string `json:"key"`
}

Jump to

Keyboard shortcuts

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