Documentation
¶
Index ¶
- Constants
- type Composer
- type Instance
- func (inst *Instance) ComposeAAAARecord(rec *m.Record) (record dns.RR, extras []dns.RR, err error)
- func (inst *Instance) ComposeARecord(rec *m.Record) (record dns.RR, extras []dns.RR, err error)
- func (inst *Instance) ComposeCAARecord(rec *m.Record) (record dns.RR, extras []dns.RR, err error)
- func (inst *Instance) ComposeCNAMERecord(rec *m.Record) (record dns.RR, extras []dns.RR, err error)
- func (inst *Instance) ComposeMXRecord(rec *m.Record) (record dns.RR, extras []dns.RR, err error)
- func (inst *Instance) ComposeNSRecord(rec *m.Record) (record dns.RR, extras []dns.RR, err error)
- func (inst *Instance) ComposeSOARecord(rec *m.Record) (record dns.RR, extras []dns.RR, err error)
- func (inst *Instance) ComposeSRVRecord(rec *m.Record) (record dns.RR, extras []dns.RR, err error)
- func (inst *Instance) ComposeTXTRecord(rec *m.Record) (record dns.RR, extras []dns.RR, err error)
- func (inst *Instance) FetchRecords(zone string, name string, types ...string) (recs []*m.Record, err error)
- func (inst *Instance) FetchZones() (zones []string, err error)
- func (inst *Instance) Hosts(zone string, name string) (answers []dns.RR, err error)
- func (inst *Instance) Start() error
- func (inst *Instance) WaitForReady()
- func (inst *Instance) WithCacheCapacity(capacity int) *Instance
- func (inst *Instance) WithDefaultTtl(defaultTtl int) *Instance
- func (inst *Instance) WithListen(listen string) *Instance
- func (inst *Instance) WithSuPassword(suPassword string) *Instance
- func (inst *Instance) WithSuUserName(suEmail string) *Instance
Constants ¶
const ( // ZonesCacheRefreshInterval defines how often the zones cache should be refreshed. ZonesCacheRefreshInterval = 10 * time.Second // ZonesCacheKey is the key used to store zones in the cache. ZonesCacheKey = "zones" // RecordsCacheKeyFormat defines the format for record cache keys. RecordsCacheKeyFormat = "records.[%s]-[%s]-[%s]" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Composer ¶
type Composer struct {
// contains filtered or unexported fields
}
Composer is responsible for composing DNS records from PocketBase data. It provides methods to convert PocketBase record data into DNS resource records.
func NewComposer ¶
NewComposer creates a new Composer instance with the given PocketBase instance.
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance represents a PocketBase instance with DNS-specific configurations and caching. It manages the connection to PocketBase and provides methods for DNS record operations.
func NewWithDataDir ¶
NewWithDataDir creates a new Instance with the specified data directory. The data directory will be converted to an absolute path if it's relative.
func (*Instance) ComposeAAAARecord ¶
ComposeAAAARecord creates a DNS AAAA record from a PocketBase record. It returns the composed AAAA record and any additional records needed.
func (*Instance) ComposeARecord ¶
ComposeARecord creates a DNS A record from a PocketBase record. It returns the composed A record and any additional records needed.
func (*Instance) ComposeCAARecord ¶
ComposeCAARecord creates a DNS CAA record from a PocketBase record. It returns the composed CAA record and any additional records needed.
func (*Instance) ComposeCNAMERecord ¶
ComposeCNAMERecord creates a DNS CNAME record from a PocketBase record. It returns the composed CNAME record and any additional records needed.
func (*Instance) ComposeMXRecord ¶
ComposeMXRecord creates a DNS MX record from a PocketBase record. It returns the composed MX record and any additional records needed.
func (*Instance) ComposeNSRecord ¶
ComposeNSRecord creates a DNS NS record from a PocketBase record. It returns the composed NS record and any additional records needed.
func (*Instance) ComposeSOARecord ¶
ComposeSOARecord creates a DNS SOA record from a PocketBase record. It returns the composed SOA record and any additional records needed.
func (*Instance) ComposeSRVRecord ¶
ComposeSRVRecord creates a DNS SRV record from a PocketBase record. It returns the composed SRV record and any additional records needed.
func (*Instance) ComposeTXTRecord ¶
ComposeTXTRecord creates a DNS TXT record from a PocketBase record. It returns the composed TXT record and any additional records needed.
func (*Instance) FetchRecords ¶
func (inst *Instance) FetchRecords(zone string, name string, types ...string) (recs []*m.Record, err error)
FetchRecords retrieves DNS records from PocketBase for a given zone, name, and record types. It first checks the cache if enabled, then queries the database if not found in cache. For wildcard records, it recursively checks parent domains until a match is found. Returns a slice of records and any error encountered.
func (*Instance) FetchZones ¶
FetchZones retrieves all unique DNS zones from PocketBase. It first checks the cache if enabled, then queries the database if not found in cache. Returns a slice of zone names and any error encountered.
func (*Instance) Hosts ¶
Hosts retrieves and composes DNS resource records for a given zone and name. It supports A, AAAA, and CNAME record types. Returns a slice of DNS resource records and any error encountered.
func (*Instance) Start ¶
Start initializes and starts the PocketBase server. It configures the server to run in development mode and sets up necessary hooks. Returns an error if the server fails to start.
func (*Instance) WaitForReady ¶
func (inst *Instance) WaitForReady()
WaitForReady blocks until the PocketBase instance is fully initialized and ready to serve requests.
func (*Instance) WithCacheCapacity ¶
WithCacheCapacity sets the capacity for the records cache. If capacity is greater than 1, both zones and records caching will be enabled. If there's an error initializing the cache, caching will be disabled.
func (*Instance) WithDefaultTtl ¶
WithDefaultTtl sets the default TTL (Time To Live) for DNS records. This value will be used when no specific TTL is provided for a record.
func (*Instance) WithListen ¶
WithListen sets the address and port where the PocketBase server should listen. The format should be "address:port".
func (*Instance) WithSuPassword ¶
WithSuPassword sets the superuser password for the Instance. This is used for authentication and administrative operations.
func (*Instance) WithSuUserName ¶
WithSuUserName sets the superuser email for the Instance. This is used for authentication and administrative operations.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cache provides caching functionality for DNS records and zones.
|
Package cache provides caching functionality for DNS records and zones. |