adapter

package
v0.0.0-...-fba9dd7 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DatasourceRegister = NewRegister[Datasource]()
View Source
var ProviderRegister = NewRegister[Provider]()

Functions

func CloseService

func CloseService(ctx context.Context, ser any) error

func MergeDatasources

func MergeDatasources(ctx context.Context, datasources []Datasource, ipv4, ipv6, fastfail bool) ([]netip.Addr, error)

func MergeDualStackDatasourceIP

func MergeDualStackDatasourceIP(ctx context.Context, s DatasourceDualStack) ([]netip.Addr, error)

func Register

func Register[T managedType, O any](R Registry[T], typ string, constructor GenericObjectConstructor[T, O])

func StartService

func StartService(ctx context.Context, ser any) error

Types

type AbstractManagedType

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

func NewManagedType

func NewManagedType(typ, name string) AbstractManagedType

func (AbstractManagedType) Name

func (a AbstractManagedType) Name() string

func (AbstractManagedType) Type

func (a AbstractManagedType) Type() string

type Datasource

type Datasource interface {
	IP(context.Context) ([]netip.Addr, error)
	// contains filtered or unexported methods
}

type DatasourceDualStack

type DatasourceDualStack interface {
	Datasource
	IPv4(ctx context.Context) ([]netip.Addr, error)
	IPv6(ctx context.Context) ([]netip.Addr, error)
}

type DatasourceError

type DatasourceError struct {
	Err       error
	IPVersion string
	Name      string
	Type      string
}

func (*DatasourceError) Error

func (e *DatasourceError) Error() string

func (*DatasourceError) Unwrap

func (e *DatasourceError) Unwrap() error

type DatasourceManager

type DatasourceManager = Manager[Datasource]

type DefaultManager

type DefaultManager[T managedType] struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager[T managedType](R Registry[T]) *DefaultManager[T]

func (*DefaultManager[T]) Create

func (M *DefaultManager[T]) Create(ctx context.Context, typ string, opt any) error

func (*DefaultManager[T]) Lookup

func (M *DefaultManager[T]) Lookup(name string) (T, bool)

type GenericObjectConstructor

type GenericObjectConstructor[T managedType, O any] func(ctx context.Context, option O) (T, error)

type Manager

type Manager[T managedType] interface {
	Create(ctx context.Context, typ string, opt any) error
	Lookup(name string) (T, bool)
}

type PostCloser

type PostCloser interface {
	PostClose(ctx context.Context) error
}

type PostStarter

type PostStarter interface {
	PostStart(ctx context.Context) error
}

type PreCloser

type PreCloser interface {
	PreClose(ctx context.Context) error
}

type PreStarter

type PreStarter interface {
	PreStart(ctx context.Context) error
}

type Provider

type Provider interface {
	Diff(ctx context.Context, domain string, addr []netip.Addr) (bool, error)
	Update(ctx context.Context, domain string, ttl uint32, addr []netip.Addr) error
	// contains filtered or unexported methods
}

type ProviderManager

type ProviderManager = Manager[Provider]

type Registry

type Registry[T managedType] interface {
	Create(ctx context.Context, typ string, option any) (T, error)
	CreateOption(typ string) (any, error)
	Types() []string
	// contains filtered or unexported methods
}

func NewRegister

func NewRegister[T managedType]() Registry[T]

type Service

type Service interface {
	Start(ctx context.Context) error
	Close(ctx context.Context) error
}

type ServiceLifeCycleError

type ServiceLifeCycleError struct {
	Err   error
	Stage string
}

func (*ServiceLifeCycleError) Error

func (E *ServiceLifeCycleError) Error() string

func (*ServiceLifeCycleError) Unwrap

func (E *ServiceLifeCycleError) Unwrap() error

Jump to

Keyboard shortcuts

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