desec

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package desec provides a high-level client to the deSEC API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateBatchWaitDuration

func CalculateBatchWaitDuration(
	ml *slidingwindows.MultiLimiter, batchMinFillRatio float32,
) time.Duration

func CompareSubnames added in v0.8.0

func CompareSubnames(first, second string) bool

func FilterAndSortRRsets

func FilterAndSortRRsets(rrsets []desec.RRset, recordTypes []string) []desec.RRset

func GetReverseDomainNameFragments added in v0.8.0

func GetReverseDomainNameFragments(domainName string) []string

func IsDeletionUpsertRRset added in v0.8.0

func IsDeletionUpsertRRset(rrset desec.RRset) bool

func SortSubnameRRsets added in v0.8.0

func SortSubnameRRsets(
	rrsets map[string][]desec.RRset, filterRecordTypes []string,
) (subnames []string, sorted [][]desec.RRset)

Types

type Cache

type Cache struct {
	Cache       clientcache.Cache
	CostWeight  float32
	TTL         time.Duration
	RecordTypes []string
}

func (*Cache) GetDomainByName

func (c *Cache) GetDomainByName(name string) (*desec.Domain, bool, error)

func (*Cache) GetRRsetByNameAndType

func (c *Cache) GetRRsetByNameAndType(
	domainName, subname, rrsetType string,
) (*desec.RRset, bool, error)

func (*Cache) GetRRsetsByName

func (c *Cache) GetRRsetsByName(domainName, subname string) ([]desec.RRset, error)

func (*Cache) GetSubnames

func (c *Cache) GetSubnames(domainName string) ([]string, error)

func (*Cache) HasSubname

func (c *Cache) HasSubname(domainName string, subname string) bool

func (*Cache) SetDomainByName

func (c *Cache) SetDomainByName(name string, domain desec.Domain) error

func (*Cache) SetNonexistentDomainByName

func (c *Cache) SetNonexistentDomainByName(name string)

func (*Cache) SetNonexistentRRsetByNameAndType

func (c *Cache) SetNonexistentRRsetByNameAndType(domainName, subname, rrsetType string)

func (*Cache) SetRRsetByNameAndType

func (c *Cache) SetRRsetByNameAndType(
	domainName, subname, rrsetType string, rrset desec.RRset,
) error

func (*Cache) SetRRsetsByName

func (c *Cache) SetRRsetsByName(domainName, subname string, rrsets []desec.RRset) error

func (*Cache) SetSubnames

func (c *Cache) SetSubnames(domainName string, subnames []string) error

func (*Cache) UnsetSubnames

func (c *Cache) UnsetSubnames(domainName string)

type Client

type Client struct {
	Config       Config
	Logger       godest.Logger
	Cache        *Cache
	ReadLimiter  *slidingwindows.MultiLimiter
	WriteLimiter *slidingwindows.MultiLimiter
}

func NewClient

func NewClient(c Config, cache clientcache.Cache, l godest.Logger) *Client

func (*Client) CreateRRset

func (c *Client) CreateRRset(
	ctx context.Context, subname, recordType string, ttl int64, records []string,
) (desec.RRset, error)

func (*Client) DeleteRRset

func (c *Client) DeleteRRset(ctx context.Context, subname, recordType string) error

func (*Client) DeleteRRsets added in v0.8.0

func (c *Client) DeleteRRsets(ctx context.Context, keys ...RRsetKey) error

func (*Client) GetDomain

func (c *Client) GetDomain(ctx context.Context) (*desec.Domain, error)

func (*Client) GetRRset

func (c *Client) GetRRset(ctx context.Context, subname, recordType string) (*desec.RRset, error)

func (*Client) GetRRsets

func (c *Client) GetRRsets(ctx context.Context) (map[string][]desec.RRset, error)

func (*Client) GetSubnameRRsets

func (c *Client) GetSubnameRRsets(ctx context.Context, subname string) ([]desec.RRset, error)

func (*Client) UpdateRRset added in v0.8.0

func (c *Client) UpdateRRset(
	ctx context.Context, subname, recordType string, ttl int64, records []string,
) (*desec.RRset, error)

func (*Client) UpsertRRsets added in v0.8.0

func (c *Client) UpsertRRsets(ctx context.Context, rrsets ...desec.RRset) ([]desec.RRset, error)

type Config

type Config struct {
	DomainName  string
	DNSServer   models.DNSServer
	APISettings DesecAPISettings
	RecordTypes []string
}

func GetConfig

func GetConfig(domainName string) (c Config, err error)

type DesecAPISettings

type DesecAPISettings struct {
	ReadCacheTTL   time.Duration
	WriteSoftQuota float32
}

func GetAPISettings

func GetAPISettings() (s DesecAPISettings, err error)

type RRsetKey added in v0.8.0

type RRsetKey struct {
	Subname string
	Type    string
}

func NewRRsetKey added in v0.8.0

func NewRRsetKey(rrset desec.RRset) RRsetKey

func (RRsetKey) AsDeletionUpsertRRset added in v0.8.0

func (k RRsetKey) AsDeletionUpsertRRset() desec.RRset

Jump to

Keyboard shortcuts

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