dns

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RecordTypeA     = RecordType("a")
	RecordTypeAAAA  = RecordType("aaaa")
	RecordTypeCNAME = RecordType("cname")
	RecordTypeTXT   = RecordType("txt")
)

Enum value for RecordType

View Source
var (
	// ErrAuth is return when a user is not allow to do certain action on a domain
	// most usually it is because the domain is own by someone else
	ErrAuth = errors.New("unauthorized error")
	// ErrSubdomainUsed returned if the subdomain is already reserved
	ErrSubdomainUsed = errors.New("subdomain already reserved")
)

Functions

This section is empty.

Types

type Mgr

type Mgr struct {
	// contains filtered or unexported fields
}

Mgr is responsible to configure CoreDNS trough its redis pluging

func New

func New(pool *redis.Pool, identity string) *Mgr

New creates a DNS manager

func (*Mgr) AddDomainDelagate

func (c *Mgr) AddDomainDelagate(identity, user, domain string) error

AddDomainDelagate configures coreDNS to manage domain

func (*Mgr) AddSubdomain

func (c *Mgr) AddSubdomain(user string, domain string, IPs []net.IP) error

AddSubdomain configures a domain A or AAA records depending on the version of the IP address in IPs

func (*Mgr) Cleanup

func (c *Mgr) Cleanup() error

Cleanup makes sure that currect coredns configuration is optimal by cleaning up not used records

func (*Mgr) RemoveDomainDelagate

func (c *Mgr) RemoveDomainDelagate(user string, domain string) error

RemoveDomainDelagate remove a delagated domain added with AddDomainDelagate

func (*Mgr) RemoveSubdomain

func (c *Mgr) RemoveSubdomain(user string, domain string, IPs []net.IP) error

RemoveSubdomain remove a domain added with AddSubdomain

type Record

type Record interface {
	Type() RecordType
}

Record define the interface to be a DNS record

type RecordA

type RecordA struct {
	IP4 string `json:"ip"`
	TTL int    `json:"ttl"`
}

RecordA is a type A DNS record

func (RecordA) Type

func (r RecordA) Type() RecordType

Type implements Record interface

type RecordAAAA

type RecordAAAA struct {
	IP6 string `json:"ip"`
	TTL int    `json:"ttl"`
}

RecordAAAA is a type AAAA DNS record

func (RecordAAAA) Type

func (r RecordAAAA) Type() RecordType

Type implements Record interface

type RecordCname

type RecordCname struct {
	Host string `json:"host"`
	TTL  int    `json:"ttl"`
}

RecordCname is a type CNAME DNS record

func (RecordCname) Type

func (r RecordCname) Type() RecordType

Type implements Record interface

type RecordTXT

type RecordTXT struct {
	Text string `json:"text"`
	TTL  int    `json:"ttl"`
}

RecordTXT is a TXT DNS record

func (RecordTXT) Type

func (r RecordTXT) Type() RecordType

Type implements Record interface

type RecordType

type RecordType string

RecordType is the enum type for all supported DNS record

type Zone

type Zone struct {
	Records records
}

Zone is a DNS zone. It hosts multiple records and belong to a owner

func (*Zone) Add

func (z *Zone) Add(r Record)

Add adds a record to the zone

func (*Zone) Remove

func (z *Zone) Remove(r Record)

Remove removes a record from the zone

type ZoneOwner

type ZoneOwner struct {
	Owner string //threebot ID owning this zone
}

ZoneOwner contains the ThreebotID linked to a delagated zone

Jump to

Keyboard shortcuts

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