storage

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	ID          int64     `json:"-"`
	Domain      string    `json:"domain"`
	Certificate []byte    `json:"certificate"`
	PrivateKey  []byte    `json:"private_key"`
	IssuerCert  []byte    `json:"issuer_cert,omitempty"`
	NotBefore   time.Time `json:"not_before"`
	NotAfter    time.Time `json:"not_after"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Certificate represents a stored TLS certificate

func (Certificate) GetTLSCertificate

func (c Certificate) GetTLSCertificate() (cert tls.Certificate, err error)

GetTLSCertificate returns the tls.Certificate from the Certificate resource

type LECredentials

type LECredentials struct {
	ID        int64     `json:"-"`
	Email     string    `json:"email"`
	KeyType   string    `json:"key_type"`
	Key       []byte    `json:"key"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

LECredentials represents stored Let's Encrypt credentials

type Storage

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

Storage handles certificate and credential persistence

func NewStorage

func NewStorage(dbPath string) (*Storage, error)

NewStorage creates a new storage instance

func (*Storage) GetCertificate

func (s *Storage) GetCertificate(ctx context.Context, domain string) (*Certificate, error)

GetCertificate retrieves a certificate by domain

func (*Storage) GetExpiringCertificates

func (s *Storage) GetExpiringCertificates(ctx context.Context, days int) ([]*Certificate, error)

GetExpiringCertificates retrieves certificates expiring within the specified days

func (*Storage) GetLECredentials

func (s *Storage) GetLECredentials(ctx context.Context, email string) (*LECredentials, error)

GetLECredentials retrieves Let's Encrypt credentials by email

func (*Storage) Init

func (s *Storage) Init(ctx context.Context) error

func (*Storage) Run

func (s *Storage) Run(ctx context.Context) error

func (*Storage) SaveCertificate

func (s *Storage) SaveCertificate(ctx context.Context, cert *Certificate) error

SaveCertificate saves or updates a certificate

func (*Storage) SaveLECredentials

func (s *Storage) SaveLECredentials(ctx context.Context, creds *LECredentials) error

SaveLECredentials saves or updates Let's Encrypt credentials

func (*Storage) TSNetStorage

func (s *Storage) TSNetStorage() *TSNetStorage

type TSNetStorage

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

func (*TSNetStorage) All

func (t *TSNetStorage) All() iter.Seq2[ipn.StateKey, []byte]

All implements the ipn.ExportableStore interface and returns an iterator over all store keys.

func (*TSNetStorage) ReadState

func (t *TSNetStorage) ReadState(id ipn.StateKey) ([]byte, error)

ReadState implements the ipn.StateStore interface.

func (*TSNetStorage) WriteState

func (t *TSNetStorage) WriteState(id ipn.StateKey, bs []byte) error

WriteState implements the ipn.StateStore interface.

Jump to

Keyboard shortcuts

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