handler

package
v0.0.0-...-73d7af2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIStatus

func APIStatus(db store.IStore) echo.HandlerFunc

APIStatus returns the current WireGuard status as JSON. This handler is intended to be polled via AJAX to update the VPN status table dynamically.

func ApplyServerConfig

func ApplyServerConfig(db store.IStore, tmplDir fs.FS) echo.HandlerFunc

ApplyServerConfig handler writes the config file and restarts the WireGuard server.

func ContentTypeJson

func ContentTypeJson(next echo.HandlerFunc) echo.HandlerFunc

ContentTypeJson is middleware that ensures the request's Content-Type header starts with "application/json". This helps mitigate CSRF attacks by rejecting requests that do not explicitly signal a JSON payload.

func CreateUser

func CreateUser(db store.IStore) echo.HandlerFunc

CreateUser handler creates a new user.

func DownloadClient

func DownloadClient(db store.IStore) echo.HandlerFunc

DownloadClient handler streams the client configuration for download.

func EmailClient

func EmailClient(db store.IStore, mailer emailer.Emailer, emailSubject, emailContent string) echo.HandlerFunc

EmailClient handler sends the configuration via email.

func Favicon

func Favicon() echo.HandlerFunc

func GetClient

func GetClient(db store.IStore) echo.HandlerFunc

GetClient handler returns a JSON object of WireGuard client data.

func GetClients

func GetClients(db store.IStore) echo.HandlerFunc

GetClients handler returns 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 returns the ordered list of subnet ranges.

func GetUser

func GetUser(db store.IStore) echo.HandlerFunc

GetUser handler returns a JSON object of a single user.

func GetUsers

func GetUsers(db store.IStore) echo.HandlerFunc

GetUsers handler returns a JSON list of all users.

func GlobalSettingSubmit

func GlobalSettingSubmit(db store.IStore) echo.HandlerFunc

GlobalSettingSubmit handler updates the global settings.

func GlobalSettings

func GlobalSettings(db store.IStore) echo.HandlerFunc

GlobalSettings handler renders the global settings page.

func Health

func Health() echo.HandlerFunc

Health check handler

func LoadProfile

func LoadProfile() echo.HandlerFunc

LoadProfile handler to load user profile information.

func Login

func Login(db store.IStore) echo.HandlerFunc

Login handler for signing in.

func LoginPage

func LoginPage() echo.HandlerFunc

LoginPage handler renders the login page.

func Logout

func Logout() echo.HandlerFunc

Logout handler logs a user out.

func MachineIPAddresses

func MachineIPAddresses() echo.HandlerFunc

MachineIPAddresses handler returns local and public interface IP addresses.

func NeedsAdmin

func NeedsAdmin(next echo.HandlerFunc) echo.HandlerFunc

NeedsAdmin middleware ensures that only admin users proceed.

func NewClient

func NewClient(db store.IStore) echo.HandlerFunc

NewClient handler creates a new WireGuard client.

func RefreshSession

func RefreshSession(next echo.HandlerFunc) echo.HandlerFunc

RefreshSession middleware refreshes a "remember me" session. This should be used after ValidSession has verified the session.

func RemoveClient

func RemoveClient(db store.IStore) echo.HandlerFunc

RemoveClient handler deletes a WireGuard client.

func RemoveUser

func RemoveUser(db store.IStore) echo.HandlerFunc

RemoveUser handler deletes a user.

func SetClientStatus

func SetClientStatus(db store.IStore) echo.HandlerFunc

SetClientStatus handler enables/disables a client.

func Status

func Status(db store.IStore) echo.HandlerFunc

Status renders the HTML page for VPN status.

func SuggestIPAllocation

func SuggestIPAllocation(db store.IStore) echo.HandlerFunc

SuggestIPAllocation handler returns a list of suggested IP addresses.

func UpdateClient

func UpdateClient(db store.IStore) echo.HandlerFunc

UpdateClient handler updates client information.

func UpdateUser

func UpdateUser(db store.IStore) echo.HandlerFunc

UpdateUser handler updates user information.

func UsersSettings

func UsersSettings() echo.HandlerFunc

UsersSettings handler renders the users settings page.

func ValidSession

func ValidSession(next echo.HandlerFunc) echo.HandlerFunc

ValidSession is middleware that checks for a valid session. If the session is invalid, it redirects the user to the login page.

func WireGuardClients

func WireGuardClients(db store.IStore) echo.HandlerFunc

WireGuardClients handler renders the WireGuard clients page.

func WireGuardServer

func WireGuardServer(db store.IStore) echo.HandlerFunc

WireGuardServer handler renders the WireGuard server page.

func WireGuardServerInterfaces

func WireGuardServerInterfaces(db store.IStore) echo.HandlerFunc

WireGuardServerInterfaces handler updates server interface settings.

func WireGuardServerKeyPair

func WireGuardServerKeyPair(db store.IStore) echo.HandlerFunc

WireGuardServerKeyPair handler generates a new WireGuard key pair.

Types

This section is empty.

Jump to

Keyboard shortcuts

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