dns

package
v0.0.0-...-10541b1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CloudflareProvider string = "cloudflare"

Variables

View Source
var (
	ErrGetZoneIDFailes   = fmt.Errorf("failed to get zone id from domain")
	ErrDomainNotFound    = fmt.Errorf("domain not found")
	ErrListZonesFailed   = fmt.Errorf("failed to list zones")
	ErrListRecordsFailed = fmt.Errorf("failed to list records")
)

Functions

This section is empty.

Types

type CloudflareRepo

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

func NewCloudflareRepo

func NewCloudflareRepo(domain, token string, client *http.Client) *CloudflareRepo

func (*CloudflareRepo) CreateRecord

func (c *CloudflareRepo) CreateRecord(ctx context.Context, record DnsRecord) error

func (*CloudflareRepo) DeleteRecord

func (c *CloudflareRepo) DeleteRecord(ctx context.Context, record DnsRecord) (DnsRecordList, error)

func (*CloudflareRepo) ListRecords

func (c *CloudflareRepo) ListRecords(ctx context.Context, types ...string) (DnsRecordList, error)

func (*CloudflareRepo) UpdateRecord

func (c *CloudflareRepo) UpdateRecord(ctx context.Context, record DnsRecord) error

type DnsRecord

type DnsRecord struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	Content string `json:"content"`
}

type DnsRecordList

type DnsRecordList []DnsRecord

func (DnsRecordList) AsJsonString

func (d DnsRecordList) AsJsonString() string

func (DnsRecordList) AsTableString

func (d DnsRecordList) AsTableString() string

type DnsRepository

type DnsRepository interface {
	ListRecords(ctx context.Context, types ...string) (DnsRecordList, error)
	CreateRecord(ctx context.Context, record DnsRecord) error
	UpdateRecord(ctx context.Context, record DnsRecord) error
	DeleteRecord(ctx context.Context, record DnsRecord) (DnsRecordList, error)
}

func GetRepoFromViperOrFlag

func GetRepoFromViperOrFlag(domain string, provider, token string) (DnsRepository, error)

Jump to

Keyboard shortcuts

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