devices

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound          = errors.New("device not found")
	ErrConflict          = errors.New("device conflict")
	ErrTransactorMissing = errors.New("device transactor not configured")
)
View Source
var ErrPasswordKeyMissing = errors.New("Wi-Fi password encryption is not configured")

Functions

func GenerateWiFiPassword added in v0.7.0

func GenerateWiFiPassword() (string, error)

func NormalizeMAC added in v0.5.0

func NormalizeMAC(raw string) (string, error)

Types

type DeviceRecord

type DeviceRecord struct {
	Device db.NetworkDevice
	VLAN   db.Vlan
}

type PGXTransactor

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

func NewPGXTransactor

func NewPGXTransactor(pool *pgxpool.Pool) *PGXTransactor

func (*PGXTransactor) InTx

func (t *PGXTransactor) InTx(ctx context.Context, fn func(q Querier) error) error

type PasswordCipher added in v0.7.0

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

PasswordCipher binds each stored password to its immutable device ID.

func NewPasswordCipher added in v0.7.0

func NewPasswordCipher(key []byte) (*PasswordCipher, error)

type Querier

type Querier interface {
	ListNetworkDevices(ctx context.Context) ([]db.ListNetworkDevicesRow, error)
	GetNetworkDeviceByID(ctx context.Context, arg db.GetNetworkDeviceByIDParams) (db.NetworkDevice, error)
	GetNetworkDeviceForUpdate(ctx context.Context, arg db.GetNetworkDeviceForUpdateParams) (db.NetworkDevice, error)
	UpdateNetworkDeviceWiFi(ctx context.Context, arg db.UpdateNetworkDeviceWiFiParams) (db.NetworkDevice, error)
	CreateNetworkDevice(ctx context.Context, arg db.CreateNetworkDeviceParams) (db.NetworkDevice, error)
	UpdateNetworkDevice(ctx context.Context, arg db.UpdateNetworkDeviceParams) (db.NetworkDevice, error)
	DeleteNetworkDevice(ctx context.Context, arg db.DeleteNetworkDeviceParams) error
	GetVlanByVlanID(ctx context.Context, arg db.GetVlanByVlanIDParams) (db.Vlan, error)
	CreateAuditLog(ctx context.Context, arg db.CreateAuditLogParams) (db.AuditLog, error)
}

type RADIUSPolicyRecord added in v0.7.0

type RADIUSPolicyRecord struct {
	MACAddress      string
	VLANID          int32
	PrivatePassword string `json:"-"`
}

RADIUSPolicyRecord is the active authorization policy for one device. PrivatePassword is only for the authenticated RADIUS snapshot formatter.

type Service

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

func NewService

func NewService(queries Querier, tx Transactor, passwordCipher *PasswordCipher) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, actor db.User, input api.NetworkDeviceWrite) (DeviceRecord, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, actor db.User, id uuid.UUID) error

func (*Service) Get

func (s *Service) Get(ctx context.Context, id uuid.UUID) (DeviceRecord, error)

func (*Service) List

func (s *Service) List(ctx context.Context) ([]DeviceRecord, error)

func (*Service) RADIUSPolicy added in v0.7.0

func (s *Service) RADIUSPolicy(ctx context.Context) ([]RADIUSPolicyRecord, error)

func (*Service) RevealWiFiPassword added in v0.7.0

func (s *Service) RevealWiFiPassword(ctx context.Context, actor db.User, id uuid.UUID) (string, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, actor db.User, id uuid.UUID, patch api.NetworkDevicePatch) (DeviceRecord, error)

type Transactor

type Transactor interface {
	InTx(ctx context.Context, fn func(q Querier) error) error
}

type ValidationError

type ValidationError struct {
	Message string
}

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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