Documentation ¶
Overview ¶
Package api implements protocols to update DNS records.
Index ¶
- type Auth
- type CloudflareAuth
- type CloudflareCache
- type CloudflareHandle
- func (h *CloudflareHandle) ActiveZones(ctx context.Context, ppfmt pp.PP, name string) ([]string, bool)
- func (h *CloudflareHandle) CreateRecord(ctx context.Context, ppfmt pp.PP, domain domain.Domain, ipNet ipnet.Type, ...) (string, bool)
- func (h *CloudflareHandle) DeleteRecord(ctx context.Context, ppfmt pp.PP, domain domain.Domain, ipNet ipnet.Type, ...) bool
- func (h *CloudflareHandle) FlushCache()
- func (h *CloudflareHandle) ListRecords(ctx context.Context, ppfmt pp.PP, domain domain.Domain, ipNet ipnet.Type) (map[string]netip.Addr, bool)
- func (h *CloudflareHandle) UpdateRecord(ctx context.Context, ppfmt pp.PP, domain domain.Domain, ipNet ipnet.Type, ...) bool
- func (h *CloudflareHandle) ZoneOfDomain(ctx context.Context, ppfmt pp.PP, domain domain.Domain) (string, bool)
- type Handle
- type TTL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth interface { // New uses the authentication information to create a Handle. New(ctx context.Context, ppfmt pp.PP, cacheExpiration time.Duration) (Handle, bool) }
An Auth contains authentication information.
type CloudflareAuth ¶
A CloudflareAuth implements the Auth interface, holding the authentication data to create a CloudflareHandle.
type CloudflareCache ¶ added in v1.8.0
type CloudflareCache = struct {
// contains filtered or unexported fields
}
CloudflareCache holds the previous repsonses from the Cloudflare API.
type CloudflareHandle ¶
type CloudflareHandle struct {
// contains filtered or unexported fields
}
A CloudflareHandle implements the Handle interface with the Cloudflare API.
func (*CloudflareHandle) ActiveZones ¶
func (h *CloudflareHandle) ActiveZones(ctx context.Context, ppfmt pp.PP, name string) ([]string, bool)
ActiveZones returns a list of zone IDs with the zone name.
func (*CloudflareHandle) CreateRecord ¶
func (h *CloudflareHandle) CreateRecord(ctx context.Context, ppfmt pp.PP, domain domain.Domain, ipNet ipnet.Type, ip netip.Addr, ttl TTL, proxied bool, ) (string, bool)
CreateRecord creates one DNS record.
func (*CloudflareHandle) DeleteRecord ¶
func (h *CloudflareHandle) DeleteRecord(ctx context.Context, ppfmt pp.PP, domain domain.Domain, ipNet ipnet.Type, id string, ) bool
DeleteRecord deletes one DNS record.
func (*CloudflareHandle) FlushCache ¶
func (h *CloudflareHandle) FlushCache()
FlushCache flushes the API cache.
func (*CloudflareHandle) ListRecords ¶
func (h *CloudflareHandle) ListRecords(ctx context.Context, ppfmt pp.PP, domain domain.Domain, ipNet ipnet.Type, ) (map[string]netip.Addr, bool)
ListRecords lists all matching DNS records.
type Handle ¶
type Handle interface { // ListRecords lists all matching DNS records. ListRecords(ctx context.Context, ppfmt pp.PP, domain domain.Domain, ipNet ipnet.Type) (map[string]netip.Addr, bool) // DeleteRecord deletes one DNS record. DeleteRecord(ctx context.Context, ppfmt pp.PP, domain domain.Domain, ipNet ipnet.Type, id string) bool // UpdateRecord updates one DNS record. UpdateRecord(ctx context.Context, ppfmt pp.PP, domain domain.Domain, ipNet ipnet.Type, id string, ip netip.Addr) bool // CreateRecord creates one DNS record. CreateRecord(ctx context.Context, ppfmt pp.PP, domain domain.Domain, ipNet ipnet.Type, ip netip.Addr, ttl TTL, proxied bool) (string, bool) // FlushCache flushes the API cache. Flushing should automatically happen when other operations encounter errors. FlushCache() }
A Handle represents a generic API to update DNS records. Currently, the only implementation is Cloudflare.