core

package
v0.0.0-...-2922ab5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CreateLock sync.Mutex
)
View Source
var StatusCache *cache.Cache = cache.New((1 * time.Minute), (1 * time.Minute))

Functions

func ActivateAccount

func ActivateAccount(id string) (*model.Account, error)

ActivateAccount when joining

func AuthFromContext

func AuthFromContext(c *gin.Context, id string) (*model.Account, interface{}, error)

AuthFromContext takes the gin context, the id from the request and the account and object used to find the account, along with any error.

Example: account, device, err := GetFromContext(c, id)

func CreateAccount

func CreateAccount(account *model.Account) (*model.Account, error)

CreateAccount with all necessary data

func CreateDevice

func CreateDevice(device *model.Device) (*model.Device, error)

CreateDevice device with all necessary data

func CreateNet

func CreateNet(net *model.Network) (*model.Network, error)

CreateNet net with all necessary data

func CreateService

func CreateService(service *model.Service) (*model.Service, error)

CreateService service with all necessary data

func CreateSubscription

func CreateSubscription(service *model.Subscription) (*model.Subscription, error)

CreateSubscription all necessary data

func CreateUser

func CreateUser(user *model.User) (*model.User, error)

CreateUser user with all necessary data

func CreateVPN

func CreateVPN(vpn *model.VPN) (*model.VPN, error)

CreateVPN vpn with all necessary data

func DeleteAccount

func DeleteAccount(id string) error

DeleteAccount from mongo

func DeleteDevice

func DeleteDevice(id string) error

DeleteDevice from database

func DeleteNet

func DeleteNet(id string) error

DeleteNet from database

func DeleteService

func DeleteService(id string) error

DeleteService from database

func DeleteSubscription

func DeleteSubscription(id string) error

DeleteSubscription by id

func DeleteUser

func DeleteUser(id string) error

DeleteUser from database

func DeleteVPN

func DeleteVPN(id string) error

DeleteVPN from database

func Email

func Email(id string) error

func EmailUser

func EmailUser(id string, account string) error

EmailHost send email to host

func EnforceLimits

func EnforceLimits() bool

func FlushCache

func FlushCache(id string)

func GetAccount

func GetAccount(email string, accountid string) (*model.Account, error)

func GetAccountFromApiKey

func GetAccountFromApiKey(apikey string) (*model.Account, error)

func GetAllReservedIps

func GetAllReservedIps() ([]string, error)

GetAllReservedIps the list of all reserved IPs, client and server

func GetAllReservedNetIps

func GetAllReservedNetIps(netId string) ([]string, error)

GetAllReservedIps the list of all reserved IPs, client and server

func GetCache

func GetCache(id string) (interface{}, bool)

func GetDefaultMaxDevices

func GetDefaultMaxDevices() int

func GetDefaultMaxMembers

func GetDefaultMaxMembers() int

func GetDefaultMaxNetworks

func GetDefaultMaxNetworks() int

func GetDefaultMaxServices

func GetDefaultMaxServices() int

func GetDefaultTolerance

func GetDefaultTolerance() float64

func ReadAccount

func ReadAccount(id string) (*model.Account, error)

ReadACcount by id

func ReadAllAccounts

func ReadAllAccounts(email string) ([]*model.Account, error)

ReadAllAccounts account by id or email address

func ReadDevice

func ReadDevice(id string) (*model.Device, error)

ReadDevice device by id

func ReadDevice2

func ReadDevice2(param string, id string) ([]*model.Device, error)

ReadDevice2 device by param and id

func ReadDeviceByApiKey

func ReadDeviceByApiKey(apikey string) (*model.Device, error)

ReadDeviceByApiKey(device.ApiKey)

func ReadDevices

func ReadDevices() ([]*model.Device, error)

ReadDevices all devices

func ReadDevicesForAccount

func ReadDevicesForAccount(accountid string) ([]*model.Device, error)

ReadDevicesForAccount

func ReadDevicesForUser

func ReadDevicesForUser(email string) ([]*model.Device, error)

ReadDevices all devices This code needs a severe rewrite

func ReadLimits

func ReadLimits(accountid string) (*model.Limits, error)

func ReadNet

func ReadNet(id string) (*model.Network, error)

ReadNet net by id

func ReadNetworks

func ReadNetworks(email string) ([]*model.Network, error)

ReadNetworks all clients

func ReadNetworksForAccount

func ReadNetworksForAccount(accountId string) ([]*model.Network, error)

func ReadServer

func ReadServer() ([]*model.Server, error)

ReadServer object, create default one

func ReadServer2

func ReadServer2(id string) (*model.Server, error)

ReadServer2

func ReadService

func ReadService(id string) (*model.Service, error)

ReadService service by id

func ReadServiceVPN

func ReadServiceVPN(serviceGroup string) ([]*model.Service, error)

ReadServiceVPN returns all services configured for a vpn

func ReadServices

func ReadServices(email string) ([]*model.Service, error)

ReadServices all clients

func ReadServicesForAccount

func ReadServicesForAccount(accountId string) ([]*model.Service, error)

func ReadSubscription

func ReadSubscription(id string) (*model.Subscription, error)

ReadSubscription by id

func ReadSubscriptions

func ReadSubscriptions(email string) ([]*model.Subscription, error)

ReadSubscriptions all clients

func ReadUser

func ReadUser(id string) (*model.User, error)

ReadUser user by id

func ReadUsers

func ReadUsers() ([]*model.User, error)

ReadUsers all users

func ReadVPN

func ReadVPN(id string) (*model.VPN, error)

ReadVPN vpn by id

func ReadVPN2

func ReadVPN2(param string, id string) ([]*model.VPN, error)

ReadVPN2 vpn by param and id

func ReadVPNConfig

func ReadVPNConfig(id string) ([]byte, *string, error)

ReadVPNConfig in wg format

func ReadVPNs

func ReadVPNs() ([]*model.VPN, error)

ReadVPNs all vpns

func ReadVPNsForUser

func ReadVPNsForUser(email string) ([]*model.VPN, error)

ReadVPNs all vpns

func SetCache

func SetCache(id string, status interface{})

func UpdateAccount

func UpdateAccount(Id string, user *model.Account) (*model.Account, error)

UpdateUser preserve keys

func UpdateDevice

func UpdateDevice(Id string, device *model.Device, fUpdated bool) (*model.Device, error)

UpdateDevice preserve keys

func UpdateNet

func UpdateNet(Id string, net *model.Network) (*model.Network, error)

UpdateNet preserve keys

func UpdateServer

func UpdateServer(server *model.Server) (*model.Server, error)

UpdateServer keep private values from existing one

func UpdateService

func UpdateService(Id string, service *model.Service) (*model.Service, error)

UpdateService preserve keys

func UpdateSubscription

func UpdateSubscription(Id string, subscription *model.Subscription) (*model.Subscription, error)

UpdateSubscription by id

func UpdateUser

func UpdateUser(Id string, user *model.User) (*model.User, error)

UpdateUser preserve keys

func UpdateVPN

func UpdateVPN(Id string, vpn *model.VPN, flag bool) (*model.VPN, error)

UpdateVPN preserve keys

Types

This section is empty.

Jump to

Keyboard shortcuts

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