dns

package
v0.0.0-...-e356956 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSAdapter

type DNSAdapter interface {
	Authenticate(conf map[string]string) error      // Some DNS setups may require credentials.
	GetRecords(dnstype string) ([]DNSRecord, error) // Get all records of type
	AddRecord(record DNSRecord) error               // Add a record to DNS
	DelRecord(record DNSRecord) error               // Delete a record from DNS
	CommitRecords() error                           // Like with routers, some DNS setups might not apply changes immediately.
}

func NewDNSAdapter

func NewDNSAdapter(name string) DNSAdapter

Creates adapter from config name. Basically a simple Factory method.

type DNSRecord

type DNSRecord struct {
	Domain string `json:"domain"`
	Type   string `json:"type"`
	Addr   net.IP `json:"addr"`
	TTL    int    `json:"ttl"`
}

An oversimplified representation of a DNS record in a magical world without CNAME, SOA and other nightmares... contains only [A]ddress type, which is just fine for our goals.

type NullDNS

type NullDNS struct {
}

func (*NullDNS) AddRecord

func (n *NullDNS) AddRecord(record DNSRecord) error

func (*NullDNS) Authenticate

func (n *NullDNS) Authenticate(conf map[string]string) error

func (*NullDNS) CommitRecords

func (n *NullDNS) CommitRecords() error

func (*NullDNS) DelRecord

func (n *NullDNS) DelRecord(record DNSRecord) error

func (*NullDNS) GetRecords

func (n *NullDNS) GetRecords(dnstype string) ([]DNSRecord, error)

type PiholeAPIv5

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

Implementation of DNS Adapter for Pi-hole web API (for v5 PHP API). WARNING: This is basically useless now (thanks pi-hole team for deprecating a quirky [but perfectly functional] api without a warning). SergDS (C) 2024 Adapter config: pihole_apikey -- Api key for pihole instance pihole_server -- Instance IP address

func (*PiholeAPIv5) AddRecord

func (p *PiholeAPIv5) AddRecord(record DNSRecord) error

func (*PiholeAPIv5) Authenticate

func (p *PiholeAPIv5) Authenticate(conf map[string]string) error

func (*PiholeAPIv5) CommitRecords

func (p *PiholeAPIv5) CommitRecords() error

func (*PiholeAPIv5) DelRecord

func (p *PiholeAPIv5) DelRecord(record DNSRecord) error

func (*PiholeAPIv5) GetRecords

func (p *PiholeAPIv5) GetRecords(dnstype string) ([]DNSRecord, error)

type PiholeAPIv6

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

Implementation of DNS Adapter for Pi-hole web API (for v6 FTL REST API). Pi-hole v6 threw out all PHP code. This means a whole new api. On the bright side, at least the new api is simpler, better and has full docs, so no more reading php. if you updated from v5, without undoing playbook first, then you'll have to undo it yourself. SergDS (C) 2025 Adapter config: pihole_apikey -- (Application) Password for pihole instance (still called apikey for compat with v5) pihole_server -- Instance IP address

func (*PiholeAPIv6) AddRecord

func (p *PiholeAPIv6) AddRecord(record DNSRecord) error

func (*PiholeAPIv6) Authenticate

func (p *PiholeAPIv6) Authenticate(conf map[string]string) error

func (*PiholeAPIv6) CommitRecords

func (p *PiholeAPIv6) CommitRecords() error

func (*PiholeAPIv6) DelRecord

func (p *PiholeAPIv6) DelRecord(record DNSRecord) error

func (*PiholeAPIv6) GetRecords

func (p *PiholeAPIv6) GetRecords(dnstype string) ([]DNSRecord, error)

Jump to

Keyboard shortcuts

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