Documentation
¶
Index ¶
- func APIAdminCreateClient(db store.IStore) echo.HandlerFunc
- func APIAdminUpdateClient(db store.IStore) echo.HandlerFunc
- func APIAppUserInfo(db store.IStore) echo.HandlerFunc
- func APIConnect(db store.IStore) echo.HandlerFunc
- func APILogin(db store.IStore) echo.HandlerFunc
- func APIStatus(db store.IStore) echo.HandlerFunc
- func AboutPage() echo.HandlerFunc
- func ApplyServerConfig(db store.IStore, tmplDir fs.FS) echo.HandlerFunc
- func BackupSystem() echo.HandlerFunc
- func CheckForUpdates(db store.IStore) echo.HandlerFunc
- func ClearSystemLogs(db store.IStore) echo.HandlerFunc
- func ContentTypeJson(next echo.HandlerFunc) echo.HandlerFunc
- func CreateUser(db store.IStore) echo.HandlerFunc
- func DeleteWakeOnHost(db store.IStore) echo.HandlerFunc
- func DisplaySettingsSubmit(db store.IStore) echo.HandlerFunc
- func DownloadClient(db store.IStore) echo.HandlerFunc
- func EmailClient(db store.IStore, mailer emailer.Emailer, emailSubject, emailContent string) echo.HandlerFunc
- func Favicon() echo.HandlerFunc
- func FlushDNSCache(db store.IStore) echo.HandlerFunc
- func GenerateSystemReport(db store.IStore) echo.HandlerFunc
- func GetClient(db store.IStore) echo.HandlerFunc
- func GetClientQRCode(db store.IStore) echo.HandlerFunc
- func GetClients(db store.IStore) echo.HandlerFunc
- func GetHashesChanges(db store.IStore) echo.HandlerFunc
- func GetOrderedSubnetRanges() echo.HandlerFunc
- func GetSystemLogs(db store.IStore) echo.HandlerFunc
- func GetSystemMetrics() echo.HandlerFunc
- func GetUser(db store.IStore) echo.HandlerFunc
- func GetUsers(db store.IStore) echo.HandlerFunc
- func GetWakeOnLanHosts(db store.IStore) echo.HandlerFunc
- func GlobalSettingSubmit(db store.IStore) echo.HandlerFunc
- func GlobalSettings(db store.IStore) echo.HandlerFunc
- func Health() echo.HandlerFunc
- func InternalOnly(next echo.HandlerFunc) echo.HandlerFunc
- func LoadProfile(db store.IStore) echo.HandlerFunc
- func Login(db store.IStore) echo.HandlerFunc
- func LoginPage() echo.HandlerFunc
- func Logout() echo.HandlerFunc
- func MachineIPAddresses() echo.HandlerFunc
- func NeedsAdmin(next echo.HandlerFunc) echo.HandlerFunc
- func NewClient(db store.IStore) echo.HandlerFunc
- func RefreshSession(next echo.HandlerFunc) echo.HandlerFunc
- func RemoveClient(db store.IStore) echo.HandlerFunc
- func RemoveUser(db store.IStore) echo.HandlerFunc
- func RestartWireGuardService(db store.IStore) echo.HandlerFunc
- func RestoreSystem(db store.IStore) echo.HandlerFunc
- func SaveWakeOnLanHost(db store.IStore) echo.HandlerFunc
- func SendTelegramClient(db store.IStore) echo.HandlerFunc
- func SetClientStatus(db store.IStore) echo.HandlerFunc
- func StartQuotaChecker(db store.IStore, tmplDir fs.FS)
- func StaticHandler(next echo.HandlerFunc) echo.HandlerFunc
- func Status(db store.IStore) echo.HandlerFunc
- func StatusData(db store.IStore) echo.HandlerFunc
- func SuggestIPAllocation(db store.IStore) echo.HandlerFunc
- func SystemMonitorPage() echo.HandlerFunc
- func TerminateClient(db store.IStore, tmplDir fs.FS) echo.HandlerFunc
- func UpdateClient(db store.IStore) echo.HandlerFunc
- func UpdateUser(db store.IStore) echo.HandlerFunc
- func UsersSettings(db store.IStore) echo.HandlerFunc
- func UtilitiesPage(db store.IStore) echo.HandlerFunc
- func ValidSession(next echo.HandlerFunc) echo.HandlerFunc
- func WakeOnHost(db store.IStore) echo.HandlerFunc
- func WireGuardClients(db store.IStore) echo.HandlerFunc
- func WireGuardServer(db store.IStore) echo.HandlerFunc
- func WireGuardServerInterfaces(db store.IStore) echo.HandlerFunc
- func WireGuardServerKeyPair(db store.IStore) echo.HandlerFunc
- type APIConnectResponse
- type APILoginResponse
- type APIRequest
- type APIStatusResponse
- type AdminCreateClientRequest
- type AdminCreateClientResponse
- type AdminUpdateClientRequest
- type AdminUpdateClientResponse
- type AppUserInfoRequest
- type AppUserInfoResponse
- type DeviceVM
- type PeerVM
- type Route
- type SystemMetrics
- type WakeOnLanHostSavePayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIAdminCreateClient ¶
func APIAdminCreateClient(db store.IStore) echo.HandlerFunc
APIAdminCreateClient handles POST /api/v1/admin/create-client
func APIAdminUpdateClient ¶
func APIAdminUpdateClient(db store.IStore) echo.HandlerFunc
APIAdminUpdateClient handles POST /api/v1/admin/update-client
func APIAppUserInfo ¶
func APIAppUserInfo(db store.IStore) echo.HandlerFunc
APIAppUserInfo handles POST /api/v1/app/user-info
func APIConnect ¶
func APIConnect(db store.IStore) echo.HandlerFunc
APIConnect handles POST /api/v1/connect
func APIStatus ¶
func APIStatus(db store.IStore) echo.HandlerFunc
APIStatus handles POST /api/v1/status
func ApplyServerConfig ¶
ApplyServerConfig handler to write config file and restart Wireguard server
func BackupSystem ¶
func BackupSystem() echo.HandlerFunc
BackupSystem creates a backup of the database and WireGuard configuration
func CheckForUpdates ¶
func CheckForUpdates(db store.IStore) echo.HandlerFunc
CheckForUpdates checks for system updates
func ClearSystemLogs ¶
func ClearSystemLogs(db store.IStore) echo.HandlerFunc
ClearSystemLogs clears system logs
func ContentTypeJson ¶
func ContentTypeJson(next echo.HandlerFunc) echo.HandlerFunc
ContentTypeJson checks that the requests have the Content-Type header set to "application/json". This helps against CSRF attacks.
func DeleteWakeOnHost ¶
func DeleteWakeOnHost(db store.IStore) echo.HandlerFunc
func DisplaySettingsSubmit ¶
func DisplaySettingsSubmit(db store.IStore) echo.HandlerFunc
DisplaySettingsSubmit handler to update display settings
func EmailClient ¶
func EmailClient(db store.IStore, mailer emailer.Emailer, emailSubject, emailContent string) echo.HandlerFunc
EmailClient handler to send the configuration via email
func Favicon ¶
func Favicon() echo.HandlerFunc
func FlushDNSCache ¶
func FlushDNSCache(db store.IStore) echo.HandlerFunc
FlushDNSCache flushes the system DNS cache
func GenerateSystemReport ¶
func GenerateSystemReport(db store.IStore) echo.HandlerFunc
GenerateSystemReport generates a system report
func GetClient ¶
func GetClient(db store.IStore) echo.HandlerFunc
GetClient handler returns a JSON object of Wireguard client data
func GetClientQRCode ¶
func GetClientQRCode(db store.IStore) echo.HandlerFunc
GetClientQRCode handler returns QR code image for a client
func GetClients ¶
func GetClients(db store.IStore) echo.HandlerFunc
GetClients handler return a JSON list of Wireguard client data
func GetHashesChanges ¶
func GetHashesChanges(db store.IStore) echo.HandlerFunc
GetHashesChanges handler returns if database hashes have changed
func GetOrderedSubnetRanges ¶
func GetOrderedSubnetRanges() echo.HandlerFunc
GetOrderedSubnetRanges handler to get the ordered list of subnet ranges
func GetSystemLogs ¶
func GetSystemLogs(db store.IStore) echo.HandlerFunc
GetSystemLogs retrieves system logs
func GetSystemMetrics ¶
func GetSystemMetrics() echo.HandlerFunc
هندلری که اطلاعات سیستمی را در قالب JSON برمیگرداند
func GetUser ¶
func GetUser(db store.IStore) echo.HandlerFunc
GetUser handler returns a JSON object of single user
func GetUsers ¶
func GetUsers(db store.IStore) echo.HandlerFunc
GetUsers handler return a JSON list of all users
func GetWakeOnLanHosts ¶
func GetWakeOnLanHosts(db store.IStore) echo.HandlerFunc
func GlobalSettingSubmit ¶
func GlobalSettingSubmit(db store.IStore) echo.HandlerFunc
GlobalSettingSubmit handler to update the global settings
func InternalOnly ¶
func InternalOnly(next echo.HandlerFunc) echo.HandlerFunc
InternalOnly middleware to ensure request is from localhost
func LoadProfile ¶
func LoadProfile(db store.IStore) echo.HandlerFunc
LoadProfile to load user information
func MachineIPAddresses ¶
func MachineIPAddresses() echo.HandlerFunc
MachineIPAddresses handler to get local interface ip addresses
func NeedsAdmin ¶
func NeedsAdmin(next echo.HandlerFunc) echo.HandlerFunc
func RefreshSession ¶
func RefreshSession(next echo.HandlerFunc) echo.HandlerFunc
RefreshSession must only be used after ValidSession middleware RefreshSession checks if the session is eligible for the refresh, but doesn't check if it's fully valid
func RestartWireGuardService ¶
func RestartWireGuardService(db store.IStore) echo.HandlerFunc
RestartWireGuardService restarts the WireGuard service
func RestoreSystem ¶
func RestoreSystem(db store.IStore) echo.HandlerFunc
RestoreSystem restores the database and WireGuard configuration from a backup
func SaveWakeOnLanHost ¶
func SaveWakeOnLanHost(db store.IStore) echo.HandlerFunc
func SendTelegramClient ¶
func SendTelegramClient(db store.IStore) echo.HandlerFunc
SendTelegramClient handler to send the configuration via Telegram
func SetClientStatus ¶
func SetClientStatus(db store.IStore) echo.HandlerFunc
SetClientStatus handler to enable / disable a client
func StartQuotaChecker ¶
StartQuotaChecker starts a goroutine that periodically checks client quotas and expiration dates
func StaticHandler ¶
func StaticHandler(next echo.HandlerFunc) echo.HandlerFunc
StaticHandler handles serving static files with proper MIME types
func Status ¶
func Status(db store.IStore) echo.HandlerFunc
Status handler to show wireguard connection status
func StatusData ¶
func StatusData(db store.IStore) echo.HandlerFunc
StatusData handler to return JSON status data for clients
func SuggestIPAllocation ¶
func SuggestIPAllocation(db store.IStore) echo.HandlerFunc
SuggestIPAllocation handler to get the list of ip address for client
func SystemMonitorPage ¶
func SystemMonitorPage() echo.HandlerFunc
هندلری برای رندر صفحهٔ مانیتورینگ سیستم
func TerminateClient ¶
TerminateClient handler to terminate a client connection
func UpdateClient ¶
func UpdateClient(db store.IStore) echo.HandlerFunc
UpdateClient handler to update client information
func UpdateUser ¶
func UpdateUser(db store.IStore) echo.HandlerFunc
UpdateUser to update user information
func UtilitiesPage ¶
func UtilitiesPage(db store.IStore) echo.HandlerFunc
UtilitiesPage handles the utilities page request
func ValidSession ¶
func ValidSession(next echo.HandlerFunc) echo.HandlerFunc
func WakeOnHost ¶
func WakeOnHost(db store.IStore) echo.HandlerFunc
func WireGuardClients ¶
func WireGuardClients(db store.IStore) echo.HandlerFunc
WireGuardClients handler
func WireGuardServer ¶
func WireGuardServer(db store.IStore) echo.HandlerFunc
WireGuardServer handler
func WireGuardServerInterfaces ¶
func WireGuardServerInterfaces(db store.IStore) echo.HandlerFunc
WireGuardServerInterfaces handler
func WireGuardServerKeyPair ¶
func WireGuardServerKeyPair(db store.IStore) echo.HandlerFunc
WireGuardServerKeyPair handler to generate private and public keys
Types ¶
type APIConnectResponse ¶
type APIConnectResponse struct {
Config string `json:"config"`
}
APIConnectResponse represents the response for connect endpoint
type APILoginResponse ¶
type APILoginResponse struct {
Status string `json:"status"`
Token string `json:"token"`
ExpireAt time.Time `json:"expire_at"`
TotalTraffic int64 `json:"total_traffic"`
RemainingTraffic int64 `json:"remaining_traffic"`
}
APILoginResponse represents the response for login endpoint
type APIRequest ¶
type APIRequest struct {
Username string `json:"username"`
Password string `json:"password"`
Token string `json:"token"`
}
APIRequest represents a generic API request
type APIStatusResponse ¶
type APIStatusResponse struct {
Status string `json:"status"`
TotalTraffic int64 `json:"total_traffic"`
UsedTraffic int64 `json:"used_traffic"`
RemainingTraffic int64 `json:"remaining_traffic"`
ExpireAt time.Time `json:"expire_at"`
Expired bool `json:"expired"`
}
APIStatusResponse represents the response for status endpoint
type AdminCreateClientRequest ¶
type AdminCreateClientRequest struct {
Username string `json:"username"`
Email string `json:"email"`
Token string `json:"token"`
Expiration string `json:"expiration,omitempty"` // Optional RFC3339 format (e.g., "2024-12-05T15:00:00Z")
}
AdminCreateClientRequest represents the request for admin create client endpoint
type AdminCreateClientResponse ¶
type AdminCreateClientResponse struct {
Status string `json:"status"`
Config string `json:"config"`
}
AdminCreateClientResponse represents the response for admin create client endpoint
type AdminUpdateClientRequest ¶
type AdminUpdateClientRequest struct {
Username string `json:"username"`
AddDays int `json:"add_days"`
ResetQuota bool `json:"reset_quota"`
Enable *bool `json:"enable,omitempty"` // Optional: explicitly enable/disable client
Token string `json:"token"`
}
AdminUpdateClientRequest represents the request for admin update client endpoint
type AdminUpdateClientResponse ¶
type AdminUpdateClientResponse struct {
Status string `json:"status"`
NewExpiration time.Time `json:"new_expiration"`
Message string `json:"message"`
}
AdminUpdateClientResponse represents the response for admin update client endpoint
type AppUserInfoRequest ¶
type AppUserInfoRequest struct {
Username string `json:"username"`
}
AppUserInfoRequest represents the request for mobile app user info endpoint
type AppUserInfoResponse ¶
type AppUserInfoResponse struct {
Status string `json:"status"`
PeerFound bool `json:"peer_found"`
IsExpired bool `json:"is_expired"`
IsOverQuota bool `json:"is_over_quota"`
QuotaRemaining int64 `json:"quota_remaining"`
ExpirationDate time.Time `json:"expiration_date"`
Config string `json:"config,omitempty"`
Message string `json:"message,omitempty"`
}
AppUserInfoResponse represents the response for the mobile app user info endpoint
type PeerVM ¶
type PeerVM struct {
PublicKey string
Name string
Email string
AllocatedIP string
Endpoint string
ReceivedBytes int64
TransmitBytes int64
LastHandshakeTime time.Time
LastHandshakeRel time.Duration
Connected bool
}
PeerVM view model
type Route ¶
type Route struct {
Method string
Path string
Handler func(store.IStore) echo.HandlerFunc
Middleware []echo.MiddlewareFunc
}
Route represents an internal API route
func GetInternalRoutes ¶
func GetInternalRoutes() []Route
GetInternalRoutes returns the list of internal routes
type SystemMetrics ¶
type SystemMetrics struct {
CPU struct {
Usage float64 `json:"usage"`
Cores int `json:"cores"`
} `json:"cpu"`
RAM struct {
Total uint64 `json:"total"`
Used uint64 `json:"used"`
Usage float64 `json:"usage"`
} `json:"ram"`
Swap struct {
Total uint64 `json:"total"`
Used uint64 `json:"used"`
Usage float64 `json:"usage"`
} `json:"swap"`
Disk struct {
Total uint64 `json:"total"`
Used uint64 `json:"used"`
Usage float64 `json:"usage"`
} `json:"disk"`
Network struct {
UploadSpeed float64 `json:"uploadSpeed"` // KB/s
DownloadSpeed float64 `json:"downloadSpeed"` // KB/s
TotalOut uint64 `json:"totalOut"` // MB
TotalIn uint64 `json:"totalIn"` // MB
} `json:"network"`
SystemLoad string `json:"systemLoad"`
Uptime string `json:"uptime"`
}
ساختار پاسخ JSON برای متریکهای سیستمی