client

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextValue

func ContextValue[T any](ctx context.Context, name string, defaultOnNil T) T

func MarshallRRRecord

func MarshallRRRecord(data *DNSRecord, zone string) *libdns.RR

func NewBufPool

func NewBufPool() *sync.Pool

Types

type ApiClient

type ApiClient interface {
	provider.Client
	provider.ZoneAwareClient
}

func NewClient

func NewClient(config Config, storage Storage, mode ControleMode) ApiClient

type AuthRequest

type AuthRequest struct {
	Login          string         `json:"login"`
	Nonce          string         `json:"nonce"`
	Label          string         `json:"label,omitempty"`
	ReadOnly       bool           `json:"read_only"`
	ExpirationTime ExpirationTime `json:"expiration_time"`
	GlobalKey      bool           `json:"global_key"`
}

func NewAuthRequest

func NewAuthRequest(config Config) *AuthRequest

type Config

type Config interface {
	Login() string
	ReadOnly() bool
	GlobalKey() bool
	StorageKey() string
	GetBaseUri() *url.URL
	GetPrivateKey() (*rsa.PrivateKey, error)
	provider.DebugConfig
}

type ConfigExpirationTime

type ConfigExpirationTime interface {
	ExpirationTime() ExpirationTime
}

type ConfigLabel

type ConfigLabel interface {
	Label() string
}

type ConfigNonce

type ConfigNonce interface {
	Nonce() string
}

type ControleMode

type ControleMode uint8
const (
	RecordLevelControl ControleMode = iota
	FullZoneControl
)

func (*ControleMode) UnmarshalJSON

func (c *ControleMode) UnmarshalJSON(b []byte) error

type DNSEntries

type DNSEntries struct {
	Entries []*DNSRecord `json:"dnsEntries"`
}

type DNSEntry

type DNSEntry struct {
	Entry *DNSRecord `json:"dnsEntry"`
}

type DNSRecord

type DNSRecord struct {
	Type    string `json:"type"`
	Name    string `json:"name"`
	Content string `json:"content"`
	Expire  int    `json:"expire"`
}

func MarshallDNSRecords

func MarshallDNSRecords(data *libdns.RR, zone string) *DNSRecord

type DebugLevel

type DebugLevel uint8
const (
	DebugLevelNormal DebugLevel = iota
	DebugLevelDebug
)

type Domain

type Domain struct {
	Name string `json:"name"`
}

type DomainName

type DomainName string

func (DomainName) Name

func (d DomainName) Name() string

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"error"`
	Code    int    `json:"-"`
}

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

type ExpirationTime

type ExpirationTime string
const (
	ExpirationTime1Hour  ExpirationTime = "1 hour"
	ExpirationTime2Hour  ExpirationTime = "120 minutes"
	ExpirationTime48Hour ExpirationTime = "48 hours"
	ExpirationTime1Day   ExpirationTime = "1 day"
	ExpirationTime15Day  ExpirationTime = "15 days"
	ExpirationTime1Week  ExpirationTime = "1 week"
	ExpirationTime4Week  ExpirationTime = "4 weeks"
)
type Link struct {
	Rel  string `json:"rel"`
	Link string `json:"link"`
}
type Links []*Link

type Storage

type Storage interface {
	Set(key string, token Token) error
	Get(key string) (Token, error)
}

func NewTokenFileStorage

func NewTokenFileStorage(root string) (Storage, error)

NewTokenFileStorage will use given directory for storing token sessions and try to create when calling this function

storage, err := NewTokenFileStorage(filepath.Join(os.TempDir(), "transip"))

func NewTokenMemoryStorage

func NewTokenMemoryStorage() Storage

type Token

type Token interface {
	String() string
	IsExpired() bool
	ReadOnly() bool
	GlobalKey() bool

	gob.GobDecoder
}

func NewToken

func NewToken(x string) (Token, error)

type TokenFetcher

type TokenFetcher func(ctx context.Context, config Config) (string, error)

Jump to

Keyboard shortcuts

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