mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-12 08:04:25 +08:00
* Move ee code to ee package and unify ee status to IsPro * Consolidate naming for paid/professional/enterprise version as "pro". Notes: - Changes image tags - Changes build tags - Changes package names - Doesn't change links to docs that mention "ee" - Doesn't change parameters sent to PostHog that mention "ee" * Revert docker image tag being -pro, back to -ee * Revert go build tag being pro, back to ee * Add build tags for some ee content * [2] Revert go build tag being pro, back to ee * Fix test workflow * Add a json tag to be backwards compatible with frontend "IsEE" check * Add a json tag for the serverconfig struct for IsEE * Ammend json tag to Is_EE * fix ee tags --------- Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>
56 lines
1 KiB
Go
56 lines
1 KiB
Go
//go:build ee
|
|
// +build ee
|
|
|
|
package pro
|
|
|
|
import (
|
|
"encoding/base64"
|
|
|
|
"github.com/gravitl/netmaker/logic"
|
|
)
|
|
|
|
// base64encode - base64 encode helper function
|
|
func base64encode(input []byte) string {
|
|
return base64.StdEncoding.EncodeToString(input)
|
|
}
|
|
|
|
// base64decode - base64 decode helper function
|
|
func base64decode(input string) []byte {
|
|
|
|
bytes, err := base64.StdEncoding.DecodeString(input)
|
|
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
|
|
return bytes
|
|
}
|
|
|
|
func getCurrentServerUsage() (limits Usage) {
|
|
limits.SetDefaults()
|
|
hosts, hErr := logic.GetAllHosts()
|
|
if hErr == nil {
|
|
limits.Hosts = len(hosts)
|
|
}
|
|
clients, cErr := logic.GetAllExtClients()
|
|
if cErr == nil {
|
|
limits.Clients = len(clients)
|
|
}
|
|
users, err := logic.GetUsers()
|
|
if err == nil {
|
|
limits.Users = len(users)
|
|
}
|
|
networks, err := logic.GetNetworks()
|
|
if err == nil {
|
|
limits.Networks = len(networks)
|
|
}
|
|
ingresses, err := logic.GetAllIngresses()
|
|
if err == nil {
|
|
limits.Ingresses = len(ingresses)
|
|
}
|
|
egresses, err := logic.GetAllEgresses()
|
|
if err == nil {
|
|
limits.Egresses = len(egresses)
|
|
}
|
|
return
|
|
}
|