resources

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountsHandler

func AccountsHandler(deps AccountsDeps) func(string, json.RawMessage) (interface{}, int, error)

AccountsHandler creates a handler for /admin/accounts.

func DNSCacheHandler

func DNSCacheHandler(deps DNSCacheDeps) func(string, json.RawMessage) (interface{}, int, error)

DNSCacheHandler creates a handler for /admin/dns.

func IrohHandler

func IrohHandler(deps SettingsToggleDeps) func(string, json.RawMessage) (interface{}, int, error)

IrohHandler creates a handler for /admin/services/iroh.

func JitRegistrationHandler

func JitRegistrationHandler(deps SettingsToggleDeps) func(string, json.RawMessage) (interface{}, int, error)

JitRegistrationHandler creates a handler for /admin/registration/jit.

func QueueHandler

func QueueHandler(deps QueueDeps) func(string, json.RawMessage) (interface{}, int, error)

QueueHandler creates a handler for /admin/queue.

func QuotaHandler

func QuotaHandler(deps QuotaDeps) func(string, json.RawMessage) (interface{}, int, error)

QuotaHandler creates a handler for /admin/quota.

func RegistrationHandler

func RegistrationHandler(deps SettingsToggleDeps) func(string, json.RawMessage) (interface{}, int, error)

RegistrationHandler creates a handler for /admin/registration.

func ShadowsocksHandler

func ShadowsocksHandler(deps SettingsToggleDeps) func(string, json.RawMessage) (interface{}, int, error)

ShadowsocksHandler creates a handler for /admin/services/shadowsocks.

func SharesHandler

func SharesHandler(deps SharesDeps) func(string, json.RawMessage) (interface{}, int, error)

SharesHandler creates a handler for /admin/shares.

func StatusHandler

func StatusHandler(deps StatusDeps) func(method string, body json.RawMessage) (interface{}, int, error)

StatusHandler creates a handler for /admin/status.

func StorageHandler

func StorageHandler(deps StorageDeps) func(method string, body json.RawMessage) (interface{}, int, error)

StorageHandler creates a handler for /admin/storage.

func TurnHandler

func TurnHandler(deps SettingsToggleDeps) func(string, json.RawMessage) (interface{}, int, error)

TurnHandler creates a handler for /admin/services/turn.

Types

type AccountsDeps

type AccountsDeps struct {
	AuthDB  module.PlainUserDB
	Storage module.ManageableStorage
}

AccountsDeps are the dependencies needed by the accounts resource handler.

type DNSCacheDeps

type DNSCacheDeps struct {
	DB *gorm.DB
}

DNSCacheDeps are the dependencies needed by the DNS cache handler.

type DatabaseInfo

type DatabaseInfo struct {
	Driver    string `json:"driver"`
	SizeBytes int64  `json:"size_bytes"`
}

type DiskInfo

type DiskInfo struct {
	TotalBytes     uint64  `json:"total_bytes"`
	UsedBytes      uint64  `json:"used_bytes"`
	AvailableBytes uint64  `json:"available_bytes"`
	PercentUsed    float64 `json:"percent_used"`
}

type EmailServers

type EmailServers struct {
	ConnectionIPs int `json:"connection_ips"`
	DomainServers int `json:"domain_servers"`
	IPServers     int `json:"ip_servers"`
}

type QueueDeps

type QueueDeps struct {
	Storage module.ManageableStorage
}

QueueDeps are the dependencies needed by the queue resource handler.

type QuotaDeps

type QuotaDeps struct {
	Storage module.ManageableStorage
}

QuotaDeps are the dependencies needed by the quota resource handler.

type ServiceStatus

type ServiceStatus struct {
	Connections int `json:"connections"`
	UniqueIPs   int `json:"unique_ips"`
}

type SettingsToggleDeps

type SettingsToggleDeps struct {
	IsRegistrationOpen        func() (bool, error)
	SetRegistrationOpen       func(bool) error
	IsJitRegistrationEnabled  func() (bool, error)
	SetJitRegistrationEnabled func(bool) error
	IsTurnEnabled             func() (bool, error)
	SetTurnEnabled            func(bool) error
	// Iroh and Shadowsocks are new DB-backed settings
	GetSetting func(key string) (string, bool, error)
	SetSetting func(key, value string) error
}

SettingsToggleDeps provides methods to read/write settings flags.

type SharesDeps

type SharesDeps struct {
	DB *gorm.DB
}

SharesDeps are the dependencies needed by the shares resource handler.

type StateDirInfo

type StateDirInfo struct {
	Path      string `json:"path"`
	SizeBytes int64  `json:"size_bytes"`
}

type StatusDeps

type StatusDeps struct {
	GetUserCount func() (int, error)
}

StatusDeps are the dependencies needed by the status resource handler.

type StatusResponse

type StatusResponse struct {
	IMAP         *ServiceStatus `json:"imap,omitempty"`
	TURN         *TurnStatus    `json:"turn,omitempty"`
	Shadowsocks  *ServiceStatus `json:"shadowsocks,omitempty"`
	Users        *UsersStatus   `json:"users"`
	Uptime       *UptimeStatus  `json:"uptime"`
	EmailServers *EmailServers  `json:"email_servers,omitempty"`
}

StatusResponse is the response body for /admin/status.

type StorageDeps

type StorageDeps struct {
	StateDir string
	DBDriver string
	DBDSN    string
}

StorageDeps are the dependencies needed by the storage resource handler.

type StorageResponse

type StorageResponse struct {
	Disk     *DiskInfo     `json:"disk"`
	StateDir *StateDirInfo `json:"state_dir"`
	Database *DatabaseInfo `json:"database,omitempty"`
}

StorageResponse is the response body for /admin/storage.

type TurnStatus

type TurnStatus struct {
	Relays int `json:"relays"`
}

type UptimeStatus

type UptimeStatus struct {
	BootTime string `json:"boot_time"`
	Duration string `json:"duration"`
}

type UsersStatus

type UsersStatus struct {
	Registered int `json:"registered"`
}

Jump to

Keyboard shortcuts

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