Documentation ¶
Index ¶
- Variables
- func BuildClientConfig(client model.Client, server model.Server, setting model.GlobalSetting) string
- func DBConn() (*scribble.Driver, error)
- func GetAllocatedIPs(ignoreClientID string) ([]string, error)
- func GetAvailableIP(cidr string, allocatedList []string) (string, error)
- func GetBroadcastIP(n *net.IPNet) net.IP
- func GetClientByID(clientID string, hasQRCode bool) (model.ClientData, error)
- func GetClients(hasQRCode bool) ([]model.ClientData, error)
- func GetGlobalSettings() (model.GlobalSetting, error)
- func GetIPFromCIDR(cidr string) (string, error)
- func GetInterfaceIPs() ([]model.Interface, error)
- func GetPublicIP() (model.Interface, error)
- func GetServer() (model.Server, error)
- func GetUser() (model.User, error)
- func InitDB() error
- func ValidateAllowedIPs(cidrs []string) bool
- func ValidateCIDR(cidr string) bool
- func ValidateCIDRList(cidrs []string) bool
- func ValidateIPAddress(ip string) bool
- func ValidateIPAddressList(ips []string) bool
- func ValidateIPAllocation(serverAddresses []string, ipAllocatedList []string, ipAllocationList []string) (bool, error)
- func ValidateServerAddresses(cidrs []string) bool
- func WriteWireGuardServerConfig(tmplBox *rice.Box, serverConfig model.Server, ...) error
Constants ¶
This section is empty.
Variables ¶
var ( DisableLogin bool BindAddress string SendgridApiKey string EmailFrom string EmailFromName string EmailSubject string EmailContent string SessionSecret []byte )
Runtime config
Functions ¶
func BuildClientConfig ¶
func BuildClientConfig(client model.Client, server model.Server, setting model.GlobalSetting) string
BuildClientConfig to create wireguard client config string
func GetAllocatedIPs ¶
GetAllocatedIPs to get all ip addresses allocated to clients and server
func GetAvailableIP ¶
GetAvailableIP get the ip address that can be allocated from an CIDR
func GetBroadcastIP ¶
GetBroadcastIP func to get the broadcast ip address of a network
func GetClientByID ¶
func GetClientByID(clientID string, hasQRCode bool) (model.ClientData, error)
GetClientByID func to query a client from the database
func GetClients ¶
func GetClients(hasQRCode bool) ([]model.ClientData, error)
GetClients to get all clients from the database
func GetGlobalSettings ¶
func GetGlobalSettings() (model.GlobalSetting, error)
GetGlobalSettings func to query global settings from the database
func GetInterfaceIPs ¶
GetInterfaceIPs to get local machine's interface ip addresses
func GetPublicIP ¶
GetPublicIP to get machine's public ip address
func ValidateAllowedIPs ¶
ValidateAllowedIPs to validate allowed ip addresses in CIDR format
func ValidateCIDRList ¶
ValidateCIDRList to validate a list of network CIDR
func ValidateIPAddress ¶
ValidateIPAddress to validate the IPv4 and IPv6 address
func ValidateIPAddressList ¶
ValidateIPAddressList to validate a list of IPv4 and IPv6 addresses
func ValidateIPAllocation ¶
func ValidateIPAllocation(serverAddresses []string, ipAllocatedList []string, ipAllocationList []string) (bool, error)
ValidateIPAllocation to validate the list of client's ip allocation They must have a correct format and available in serverAddresses space
func ValidateServerAddresses ¶
ValidateServerAddresses to validate allowed ip addresses in CIDR format
func WriteWireGuardServerConfig ¶
func WriteWireGuardServerConfig(tmplBox *rice.Box, serverConfig model.Server, clientDataList []model.ClientData, globalSettings model.GlobalSetting) error
WriteWireGuardServerConfig to write Wireguard server config. e.g. wg0.conf
Types ¶
This section is empty.