store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrChallengeNotFound = errors.New("acme challenge not found")
View Source
var ErrDeviceNotFound = errors.New("device not found")
View Source
var ErrDuplicateEK = errors.New("duplicate ek fingerprint")
View Source
var ErrDuplicateHostname = errors.New("hostname already taken")
View Source
var ErrDuplicateSlug = errors.New("duplicate slug")
View Source
var ErrNexusNotFound = errors.New("nexus instance not found")

Functions

This section is empty.

Types

type ACMEStore

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

func NewACMEStore

func NewACMEStore(pool *pgxpool.Pool) *ACMEStore

func (*ACMEStore) Create

func (s *ACMEStore) Create(ctx context.Context, c *model.ACMEChallenge) error

func (*ACMEStore) Delete

func (s *ACMEStore) Delete(ctx context.Context, id uuid.UUID) error

func (*ACMEStore) GetByID

func (s *ACMEStore) GetByID(ctx context.Context, id uuid.UUID) (*model.ACMEChallenge, error)

func (*ACMEStore) GetExpired

func (s *ACMEStore) GetExpired(ctx context.Context) ([]*model.ACMEChallenge, error)

type AuditStore

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

func NewAuditStore

func NewAuditStore(pool *pgxpool.Pool) *AuditStore

func (*AuditStore) DeleteOlderThan

func (s *AuditStore) DeleteOlderThan(ctx context.Context, days int) (int64, error)

func (*AuditStore) Log

func (s *AuditStore) Log(ctx context.Context, entry *model.AuditEntry) error

func (*AuditStore) LogAction

func (s *AuditStore) LogAction(ctx context.Context, actorType model.ActorType, actorID, action, resourceType string, resourceID *string, details any, ip net.IP)

type DeviceStore

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

func NewDeviceStore

func NewDeviceStore(pool *pgxpool.Pool) *DeviceStore

func (*DeviceStore) CleanupReleasedHostnames

func (s *DeviceStore) CleanupReleasedHostnames(ctx context.Context, maxAgeDays int) (int64, error)

func (*DeviceStore) Create

func (s *DeviceStore) Create(ctx context.Context, d *model.Device) error

func (*DeviceStore) Delete

func (s *DeviceStore) Delete(ctx context.Context, id uuid.UUID) error

func (*DeviceStore) GetByEKFingerprint

func (s *DeviceStore) GetByEKFingerprint(ctx context.Context, fingerprint string) (*model.Device, error)

func (*DeviceStore) GetByID

func (s *DeviceStore) GetByID(ctx context.Context, id uuid.UUID) (*model.Device, error)

func (*DeviceStore) IsHostnameReleased

func (s *DeviceStore) IsHostnameReleased(ctx context.Context, label string, cooldownDays int) (bool, error)

func (*DeviceStore) IsLabelTaken

func (s *DeviceStore) IsLabelTaken(ctx context.Context, label string) (bool, error)

func (*DeviceStore) ReleaseHostname

func (s *DeviceStore) ReleaseHostname(ctx context.Context, label string, deviceID uuid.UUID) error

func (*DeviceStore) SetCustomHostname

func (s *DeviceStore) SetCustomHostname(ctx context.Context, p SetCustomHostnameParams) error

func (*DeviceStore) UpdateAKPublicKey

func (s *DeviceStore) UpdateAKPublicKey(ctx context.Context, id uuid.UUID, akPub []byte) error

func (*DeviceStore) UpdateLastSeen

func (s *DeviceStore) UpdateLastSeen(ctx context.Context, id uuid.UUID, ip net.IP) error

func (*DeviceStore) UpdateStatus

func (s *DeviceStore) UpdateStatus(ctx context.Context, id uuid.UUID, status model.DeviceStatus) error

type NexusStore

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

func NewNexusStore

func NewNexusStore(pool *pgxpool.Pool) *NexusStore

func (*NexusStore) GetByHostname

func (s *NexusStore) GetByHostname(ctx context.Context, hostname string) (*model.NexusInstance, error)

func (*NexusStore) ListActive

func (s *NexusStore) ListActive(ctx context.Context) ([]*model.NexusInstance, error)

func (*NexusStore) MarkInactive

func (s *NexusStore) MarkInactive(ctx context.Context, thresholdSeconds int) ([]uuid.UUID, error)

func (*NexusStore) UpdateResolvedAddresses

func (s *NexusStore) UpdateResolvedAddresses(ctx context.Context, id uuid.UUID, addrs []net.IP) error

func (*NexusStore) Upsert

func (s *NexusStore) Upsert(ctx context.Context, n *model.NexusInstance) error

type SetCustomHostnameParams

type SetCustomHostnameParams struct {
	DeviceID       uuid.UUID
	CustomHostname string
	ChangeCount    int
	HostnameYear   int
}

type Stores

type Stores struct {
	Device *DeviceStore
	Nexus  *NexusStore
	ACME   *ACMEStore
	Audit  *AuditStore
}

func New

func New(pool *pgxpool.Pool) *Stores

Jump to

Keyboard shortcuts

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