models

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: Apache-2.0 Imports: 16 Imported by: 27

Documentation

Overview

TODO: Either add a returnNetwork and returnKey, or delete this

Index

Constants

View Source
const (
	Http        = "HTTP"
	Https       = "HTTPS"
	AllTCP      = "All TCP"
	AllUDP      = "All UDP"
	ICMPService = "ICMP"
	SSH         = "SSH"
	Custom      = "Custom"
	Any         = "Any"
)
View Source
const (
	// DNSDeleteByIP delete the dns entry
	DNSDeleteByIP = iota
	// DNSDeleteByName delete the dns entry
	DNSDeleteByName
	// DNSReplaceName replace the dns entry
	DNSReplaceName
	// DNSReplaceIP resplace the dns entry
	DNSReplaceIP
	// DNSInsert insert a new dns entry
	DNSInsert
)
View Source
const (
	WIREGUARD_INTERFACE        = "netmaker"
	DefaultPersistentKeepAlive = 20 * time.Second
)

WIREGUARD_INTERFACE name of wireguard interface

View Source
const (
	// NODE_SERVER_NAME - the default server name
	NODE_SERVER_NAME = "netmaker"
	// MAX_NAME_LENGTH - max name length of node
	MAX_NAME_LENGTH = 62
	// == ACTIONS == (can only be set by server)
	// NODE_DELETE - delete node action
	NODE_DELETE = "delete"
	// NODE_IS_PENDING - node pending status
	NODE_IS_PENDING = "pending"
	// NODE_NOOP - node no op action
	NODE_NOOP = "noop"
	// NODE_FORCE_UPDATE - indicates a node should pull all changes
	NODE_FORCE_UPDATE = "force"
	// FIREWALL_IPTABLES - indicates that iptables is the firewall in use
	FIREWALL_IPTABLES = "iptables"
	// FIREWALL_NFTABLES - indicates nftables is in use (Linux only)
	FIREWALL_NFTABLES = "nftables"
	// FIREWALL_NONE - indicates that no supported firewall in use
	FIREWALL_NONE = "none"
)
View Source
const (
	// PLACEHOLDER_KEY_TEXT - access key placeholder text if option turned off
	PLACEHOLDER_KEY_TEXT = "ACCESS_KEY"
	// PLACEHOLDER_TOKEN_TEXT - access key token placeholder text if option turned off
	PLACEHOLDER_TOKEN_TEXT = "ACCESS_TOKEN"
)
View Source
const (
	OldRemoteAccessTagName = "remote-access-gws"
	GwTagName              = "gateways"
)
View Source
const DefaultExpDuration = time.Minute * 5

DefaultExpDuration - the default expiration time of SsoState

View Source
const EnrollmentKeyLength = 32

EnrollmentKeyLength - the length of an enrollment key - 62^16 unique possibilities

View Source
const LastCheckInThreshold = time.Minute * 10

LastCheckInThreshold - if node's checkin more than this threshold,then node is declared as offline

View Source
const (
	ResHeaderKeyStAccessToken = "St-Access-Token"
)

Variables

View Source
var (
	ErrNilEnrollmentKey          = errors.New("enrollment key is nil")
	ErrNilNetworksEnrollmentKey  = errors.New("enrollment key networks is nil")
	ErrNilTagsEnrollmentKey      = errors.New("enrollment key tags is nil")
	ErrInvalidEnrollmentKey      = errors.New("enrollment key is not valid")
	ErrInvalidEnrollmentKeyValue = errors.New("enrollment key value is not valid")
)
View Source
var NAT_Types = struct {
	Public    string
	BehindNAT string
}{
	Public:    "public",
	BehindNAT: "behind_nat",
}

NAT_Types - the type of NAT in which a HOST currently resides (simplified)

View Source
var OS_Types = struct {
	Linux   string
	Windows string
	Mac     string
	FreeBSD string
	IoT     string
}{
	Linux:   "linux",
	Windows: "windows",
	Mac:     "darwin",
	FreeBSD: "freebsd",
	IoT:     "iot",
}

OS_Types - list of OS types Netmaker cares about

View Source
var RsrcTypeMap = map[RsrcType]struct{}{
	HostRsrc:           {},
	RelayRsrc:          {},
	RemoteAccessGwRsrc: {},
	ExtClientsRsrc:     {},
	InetGwRsrc:         {},
	EgressGwRsrc:       {},
	NetworkRsrc:        {},
	EnrollmentKeysRsrc: {},
	UserRsrc:           {},
	AclRsrc:            {},
	DnsRsrc:            {},
	FailOverRsrc:       {},
}

Functions

func FormatBool

func FormatBool(b bool) string

FormatBool converts a boolean to a [yes|no] string

func GenerateNodeName

func GenerateNodeName() string

GenerateNodeName - generates a random node name

func GetRAGRoleName added in v0.25.0

func GetRAGRoleName(netID, hostName string) string

func IsIpv4Net

func IsIpv4Net(host string) bool

IsIpv4Net - check for valid IPv4 address Note: We dont handle IPv6 AT ALL!!!!! This definitely is needed at some point But for iteration 1, lets just stick to IPv4. Keep it simple stupid.

func ParseBool

func ParseBool(s string) bool

ParseBool parses a [yes|no] string to boolean value

func RetrieveLogo() string

RetrieveLogo - retrieves the ascii art logo for Netmaker

func SetLogo(logo string)

SetLogo - sets the logo ascii art

func StringWithCharset

func StringWithCharset(length int, charset string) string

StringWithCharset - returns random string inside defined charset

Types

type APIEnrollmentKey

type APIEnrollmentKey struct {
	Expiration        int64    `json:"expiration" swaggertype:"primitive,integer" format:"int64"`
	UsesRemaining     int      `json:"uses_remaining"`
	Networks          []string `json:"networks"`
	Unlimited         bool     `json:"unlimited"`
	Tags              []string `json:"tags" validate:"required,dive,min=3,max=32"`
	Type              KeyType  `json:"type"`
	Relay             string   `json:"relay"`
	Groups            []TagID  `json:"groups"`
	AutoEgress        bool     `json:"auto_egress"`
	AutoAssignGateway bool     `json:"auto_assign_gw"`
}

APIEnrollmentKey - used to create enrollment keys via API

type Acl added in v0.26.0

type Acl struct {
	ID               string                  `json:"id"`
	Default          bool                    `json:"default"`
	MetaData         string                  `json:"meta_data"`
	Name             string                  `json:"name"`
	NetworkID        NetworkID               `json:"network_id"`
	RuleType         AclPolicyType           `json:"policy_type"`
	Src              []AclPolicyTag          `json:"src_type"`
	Dst              []AclPolicyTag          `json:"dst_type"`
	Proto            Protocol                `json:"protocol"` // tcp, udp, etc.
	ServiceType      string                  `json:"type"`
	Port             []string                `json:"ports"`
	AllowedDirection AllowedTrafficDirection `json:"allowed_traffic_direction"`
	Enabled          bool                    `json:"enabled"`
	CreatedBy        string                  `json:"created_by"`
	CreatedAt        time.Time               `json:"created_at"`
}

type AclGroupType added in v0.26.0

type AclGroupType string
const (
	UserAclID                AclGroupType = "user"
	UserGroupAclID           AclGroupType = "user-group"
	NodeTagID                AclGroupType = "tag"
	NodeID                   AclGroupType = "device"
	EgressRange              AclGroupType = "egress-range"
	EgressID                 AclGroupType = "egress-id"
	NetmakerIPAclID          AclGroupType = "ip"
	NetmakerSubNetRangeAClID AclGroupType = "ipset"
)

func (AclGroupType) String added in v0.26.0

func (g AclGroupType) String() string

type AclPolicy added in v0.26.0

type AclPolicy struct {
	TypeID        AclPolicyType
	PrefixTagUser AclGroupType
}

type AclPolicyTag added in v0.26.0

type AclPolicyTag struct {
	ID    AclGroupType `json:"id"`
	Value string       `json:"value"`
}

type AclPolicyType added in v0.26.0

type AclPolicyType string
const (
	UserPolicy   AclPolicyType = "user-policy"
	DevicePolicy AclPolicyType = "device-policy"
)

type AclPolicyTypes added in v0.26.0

type AclPolicyTypes struct {
	ProtocolTypes []ProtocolType
	RuleTypes     []AclPolicyType `json:"policy_types"`
	SrcGroupTypes []AclGroupType  `json:"src_grp_types"`
	DstGroupTypes []AclGroupType  `json:"dst_grp_types"`
}

type AclRule added in v0.30.0

type AclRule struct {
	ID              string                  `json:"id"`
	IPList          []net.IPNet             `json:"ip_list"`
	IP6List         []net.IPNet             `json:"ip6_list"`
	AllowedProtocol Protocol                `json:"allowed_protocols"` // tcp, udp, etc.
	AllowedPorts    []string                `json:"allowed_ports"`
	Direction       AllowedTrafficDirection `json:"direction"` // single or two-way
	Dst             []net.IPNet             `json:"dst"`
	Dst6            []net.IPNet             `json:"dst6"`
	Allowed         bool
}

type Action added in v0.99.0

type Action string
const (
	Create                               Action = "CREATE"
	Update                               Action = "UPDATE"
	Delete                               Action = "DELETE"
	DeleteAll                            Action = "DELETE_ALL"
	Login                                Action = "LOGIN"
	LogOut                               Action = "LOGOUT"
	Connect                              Action = "CONNECT"
	Sync                                 Action = "SYNC"
	RefreshKey                           Action = "REFRESH_KEY"
	RefreshAllKeys                       Action = "REFRESH_ALL_KEYS"
	SyncAll                              Action = "SYNC_ALL"
	UpgradeAll                           Action = "UPGRADE_ALL"
	Disconnect                           Action = "DISCONNECT"
	JoinHostToNet                        Action = "JOIN_HOST_TO_NETWORK"
	RemoveHostFromNet                    Action = "REMOVE_HOST_FROM_NETWORK"
	EnableMFA                            Action = "ENABLE_MFA"
	DisableMFA                           Action = "DISABLE_MFA"
	EnforceMFA                           Action = "ENFORCE_MFA"
	UnenforceMFA                         Action = "UNENFORCE_MFA"
	EnableBasicAuth                      Action = "ENABLE_BASIC_AUTH"
	DisableBasicAuth                     Action = "DISABLE_BASIC_AUTH"
	EnableTelemetry                      Action = "ENABLE_TELEMETRY"
	DisableTelemetry                     Action = "DISABLE_TELEMETRY"
	UpdateClientSettings                 Action = "UPDATE_CLIENT_SETTINGS"
	UpdateAuthenticationSecuritySettings Action = "UPDATE_AUTHENTICATION_SECURITY_SETTINGS"
	UpdateMonitoringAndDebuggingSettings Action = "UPDATE_MONITORING_AND_DEBUGGING_SETTINGS"
	UpdateSMTPSettings                   Action = "UPDATE_EMAIL_SETTINGS"
	UpdateIDPSettings                    Action = "UPDATE_IDP_SETTINGS"
	EnableFlowLogs                       Action = "ENABLE_FLOW_LOGS"
	DisableFlowLogs                      Action = "DISABLE_FLOW_LOGS"
	GatewayAssign                        Action = "GATEWAY_ASSIGN"
	GatewayUnAssign                      Action = "GATEWAY_UNASSIGN"
)

type AllowedTrafficDirection added in v0.26.0

type AllowedTrafficDirection int

AllowedTrafficDirection - allowed direction of traffic

const (
	// TrafficDirectionUni implies traffic is only allowed in one direction (src --> dst)
	TrafficDirectionUni AllowedTrafficDirection = iota
	// TrafficDirectionBi implies traffic is allowed both direction (src <--> dst )
	TrafficDirectionBi
)

type ApiHost

type ApiHost struct {
	ID                  string     `json:"id"`
	Verbosity           int        `json:"verbosity"`
	FirewallInUse       string     `json:"firewallinuse"`
	Version             string     `json:"version"`
	Name                string     `json:"name"`
	OS                  string     `json:"os"`
	OSFamily            string     `json:"os_family" yaml:"os_family"`
	OSVersion           string     `json:"os_version"                      yaml:"os_version"`
	KernelVersion       string     `json:"kernel_version" yaml:"kernel_version"`
	Debug               bool       `json:"debug"`
	IsStaticPort        bool       `json:"isstaticport"`
	IsStatic            bool       `json:"isstatic"`
	ListenPort          int        `json:"listenport"`
	WgPublicListenPort  int        `json:"wg_public_listen_port" yaml:"wg_public_listen_port"`
	MTU                 int        `json:"mtu"                   yaml:"mtu"`
	Interfaces          []ApiIface `json:"interfaces"            yaml:"interfaces"`
	DefaultInterface    string     `json:"defaultinterface"      yaml:"defautlinterface"`
	EndpointIP          string     `json:"endpointip"            yaml:"endpointip"`
	EndpointIPv6        string     `json:"endpointipv6"            yaml:"endpointipv6"`
	PublicKey           string     `json:"publickey"`
	MacAddress          string     `json:"macaddress"`
	Nodes               []string   `json:"nodes"`
	IsDefault           bool       `json:"isdefault"             yaml:"isdefault"`
	NatType             string     `json:"nat_type"              yaml:"nat_type"`
	PersistentKeepalive int        `json:"persistentkeepalive"   yaml:"persistentkeepalive"`
	AutoUpdate          bool       `json:"autoupdate"              yaml:"autoupdate"`
	DNS                 string     `json:"dns"               yaml:"dns"`
	EnableFlowLogs      bool       `json:"enable_flow_logs" yaml:"enable_flow_logs"`
	Location            string     `json:"location"`
	CountryCode         string     `json:"country_code"`
}

ApiHost - the host struct for API usage

func (*ApiHost) ConvertAPIHostToNMHost

func (a *ApiHost) ConvertAPIHostToNMHost(currentHost *Host) *Host

APIHost.ConvertAPIHostToNMHost - convert's a given apihost struct to a Host struct

type ApiIface added in v0.24.0

type ApiIface struct {
	Name          string `json:"name"`
	AddressString string `json:"addressString"`
}

ApiIface - the interface struct for API usage The original Iface struct contains a net.Address, which does not get marshalled correctly

type ApiNode

type ApiNode struct {
	ID                 string            `json:"id,omitempty" validate:"required,min=5,id_unique"`
	HostID             string            `json:"hostid,omitempty" validate:"required,min=5,id_unique"`
	Address            string            `json:"address" validate:"omitempty,cidrv4"`
	Address6           string            `json:"address6" validate:"omitempty,cidrv6"`
	LocalAddress       string            `json:"localaddress" validate:"omitempty,cidr"`
	AllowedIPs         []string          `json:"allowedips"`
	LastModified       int64             `json:"lastmodified" swaggertype:"primitive,integer" format:"int64"`
	ExpirationDateTime int64             `json:"expdatetime" swaggertype:"primitive,integer" format:"int64"`
	LastCheckIn        int64             `json:"lastcheckin" swaggertype:"primitive,integer" format:"int64"`
	LastPeerUpdate     int64             `json:"lastpeerupdate" swaggertype:"primitive,integer" format:"int64"`
	Network            string            `json:"network"`
	NetworkRange       string            `json:"networkrange"`
	NetworkRange6      string            `json:"networkrange6"`
	IsRelayed          bool              `json:"isrelayed"`
	IsRelay            bool              `json:"isrelay"`
	IsGw               bool              `json:"is_gw"`
	IsAutoRelay        bool              `json:"is_auto_relay"`
	AutoRelayedPeers   map[string]string `json:"auto_relayed_peers"`
	AutoAssignGateway  bool              `json:"auto_assign_gw"`
	//AutoRelayedBy                 uuid.UUID           `json:"auto_relayed_by"`
	RelayedBy                     string              `json:"relayedby" bson:"relayedby" yaml:"relayedby"`
	RelayedNodes                  []string            `json:"relaynodes" yaml:"relayedNodes"`
	IsEgressGateway               bool                `json:"isegressgateway"`
	IsIngressGateway              bool                `json:"isingressgateway"`
	EgressGatewayRanges           []string            `json:"egressgatewayranges"`
	EgressGatewayNatEnabled       bool                `json:"egressgatewaynatenabled"`
	EgressGatewayRangesWithMetric []EgressRangeMetric `json:"egressgatewayranges_with_metric"`
	DNSOn                         bool                `json:"dnson"`
	IngressDns                    string              `json:"ingressdns"`
	IngressPersistentKeepalive    int32               `json:"ingresspersistentkeepalive"`
	IngressMTU                    int32               `json:"ingressmtu"`
	Server                        string              `json:"server"`
	Connected                     bool                `json:"connected"`
	PendingDelete                 bool                `json:"pendingdelete"`
	Metadata                      string              `json:"metadata"`
	// == PRO ==
	DefaultACL                        string              `json:"defaultacl,omitempty" validate:"checkyesornoorunset"`
	IsFailOver                        bool                `json:"is_fail_over"`
	FailOverPeers                     map[string]struct{} `json:"fail_over_peers" yaml:"fail_over_peers"`
	FailedOverBy                      uuid.UUID           `json:"failed_over_by" yaml:"failed_over_by"`
	IsInternetGateway                 bool                `json:"isinternetgateway" yaml:"isinternetgateway"`
	InetNodeReq                       InetNodeReq         `json:"inet_node_req" yaml:"inet_node_req"`
	InternetGwID                      string              `json:"internetgw_node_id" yaml:"internetgw_node_id"`
	AdditionalRagIps                  []string            `json:"additional_rag_ips" yaml:"additional_rag_ips"`
	Tags                              map[TagID]struct{}  `json:"tags" yaml:"tags"`
	IsStatic                          bool                `json:"is_static"`
	IsUserNode                        bool                `json:"is_user_node"`
	StaticNode                        ExtClient           `json:"static_node"`
	Status                            NodeStatus          `json:"status"`
	Location                          string              `json:"location"`
	Country                           string              `json:"country"`
	PostureChecksViolations           []Violation         `json:"posture_check_violations"`
	PostureCheckVolationSeverityLevel Severity            `json:"posture_check_violation_severity_level"`
	LastEvaluatedAt                   time.Time           `json:"last_evaluated_at"`
}

ApiNode is a stripped down Node DTO that exposes only required fields to external systems

func (*ApiNode) ConvertToServerNode

func (a *ApiNode) ConvertToServerNode(currentNode *Node) *Node

ApiNode.ConvertToServerNode - converts an api node to a server node

type ApiNodeStatus added in v0.90.0

type ApiNodeStatus struct {
	ID         string     `json:"id"`
	IsStatic   bool       `json:"is_static"`
	IsUserNode bool       `json:"is_user_node"`
	Status     NodeStatus `json:"status"`
}

type AuthParams

type AuthParams struct {
	MacAddress string `json:"macaddress"`
	ID         string `json:"id"`
	Password   string `json:"password"`
}

AuthParams - struct for auth params

type AuthType added in v0.25.0

type AuthType string
var (
	BasicAuth AuthType = "basic_auth"
	OAuth     AuthType = "oauth"
)

type AutoRelayMeReq added in v1.2.0

type AutoRelayMeReq struct {
	NodeID        string `json:"node_id"`
	AutoRelayGwID string `json:"auto_relay_gw_id"`
}

AutoRelayMeReq - struct for autorelay req

type CheckInResponse

type CheckInResponse struct {
	Success          bool   `json:"success" bson:"success"`
	NeedPeerUpdate   bool   `json:"needpeerupdate" bson:"needpeerupdate"`
	NeedConfigUpdate bool   `json:"needconfigupdate" bson:"needconfigupdate"`
	NeedKeyUpdate    bool   `json:"needkeyupdate" bson:"needkeyupdate"`
	NeedDelete       bool   `json:"needdelete" bson:"needdelete"`
	NodeMessage      string `json:"nodemessage" bson:"nodemessage"`
	IsPending        bool   `json:"ispending" bson:"ispending"`
}

CheckInResponse - checkin response

type Claims

type Claims struct {
	ID         string
	MacAddress string
	Network    string
	jwt.RegisteredClaims
}

Claims is a struct that will be encoded to a JWT. jwt.StandardClaims is an embedded type to provide expiry time

type CommonNode

type CommonNode struct {
	ID                  uuid.UUID `json:"id"                  yaml:"id"`
	HostID              uuid.UUID `json:"hostid"              yaml:"hostid"`
	Network             string    `json:"network"             yaml:"network"`
	NetworkRange        net.IPNet `json:"networkrange"        yaml:"networkrange"        swaggertype:"primitive,integer"`
	NetworkRange6       net.IPNet `json:"networkrange6"       yaml:"networkrange6"       swaggertype:"primitive,number"`
	Server              string    `json:"server"              yaml:"server"`
	Connected           bool      `json:"connected"           yaml:"connected"`
	Address             net.IPNet `json:"address"             yaml:"address"`
	Address6            net.IPNet `json:"address6"            yaml:"address6"`
	Action              string    `json:"action"              yaml:"action"`
	LocalAddress        net.IPNet `json:"localaddress"        yaml:"localaddress"`
	IsEgressGateway     bool      `json:"isegressgateway"     yaml:"isegressgateway"`
	EgressGatewayRanges []string  `json:"egressgatewayranges" yaml:"egressgatewayranges"`
	IsIngressGateway    bool      `json:"isingressgateway"    yaml:"isingressgateway"`
	IsRelayed           bool      `json:"isrelayed"           yaml:"isrelayed"`
	RelayedBy           string    `json:"relayedby"           yaml:"relayedby"`
	IsRelay             bool      `json:"isrelay"             yaml:"isrelay"`
	IsGw                bool      `json:"is_gw"             yaml:"is_gw"`
	RelayedNodes        []string  `json:"relaynodes"          yaml:"relayedNodes"`
	IngressDNS          string    `json:"ingressdns"          yaml:"ingressdns"`
	AutoAssignGateway   bool      `json:"auto_assign_gw"`
}

CommonNode - represents a commonn node data elements shared by netmaker and netclient

type CreateGroupReq added in v0.25.0

type CreateGroupReq struct {
	Group   UserGroup `json:"user_group"`
	Members []string  `json:"members"`
}

type CreateGwReq added in v0.90.0

type CreateGwReq struct {
	IngressRequest
	RelayRequest
	InetNodeReq
}

type CreateTagReq added in v0.26.0

type CreateTagReq struct {
	TagName     string    `json:"tag_name"`
	Network     NetworkID `json:"network"`
	ColorCode   string    `json:"color_code"`
	TaggedNodes []ApiNode `json:"tagged_nodes"`
}

type CustomExtClient

type CustomExtClient struct {
	ClientID                   string              `json:"clientid,omitempty"`
	PublicKey                  string              `json:"publickey,omitempty"`
	DNS                        string              `json:"dns,omitempty"`
	ExtraAllowedIPs            []string            `json:"extraallowedips,omitempty"`
	Enabled                    bool                `json:"enabled,omitempty"`
	DeniedACLs                 map[string]struct{} `json:"deniednodeacls" bson:"acls,omitempty"`
	RemoteAccessClientID       string              `json:"remote_access_client_id"` // unique ID (MAC address) of RAC machine
	PostUp                     string              `json:"postup" bson:"postup" validate:"max=1024"`
	PostDown                   string              `json:"postdown" bson:"postdown" validate:"max=1024"`
	Tags                       map[TagID]struct{}  `json:"tags"`
	DeviceID                   string              `json:"device_id"`
	DeviceName                 string              `json:"device_name"`
	IsAlreadyConnectedToInetGw bool                `json:"is_already_connected_to_inet_gw"`
	PublicEndpoint             string              `json:"public_endpoint"`
	OS                         string              `json:"os"`
	OSFamily                   string              `json:"os_family" yaml:"os_family"`
	OSVersion                  string              `json:"os_version"                      yaml:"os_version"`
	KernelVersion              string              `json:"kernel_version" yaml:"kernel_version"`
	ClientVersion              string              `json:"client_version"`
	Country                    string              `json:"country"`
	Location                   string              `json:"location"` //format: lat,long
}

CustomExtClient - struct for CustomExtClient params

type DNSEntry

type DNSEntry struct {
	Address  string `json:"address" validate:"omitempty,ip"`
	Address6 string `json:"address6" validate:"omitempty,ip"`
	Name     string `json:"name" validate:"required,name_unique,min=1,max=192,whitespace"`
	Network  string `json:"network" validate:"network_exists"`
}

DNSEntry - a DNS entry represented as struct

type DNSError

type DNSError struct {
	ErrorStrings []string
}

DNSError error struct capable of holding multiple error messages

func (DNSError) Error

func (e DNSError) Error() string

DNSError.Error implementation of error interface

type DNSUpdate

type DNSUpdate struct {
	Action     DNSUpdateAction
	Name       string
	NewName    string
	Address    string
	NewAddress string
}

DNSUpdate data for updating entries in /etc/hosts

type DNSUpdateAction

type DNSUpdateAction int

DNSUpdateAction identifies the action to be performed with the dns update data

func (DNSUpdateAction) String

func (action DNSUpdateAction) String() string

type DeleteGw added in v0.90.0

type DeleteGw struct {
}

type Diff added in v0.99.0

type Diff struct {
	Old interface{}
	New interface{}
}

type DisplayKey

type DisplayKey struct {
	Name string `json:"name" bson:"name"`
	Uses int    `json:"uses" bson:"uses"`
}

DisplayKey - what is displayed for key

type EgressDetails added in v0.99.0

type EgressDetails struct {
	EgressGatewayNatEnabled bool
	EgressGatewayRequest    EgressGatewayRequest
	IsEgressGateway         bool
	EgressGatewayRanges     []string
}

type EgressDomain added in v1.1.0

type EgressDomain struct {
	ID     string `json:"id"`
	Node   Node   `json:"node"`
	Host   Host   `json:"host"`
	Domain string `json:"domain"`
}

type EgressGatewayRequest

type EgressGatewayRequest struct {
	NodeID           string              `json:"nodeid" bson:"nodeid"`
	NetID            string              `json:"netid" bson:"netid"`
	NatEnabled       string              `json:"natenabled" bson:"natenabled"`
	Ranges           []string            `json:"ranges" bson:"ranges"`
	RangesWithMetric []EgressRangeMetric `json:"ranges_with_metric"`
}

EgressGatewayRequest - egress gateway request

type EgressInfo

type EgressInfo struct {
	EgressID      string               `json:"egress_id" yaml:"egress_id"`
	Network       net.IPNet            `json:"network" yaml:"network"`
	EgressGwAddr  net.IPNet            `json:"egress_gw_addr" yaml:"egress_gw_addr"`
	Network6      net.IPNet            `json:"network6" yaml:"network6"`
	EgressGwAddr6 net.IPNet            `json:"egress_gw_addr6" yaml:"egress_gw_addr6"`
	EgressGWCfg   EgressGatewayRequest `json:"egress_gateway_cfg" yaml:"egress_gateway_cfg"`
	EgressFwRules map[string]AclRule   `json:"egress_fw_rules"`
}

EgressInfo - struct for egress info

type EgressNetworkRoutes

type EgressNetworkRoutes struct {
	PeerKey                string              `json:"peer_key"`
	EgressGwAddr           net.IPNet           `json:"egress_gw_addr" yaml:"egress_gw_addr"`
	EgressGwAddr6          net.IPNet           `json:"egress_gw_addr6" yaml:"egress_gw_addr6"`
	NodeAddr               net.IPNet           `json:"node_addr"`
	NodeAddr6              net.IPNet           `json:"node_addr6"`
	EgressRanges           []string            `json:"egress_ranges"`
	EgressRangesWithMetric []EgressRangeMetric `json:"egress_ranges_metric"`
	Network                string              `json:"network"`
}

EgressNetworkRoutes - struct for egress network routes for adding routes to peer's interface

type EgressRangeMetric added in v0.90.0

type EgressRangeMetric struct {
	// EgressID is the ID of the egress gateway that this EgressRangeMetric originated
	// from. Might not be always set.
	EgressID    string `json:"-"`
	Network     string `json:"network"`
	RouteMetric uint32 `json:"route_metric"` // preffered range 1-999
	Nat         bool   `json:"nat"`
}

type EgressReq added in v0.99.0

type EgressReq struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Network     string         `json:"network"`
	Description string         `json:"description"`
	Nodes       map[string]int `json:"nodes"`
	Tags        map[string]int `json:"tags"`
	Range       string         `json:"range"`
	Domain      string         `json:"domain"`
	Nat         bool           `json:"nat"`
	Status      bool           `json:"status"`
	IsInetGw    bool           `json:"is_internet_gateway"`
}

type EnrollmentKey

type EnrollmentKey struct {
	Expiration        time.Time `json:"expiration"`
	UsesRemaining     int       `json:"uses_remaining"`
	Value             string    `json:"value"`
	Networks          []string  `json:"networks"`
	Unlimited         bool      `json:"unlimited"`
	Tags              []string  `json:"tags"`
	Token             string    `json:"token,omitempty"` // B64 value of EnrollmentToken
	Type              KeyType   `json:"type"`
	Relay             uuid.UUID `json:"relay"`
	Groups            []TagID   `json:"groups"`
	Default           bool      `json:"default"`
	AutoEgress        bool      `json:"auto_egress"`
	AutoAssignGateway bool      `json:"auto_assign_gw"`
}

EnrollmentKey - the key used to register hosts and join them to specific networks

func (*EnrollmentKey) IsValid

func (k *EnrollmentKey) IsValid() bool

EnrollmentKey.IsValid - checks if the key is still valid to use

func (*EnrollmentKey) Validate

func (k *EnrollmentKey) Validate() error

EnrollmentKey.Validate - validate's an EnrollmentKey should be used during creation

type EnrollmentToken

type EnrollmentToken struct {
	Server string `json:"server"`
	Value  string `json:"value"`
}

EnrollmentToken - the tokenized version of an enrollmentkey; to be used for host registration

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type ErrorResponse

type ErrorResponse struct {
	Code     int
	Message  string
	Response interface{}
}

ErrorResponse is struct for error

type Event added in v0.99.0

type Event struct {
	Action      Action
	Source      Subject
	Origin      Origin
	Target      Subject
	TriggeredBy string
	NetworkID   NetworkID
	Diff        Diff
}

type ExporterFeatureFlags added in v1.4.0

type ExporterFeatureFlags struct {
	EnableFlowLogs bool
}

type ExtClient

type ExtClient struct {
	ClientID                          string              `json:"clientid" bson:"clientid"`
	PrivateKey                        string              `json:"privatekey" bson:"privatekey"`
	PublicKey                         string              `json:"publickey" bson:"publickey"`
	Network                           string              `json:"network" bson:"network"`
	DNS                               string              `json:"dns" bson:"dns"`
	Address                           string              `json:"address" bson:"address"`
	Address6                          string              `json:"address6" bson:"address6"`
	ExtraAllowedIPs                   []string            `json:"extraallowedips" bson:"extraallowedips"`
	AllowedIPs                        []string            `json:"allowed_ips"`
	IngressGatewayID                  string              `json:"ingressgatewayid" bson:"ingressgatewayid"`
	IngressGatewayEndpoint            string              `json:"ingressgatewayendpoint" bson:"ingressgatewayendpoint"`
	LastModified                      int64               `json:"lastmodified" bson:"lastmodified" swaggertype:"primitive,integer" format:"int64"`
	Enabled                           bool                `json:"enabled" bson:"enabled"`
	OwnerID                           string              `json:"ownerid" bson:"ownerid"`
	DeniedACLs                        map[string]struct{} `json:"deniednodeacls" bson:"acls,omitempty"`
	RemoteAccessClientID              string              `json:"remote_access_client_id"` // unique ID (MAC address) of RAC machine
	PostUp                            string              `json:"postup" bson:"postup"`
	PostDown                          string              `json:"postdown" bson:"postdown"`
	Tags                              map[TagID]struct{}  `json:"tags"`
	OS                                string              `json:"os"`
	OSFamily                          string              `json:"os_family" yaml:"os_family"`
	OSVersion                         string              `json:"os_version"                      yaml:"os_version"`
	KernelVersion                     string              `json:"kernel_version" yaml:"kernel_version"`
	ClientVersion                     string              `json:"client_version"`
	DeviceID                          string              `json:"device_id"`
	DeviceName                        string              `json:"device_name"`
	PublicEndpoint                    string              `json:"public_endpoint"`
	Country                           string              `json:"country"`
	Location                          string              `json:"location"` //format: lat,long
	PostureChecksViolations           []Violation         `json:"posture_check_violations"`
	PostureCheckVolationSeverityLevel Severity            `json:"posture_check_violation_severity_level"`
	LastEvaluatedAt                   time.Time           `json:"last_evaluated_at"`
	Mutex                             *sync.Mutex         `json:"-"`
}

ExtClient - struct for external clients

func (*ExtClient) AddressIPNet4 added in v0.22.0

func (extPeer *ExtClient) AddressIPNet4() net.IPNet

ExtClient.PrimaryAddress - returns ipv4 IPNet format

func (*ExtClient) AddressIPNet6 added in v0.22.0

func (extPeer *ExtClient) AddressIPNet6() net.IPNet

ExtClient.AddressIPNet6 - return ipv6 IPNet format

func (*ExtClient) ConvertToStaticNode added in v0.26.0

func (ext *ExtClient) ConvertToStaticNode() Node

type ExtClientInfo

type ExtClientInfo struct {
	IngGwAddr   net.IPNet                `json:"ingress_gw_addr" yaml:"ingress_gw_addr"`
	Network     net.IPNet                `json:"network" yaml:"network"`
	Masquerade  bool                     `json:"masquerade" yaml:"masquerade"`
	ExtPeerAddr net.IPNet                `json:"ext_peer_addr" yaml:"ext_peer_addr"`
	ExtPeerKey  string                   `json:"ext_peer_key" yaml:"ext_peer_key"`
	Peers       map[string]PeerRouteInfo `json:"peers" yaml:"peers"`
}

ExtClientInfo - struct for ext. client and it's peers

type ExtPeersResponse

type ExtPeersResponse struct {
	PublicKey       string `json:"publickey" bson:"publickey"`
	Endpoint        string `json:"endpoint" bson:"endpoint"`
	Address         string `json:"address" bson:"address"`
	Address6        string `json:"address6" bson:"address6"`
	LocalAddress    string `json:"localaddress" bson:"localaddress"`
	LocalListenPort int32  `json:"locallistenport" bson:"locallistenport"`
	ListenPort      int32  `json:"listenport" bson:"listenport"`
	KeepAlive       int32  `json:"persistentkeepalive" bson:"persistentkeepalive"`
}

ExtPeersResponse - ext peers response

type FailOverMeReq added in v0.22.0

type FailOverMeReq struct {
	NodeID string `json:"node_id"`
}

FailOverMeReq - struct for failover req

type FeatureFlags added in v1.1.0

type FeatureFlags struct {
	EnableEgressHA          bool `json:"enable_egress_ha"`
	EnableNetworkActivity   bool `json:"enable_network_activity"`
	EnableOAuth             bool `json:"enable_oauth"`
	EnableIDPIntegration    bool `json:"enable_idp_integration"`
	AllowMultiServerLicense bool `json:"allow_multi_server_license"`
	EnableGwsHA             bool `json:"enable_gws_ha"`
	EnableDeviceApproval    bool `json:"enable_device_approval"`
	EnableFlowLogs          bool `json:"enable_flow_logs"`
	EnablePostureChecks     bool `json:"enable_posture_checks"`
}

type FormField added in v0.22.0

type FormField struct {
	Id    string `json:"id"`
	Value any    `json:"value"`
}

type FormFields added in v0.22.0

type FormFields []FormField

type FwRule added in v0.26.0

type FwRule struct {
	SrcIP           net.IPNet `json:"src_ip"`
	DstIP           net.IPNet `json:"dst_ip"`
	AllowedProtocol Protocol  `json:"allowed_protocols"` // tcp, udp, etc.
	AllowedPorts    []string  `json:"allowed_ports"`
	Allow           bool      `json:"allow"`
}

type FwUpdate

type FwUpdate struct {
	AllowAll        bool                   `json:"allow_all"`
	AllowedNetworks []AclRule              `json:"networks"`
	IsEgressGw      bool                   `json:"is_egress_gw"`
	IsIngressGw     bool                   `json:"is_ingress_gw"`
	EgressInfo      map[string]EgressInfo  `json:"egress_info"`
	IngressInfo     map[string]IngressInfo `json:"ingress_info"`
	AclRules        map[string]AclRule     `json:"acl_rules"`
}

FwUpdate - struct for firewall updates

type GetClientConfReqDto added in v0.24.1

type GetClientConfReqDto struct {
	PreferredIp string `json:"preferred_ip"`
}

type GlobalConfig

type GlobalConfig struct {
	Name string `json:"name" bson:"name"`
}

GlobalConfig - global config

type HookCommand added in v1.4.0

type HookCommand struct {
	ID       string // Hook ID to target
	Command  HookCommandType
	Interval time.Duration // Optional: new interval for restart command (0 means use existing)
}

HookCommand - command to control a hook

type HookCommandType added in v1.4.0

type HookCommandType int

HookCommandType - type of command for hook management

const (
	HookCommandReset HookCommandType = iota
	HookCommandStop
	HookCommandRestart
)

type HookDetails

type HookDetails struct {
	ID       string        // Unique identifier for the hook (optional, auto-generated if empty)
	Hook     HookFunc      // Hook function that accepts optional variadic parameters
	Params   []interface{} // Optional parameters to pass to the hook function
	Interval time.Duration
}

HookDetails - struct to hold hook info

type HookFunc added in v1.4.0

type HookFunc func(...interface{}) error

HookFunc - function type for hooks that can accept optional parameters

type Host

type Host struct {
	ID                  uuid.UUID        `json:"id"                      yaml:"id"`
	Verbosity           int              `json:"verbosity"               yaml:"verbosity"`
	FirewallInUse       string           `json:"firewallinuse"           yaml:"firewallinuse"`
	Version             string           `json:"version"                 yaml:"version"`
	IPForwarding        bool             `json:"ipforwarding"            yaml:"ipforwarding"`
	DaemonInstalled     bool             `json:"daemoninstalled"         yaml:"daemoninstalled"`
	AutoUpdate          bool             `json:"autoupdate"              yaml:"autoupdate"`
	HostPass            string           `json:"hostpass"                yaml:"hostpass"`
	Name                string           `json:"name"                    yaml:"name"`
	OS                  string           `json:"os"                      yaml:"os"`
	OSFamily            string           `json:"os_family" yaml:"os_family"`
	OSVersion           string           `json:"os_version"                      yaml:"os_version"`
	KernelVersion       string           `json:"kernel_version" yaml:"kernel_version"`
	Interface           string           `json:"interface"               yaml:"interface"`
	Debug               bool             `json:"debug"                   yaml:"debug"`
	ListenPort          int              `json:"listenport"              yaml:"listenport"`
	WgPublicListenPort  int              `json:"wg_public_listen_port"   yaml:"wg_public_listen_port"`
	MTU                 int              `json:"mtu"                     yaml:"mtu"`
	PublicKey           wgtypes.Key      `json:"publickey"               yaml:"publickey"`
	MacAddress          net.HardwareAddr `json:"macaddress"              yaml:"macaddress"`
	TrafficKeyPublic    []byte           `json:"traffickeypublic"        yaml:"traffickeypublic"`
	Nodes               []string         `json:"nodes"                   yaml:"nodes"`
	Interfaces          []Iface          `json:"interfaces"              yaml:"interfaces"`
	DefaultInterface    string           `json:"defaultinterface"        yaml:"defaultinterface"`
	EndpointIP          net.IP           `json:"endpointip"              yaml:"endpointip"`
	EndpointIPv6        net.IP           `json:"endpointipv6"            yaml:"endpointipv6"`
	IsDocker            bool             `json:"isdocker"                yaml:"isdocker"`
	IsK8S               bool             `json:"isk8s"                   yaml:"isk8s"`
	IsStaticPort        bool             `json:"isstaticport"            yaml:"isstaticport"`
	IsStatic            bool             `json:"isstatic"        yaml:"isstatic"`
	IsDefault           bool             `json:"isdefault"               yaml:"isdefault"`
	DNS                 string           `json:"dns_status"               yaml:"dns_status"`
	NatType             string           `json:"nat_type,omitempty"      yaml:"nat_type,omitempty"`
	TurnEndpoint        *netip.AddrPort  `json:"turn_endpoint,omitempty" yaml:"turn_endpoint,omitempty"`
	PersistentKeepalive time.Duration    `json:"persistentkeepalive" swaggertype:"primitive,integer" format:"int64" yaml:"persistentkeepalive"`
	Location            string           `json:"location"` // Format: "lat,lon"
	CountryCode         string           `json:"country_code"`
	EnableFlowLogs      bool             `json:"enable_flow_logs" yaml:"enable_flow_logs"`
}

Host - represents a host on the network

func (*Host) ConvertNMHostToAPI

func (h *Host) ConvertNMHostToAPI() *ApiHost

Host.ConvertNMHostToAPI - converts a Netmaker host to an API editable host

type HostInfoMap

type HostInfoMap map[string]HostNetworkInfo

HostInfoMap - map of host public keys to host networking info

type HostMqAction

type HostMqAction string

HostMqAction - type for host update action

const (
	// Upgrade - const to request host to update it's client
	Upgrade HostMqAction = "UPGRADE"
	// ForceUpgrade - const for forcing a host to upgrade its client binary
	ForceUpgrade HostMqAction = "FORCE_UPGRADE"
	// SignalHost - const for host signal action
	SignalHost HostMqAction = "SIGNAL_HOST"
	// UpdateHost - constant for host update action
	UpdateHost HostMqAction = "UPDATE_HOST"
	// UpdateNode - constant for Node update action
	UpdateNode HostMqAction = "UPDATE_NODE"
	// DeleteHost - constant for host delete action
	DeleteHost HostMqAction = "DELETE_HOST"
	// JoinHostToNetwork - constant for host network join action
	JoinHostToNetwork HostMqAction = "JOIN_HOST_TO_NETWORK"
	// Acknowledgement - ACK response for hosts
	Acknowledgement HostMqAction = "ACK"
	// RequestAck - request an ACK
	RequestAck HostMqAction = "REQ_ACK"
	// CheckIn - update last check in times and public address and interfaces
	CheckIn HostMqAction = "CHECK_IN"
	// UpdateKeys - update wireguard private/public keys
	UpdateKeys HostMqAction = "UPDATE_KEYS"
	// RequestPull - request a pull from a host
	RequestPull HostMqAction = "REQ_PULL"
	// SignalPull - request a pull from a host without restart
	SignalPull HostMqAction = "SIGNAL_PULL"
	// UpdateMetrics - updates metrics data
	UpdateMetrics HostMqAction = "UPDATE_METRICS"
	// EgressUpdate - const for egress update action
	EgressUpdate HostMqAction = "EGRESS_UPDATE"
	// CHECK_ASSIGN_GW - const for to auto assign gw action
	CheckAutoAssignGw HostMqAction = "CHECK_AUTO_ASSIGN_GW"
)

type HostNetworkInfo

type HostNetworkInfo struct {
	Interfaces   []Iface `json:"interfaces" yaml:"interfaces"`
	ListenPort   int     `json:"listen_port" yaml:"listen_port"`
	IsStaticPort bool    `json:"is_static_port"`
	IsStatic     bool    `json:"is_static"`
	Version      string  `json:"version"`
}

HostNetworkInfo - holds info related to host networking (used for client side peer calculations)

type HostPeerInfo added in v0.90.0

type HostPeerInfo struct {
	NetworkPeerIDs map[NetworkID]PeerMap `json:"network_peers"`
}

type HostPeerUpdate

type HostPeerUpdate struct {
	Host               Host                    `json:"host"`
	Nodes              []Node                  `json:"nodes"`
	ChangeDefaultGw    bool                    `json:"change_default_gw"`
	DefaultGwIp        net.IP                  `json:"default_gw_ip"`
	IsInternetGw       bool                    `json:"is_inet_gw"`
	NodeAddrs          []net.IPNet             `json:"nodes_addrs"`
	Server             string                  `json:"server"`
	ServerVersion      string                  `json:"serverversion"`
	ServerAddrs        []ServerAddr            `json:"serveraddrs"`
	NodePeers          []wgtypes.PeerConfig    `json:"node_peers"`
	Peers              []wgtypes.PeerConfig    `json:"host_peers"`
	PeerIDs            PeerMap                 `json:"peerids"`
	HostNetworkInfo    HostInfoMap             `json:"host_network_info,omitempty"`
	EgressRoutes       []EgressNetworkRoutes   `json:"egress_network_routes"`
	FwUpdate           FwUpdate                `json:"fw_update"`
	ReplacePeers       bool                    `json:"replace_peers"`
	NameServers        []string                `json:"name_servers"`
	DnsNameservers     []Nameserver            `json:"dns_nameservers"`
	EgressWithDomains  []EgressDomain          `json:"egress_with_domains"`
	AutoRelayNodes     map[NetworkID][]Node    `json:"auto_relay_nodes"`
	GwNodes            map[NetworkID][]Node    `json:"gw_nodes"`
	AddressIdentityMap map[string]PeerIdentity `json:"address_identity_map"`
	ServerConfig
	OldPeerUpdateFields
}

HostPeerUpdate - struct for host peer updates

type HostPull

type HostPull struct {
	Host               Host                    `json:"host" yaml:"host"`
	Nodes              []Node                  `json:"nodes" yaml:"nodes"`
	Peers              []wgtypes.PeerConfig    `json:"peers" yaml:"peers"`
	ServerConfig       ServerConfig            `json:"server_config" yaml:"server_config"`
	PeerIDs            PeerMap                 `json:"peer_ids,omitempty" yaml:"peer_ids,omitempty"`
	HostNetworkInfo    HostInfoMap             `json:"host_network_info,omitempty"  yaml:"host_network_info,omitempty"`
	EgressRoutes       []EgressNetworkRoutes   `json:"egress_network_routes"`
	FwUpdate           FwUpdate                `json:"fw_update"`
	ChangeDefaultGw    bool                    `json:"change_default_gw"`
	DefaultGwIp        net.IP                  `json:"default_gw_ip"`
	IsInternetGw       bool                    `json:"is_inet_gw"`
	EndpointDetection  bool                    `json:"endpoint_detection"`
	NameServers        []string                `json:"name_servers"`
	EgressWithDomains  []EgressDomain          `json:"egress_with_domains"`
	DnsNameservers     []Nameserver            `json:"dns_nameservers"`
	AutoRelayNodes     map[NetworkID][]Node    `json:"auto_relay_nodes"`
	GwNodes            map[NetworkID][]Node    `json:"gw_nodes"`
	ReplacePeers       bool                    `json:"replace_peers"`
	AddressIdentityMap map[string]PeerIdentity `json:"address_identity_map"`
}

HostPull - response of a host's pull

type HostRelayRequest

type HostRelayRequest struct {
	HostID       string   `json:"host_id"`
	RelayedHosts []string `json:"relayed_hosts"`
}

HostRelayRequest - struct for host relay creation

type HostTurnRegister

type HostTurnRegister struct {
	HostID       string `json:"host_id"`
	HostPassHash string `json:"host_pass_hash"`
}

HostTurnRegister - struct for host turn registration

type HostUpdate

type HostUpdate struct {
	Action       HostMqAction
	Host         Host
	Node         Node
	Signal       Signal
	EgressDomain EgressDomain
	NewMetrics   Metrics
}

HostUpdate - struct for host update

type IDPSyncStatus added in v1.1.0

type IDPSyncStatus struct {
	// Status would be one of: in_progress, completed or failed.
	Status string `json:"status"`
	// Description is empty if the sync is ongoing or completed,
	// and describes the error when the sync fails.
	Description string `json:"description"`
}

type IDPSyncTestRequest added in v1.1.0

type IDPSyncTestRequest struct {
	AuthProvider      string `json:"auth_provider"`
	ClientID          string `json:"client_id"`
	ClientSecret      string `json:"client_secret"`
	AzureTenantID     string `json:"azure_tenant_id"`
	GoogleAdminEmail  string `json:"google_admin_email"`
	GoogleSACredsJson string `json:"google_sa_creds_json"`
	OktaOrgURL        string `json:"okta_org_url"`
	OktaAPIToken      string `json:"okta_api_token"`
}

type IDandAddr

type IDandAddr struct {
	ID          string `json:"id" bson:"id" yaml:"id"`
	HostID      string `json:"host_id"`
	Address     string `json:"address" bson:"address" yaml:"address"`
	Address4    string `json:"address4"`
	Address6    string `json:"address6"`
	Name        string `json:"name" bson:"name" yaml:"name"`
	IsServer    string `json:"isserver" bson:"isserver" yaml:"isserver" validate:"checkyesorno"`
	Network     string `json:"network" bson:"network" yaml:"network" validate:"network"`
	ListenPort  int    `json:"listen_port" yaml:"listen_port"`
	IsExtClient bool   `json:"is_extclient"`
	UserName    string `json:"username"`
}

IDandAddr - struct to hold ID and primary Address

type Iface

type Iface struct {
	Name          string    `json:"name"`
	Address       net.IPNet `json:"address"`
	AddressString string    `json:"addressString"`
}

Iface struct for local interfaces of a node

type InetNodeReq added in v0.23.0

type InetNodeReq struct {
	InetNodeClientIDs []string `json:"inet_node_client_ids"`
}

InetNodeReq - exit node request struct

type IngressGwUsers

type IngressGwUsers struct {
	NodeID  string       `json:"node_id"`
	Network string       `json:"network"`
	Users   []ReturnUser `json:"users"`
}

IngressGwUsers - struct to hold users on a ingress gw

type IngressInfo

type IngressInfo struct {
	IngressID     string      `json:"ingress_id"`
	Network       net.IPNet   `json:"network"`
	Network6      net.IPNet   `json:"network6"`
	StaticNodeIps []net.IP    `json:"static_node_ips"`
	Rules         []FwRule    `json:"rules"`
	EgressRanges  []net.IPNet `json:"egress_ranges"`
	EgressRanges6 []net.IPNet `json:"egress_ranges6"`
}

IngressInfo - struct for ingress info

type IngressRequest

type IngressRequest struct {
	ExtclientDNS        string `json:"extclientdns"`
	IsInternetGateway   bool   `json:"is_internet_gw"`
	Metadata            string `json:"metadata"`
	PersistentKeepalive int32  `json:"persistentkeepalive"`
	MTU                 int32  `json:"mtu"`
}

IngressRequest - ingress request struct

type IntClient

type IntClient struct {
	ClientID             string `json:"clientid" bson:"clientid"`
	PrivateKey           string `json:"privatekey" bson:"privatekey"`
	PublicKey            string `json:"publickey" bson:"publickey"`
	AccessKey            string `json:"accesskey" bson:"accesskey"`
	Address              string `json:"address" bson:"address"`
	Address6             string `json:"address6" bson:"address6"`
	Network              string `json:"network" bson:"network"`
	ServerPublicEndpoint string `json:"serverpublicendpoint" bson:"serverpublicendpoint"`
	ServerAPIPort        string `json:"serverapiport" bson:"serverapiport"`
	ServerPrivateAddress string `json:"serverprivateaddress" bson:"serverprivateaddress"`
	ServerWGPort         string `json:"serverwgport" bson:"serverwgport"`
	ServerKey            string `json:"serverkey" bson:"serverkey"`
	IsServer             string `json:"isserver" bson:"isserver"`
}

type InviteUsersReq added in v0.25.0

type InviteUsersReq struct {
	UserEmails     []string                              `json:"user_emails"`
	PlatformRoleID string                                `json:"platform_role_id"`
	UserGroups     map[UserGroupID]struct{}              `json:"user_group_ids"`
	NetworkRoles   map[NetworkID]map[UserRoleID]struct{} `json:"network_roles"`
}

type JoinData

type JoinData struct {
	Host Host   `json:"host" yaml:"host"`
	Node Node   `json:"node" yaml:"node"`
	Key  string `json:"key" yaml:"key"`
}

JoinData - struct to hold data required for node to join a network on server

type KeyType

type KeyType int

KeyType - the type of enrollment key

const (
	Undefined KeyType = iota
	TimeExpiration
	Uses
	Unlimited
)

func (KeyType) String

func (k KeyType) String() string

String - returns the string representation of a KeyType

type KeyUpdate

type KeyUpdate struct {
	Network   string `json:"network" bson:"network"`
	Interface string `json:"interface" bson:"interface"`
}

KeyUpdate - key update struct

type LegacyNode

type LegacyNode struct {
	ID                      string               `` /* 128-byte string literal not displayed */
	Address                 string               `json:"address"                 bson:"address"                 yaml:"address"                 validate:"omitempty,ipv4"`
	Address6                string               `json:"address6"                bson:"address6"                yaml:"address6"                validate:"omitempty,ipv6"`
	LocalAddress            string               `json:"localaddress"            bson:"localaddress"            yaml:"localaddress"            validate:"omitempty"`
	Interfaces              []Iface              `json:"interfaces"                                             yaml:"interfaces"`
	Name                    string               `` /* 131-byte string literal not displayed */
	NetworkSettings         Network              `json:"networksettings"         bson:"networksettings"         yaml:"networksettings"         validate:"-"`
	ListenPort              int32                `` /* 140-byte string literal not displayed */
	LocalListenPort         int32                `` /* 127-byte string literal not displayed */
	PublicKey               string               `json:"publickey"               bson:"publickey"               yaml:"publickey"               validate:"required,base64"`
	Endpoint                string               `json:"endpoint"                bson:"endpoint"                yaml:"endpoint"                validate:"required,ip"`
	AllowedIPs              []string             `json:"allowedips"              bson:"allowedips"              yaml:"allowedips"`
	PersistentKeepalive     int32                `` /* 130-byte string literal not displayed */
	IsHub                   string               `json:"ishub"                   bson:"ishub"                   yaml:"ishub"                   validate:"checkyesorno"`
	AccessKey               string               `json:"accesskey"               bson:"accesskey"               yaml:"accesskey"`
	Interface               string               `json:"interface"               bson:"interface"               yaml:"interface"`
	LastModified            int64                `` /* 128-byte string literal not displayed */
	ExpirationDateTime      int64                `` /* 127-byte string literal not displayed */
	LastPeerUpdate          int64                `` /* 130-byte string literal not displayed */
	LastCheckIn             int64                `` /* 127-byte string literal not displayed */
	MacAddress              string               `json:"macaddress"              bson:"macaddress"              yaml:"macaddress"`
	Password                string               `json:"password"                bson:"password"                yaml:"password"                validate:"required,min=6"`
	Network                 string               `json:"network"                 bson:"network"                 yaml:"network"                 validate:"network_exists"`
	IsRelayed               string               `json:"isrelayed"               bson:"isrelayed"               yaml:"isrelayed"`
	IsPending               string               `json:"ispending"               bson:"ispending"               yaml:"ispending"`
	IsRelay                 string               `json:"isrelay"                 bson:"isrelay"                 yaml:"isrelay"                 validate:"checkyesorno"`
	IsDocker                string               `json:"isdocker"                bson:"isdocker"                yaml:"isdocker"                validate:"checkyesorno"`
	IsK8S                   string               `json:"isk8s"                   bson:"isk8s"                   yaml:"isk8s"                   validate:"checkyesorno"`
	IsEgressGateway         string               `json:"isegressgateway"         bson:"isegressgateway"         yaml:"isegressgateway"         validate:"checkyesorno"`
	IsIngressGateway        string               `json:"isingressgateway"        bson:"isingressgateway"        yaml:"isingressgateway"        validate:"checkyesorno"`
	EgressGatewayRanges     []string             `json:"egressgatewayranges"     bson:"egressgatewayranges"     yaml:"egressgatewayranges"`
	EgressGatewayNatEnabled string               `json:"egressgatewaynatenabled" bson:"egressgatewaynatenabled" yaml:"egressgatewaynatenabled"`
	EgressGatewayRequest    EgressGatewayRequest `json:"egressgatewayrequest"    bson:"egressgatewayrequest"    yaml:"egressgatewayrequest"`
	RelayAddrs              []string             `json:"relayaddrs"              bson:"relayaddrs"              yaml:"relayaddrs"`
	FailoverNode            string               `json:"failovernode"            bson:"failovernode"            yaml:"failovernode"`
	IngressGatewayRange     string               `json:"ingressgatewayrange"     bson:"ingressgatewayrange"     yaml:"ingressgatewayrange"`
	IngressGatewayRange6    string               `json:"ingressgatewayrange6"    bson:"ingressgatewayrange6"    yaml:"ingressgatewayrange6"`
	// IsStatic - refers to if the Endpoint is set manually or dynamically
	IsStatic        string      `json:"isstatic"                bson:"isstatic"                yaml:"isstatic"                validate:"checkyesorno"`
	UDPHolePunch    string      `json:"udpholepunch"            bson:"udpholepunch"            yaml:"udpholepunch"            validate:"checkyesorno"`
	DNSOn           string      `json:"dnson"                   bson:"dnson"                   yaml:"dnson"                   validate:"checkyesorno"`
	IsServer        string      `json:"isserver"                bson:"isserver"                yaml:"isserver"                validate:"checkyesorno"`
	Action          string      `json:"action"                  bson:"action"                  yaml:"action"`
	IPForwarding    string      `json:"ipforwarding"            bson:"ipforwarding"            yaml:"ipforwarding"            validate:"checkyesorno"`
	OS              string      `json:"os"                      bson:"os"                      yaml:"os"`
	MTU             int32       `json:"mtu"                     bson:"mtu"                     yaml:"mtu"`
	Version         string      `json:"version"                 bson:"version"                 yaml:"version"`
	Server          string      `json:"server"                  bson:"server"                  yaml:"server"`
	TrafficKeys     TrafficKeys `json:"traffickeys"             bson:"traffickeys"             yaml:"traffickeys"`
	FirewallInUse   string      `json:"firewallinuse"           bson:"firewallinuse"           yaml:"firewallinuse"`
	InternetGateway string      `json:"internetgateway"         bson:"internetgateway"         yaml:"internetgateway"`
	Connected       string      `json:"connected"               bson:"connected"               yaml:"connected"               validate:"checkyesorno"`
	// == PRO ==
	DefaultACL string `json:"defaultacl,omitempty"    bson:"defaultacl,omitempty"    yaml:"defaultacl,omitempty"    validate:"checkyesornoorunset"`
	OwnerID    string `json:"ownerid,omitempty"       bson:"ownerid,omitempty"       yaml:"ownerid,omitempty"`
	Failover   string `json:"failover"                bson:"failover"                yaml:"failover"                validate:"checkyesorno"`
}

LegacyNode - legacy struct for node model

func (*LegacyNode) ConvertToNewNode

func (ln *LegacyNode) ConvertToNewNode() (*Host, *Node)

func (*LegacyNode) NameInNodeCharSet

func (node *LegacyNode) NameInNodeCharSet() bool

Node.NameInNodeCharset - returns if name is in charset below or not

func (*LegacyNode) SetDNSOnDefault

func (node *LegacyNode) SetDNSOnDefault()

Node.SetDNSOnDefault - sets dns on default

func (*LegacyNode) SetDefaultACL

func (node *LegacyNode) SetDefaultACL()

Node.SetDefaultACL

func (*LegacyNode) SetDefaultAction

func (node *LegacyNode) SetDefaultAction()

Node.SetDefaultAction - sets default action status

func (*LegacyNode) SetDefaultEgressGateway

func (node *LegacyNode) SetDefaultEgressGateway()

Node.SetDefaultEgressGateway - sets default egress gateway status

func (*LegacyNode) SetDefaultFailover

func (node *LegacyNode) SetDefaultFailover()

Node.SetDefaultFailover - sets default value of failover status to no if not set

func (*LegacyNode) SetDefaultIngressGateway

func (node *LegacyNode) SetDefaultIngressGateway()

Node.SetDefaultIngressGateway - sets default ingress gateway status

func (*LegacyNode) SetDefaultIsDocker

func (node *LegacyNode) SetDefaultIsDocker()

Node.SetDefaultIsDocker - set default isdocker

func (*LegacyNode) SetDefaultIsHub

func (node *LegacyNode) SetDefaultIsHub()

Node.SetDefaultIsRelayed - set default is relayed

func (*LegacyNode) SetDefaultIsK8S

func (node *LegacyNode) SetDefaultIsK8S()

Node.SetDefaultIsK8S - set default isk8s

func (*LegacyNode) SetDefaultIsRelay

func (node *LegacyNode) SetDefaultIsRelay()

Node.SetDefaultIsRelay - set default isrelay

func (*LegacyNode) SetDefaultIsRelayed

func (node *LegacyNode) SetDefaultIsRelayed()

Node.SetDefaultIsRelayed - set default is relayed

func (*LegacyNode) SetDefaultMTU

func (node *LegacyNode) SetDefaultMTU()

Node.SetDefaultMTU - sets default MTU of a node

func (*LegacyNode) SetDefaultNFTablesPresent

func (node *LegacyNode) SetDefaultNFTablesPresent()

Node.SetDefaultNFTablesPresent - sets default for nftables check

func (*LegacyNode) SetDefaultName

func (node *LegacyNode) SetDefaultName()

Node.SetDefaultName - sets a random name to node

func (*LegacyNode) SetIPForwardingDefault

func (node *LegacyNode) SetIPForwardingDefault()

Node.SetIPForwardingDefault - set ip forwarding default

func (*LegacyNode) SetIsServerDefault

func (node *LegacyNode) SetIsServerDefault()

Node.SetIsServerDefault - sets node isserver default

func (*LegacyNode) SetIsStaticDefault

func (node *LegacyNode) SetIsStaticDefault()

Node.SetIsStaticDefault - set is static default

type LicenseLimits

type LicenseLimits struct {
	Servers  int `json:"servers"`
	Users    int `json:"users"`
	Hosts    int `json:"hosts"`
	Clients  int `json:"clients"`
	Networks int `json:"networks"`
}

LicenseLimits - struct license limits

type LoginReqDto added in v0.22.0

type LoginReqDto struct {
	Email    string `json:"email"`
	TenantID string `json:"tenant_id"`
}

type Metric

type Metric struct {
	NodeName          string        `json:"node_name" bson:"node_name" yaml:"node_name"`
	Uptime            int64         `json:"uptime" bson:"uptime" yaml:"uptime" swaggertype:"primitive,integer" format:"int64"`
	TotalTime         int64         `json:"totaltime" bson:"totaltime" yaml:"totaltime" swaggertype:"primitive,integer" format:"int64"`
	Latency           int64         `json:"latency" bson:"latency" yaml:"latency" swaggertype:"primitive,integer" format:"int64"`
	TotalReceived     int64         `json:"totalreceived" bson:"totalreceived" yaml:"totalreceived" swaggertype:"primitive,integer" format:"int64"`
	LastTotalReceived int64         `json:"lasttotalreceived" bson:"lasttotalreceived" yaml:"lasttotalreceived" swaggertype:"primitive,integer" format:"int64"`
	TotalSent         int64         `json:"totalsent" bson:"totalsent" yaml:"totalsent" swaggertype:"primitive,integer" format:"int64"`
	LastTotalSent     int64         `json:"lasttotalsent" bson:"lasttotalsent" yaml:"lasttotalsent" swaggertype:"primitive,integer" format:"int64"`
	ActualUptime      time.Duration `json:"actualuptime" swaggertype:"primitive,integer" format:"int64" bson:"actualuptime" yaml:"actualuptime"`
	PercentUp         float64       `json:"percentup" bson:"percentup" yaml:"percentup"`
	Connected         bool          `json:"connected" bson:"connected" yaml:"connected"`
}

Metric - holds a metric for data between nodes

type Metrics

type Metrics struct {
	Network      string            `json:"network" bson:"network" yaml:"network"`
	NodeID       string            `json:"node_id" bson:"node_id" yaml:"node_id"`
	NodeName     string            `json:"node_name" bson:"node_name" yaml:"node_name"`
	Connectivity map[string]Metric `json:"connectivity" bson:"connectivity" yaml:"connectivity"`
	UpdatedAt    time.Time         `json:"updated_at" bson:"updated_at" yaml:"updated_at"`
}

Metrics - metrics struct

type MetricsMap

type MetricsMap map[string]Metrics

MetricsMap - map for holding multiple metrics in memory

type MigrationData

type MigrationData struct {
	HostName    string
	Password    string
	OS          string
	LegacyNodes []LegacyNode
}

MigrationData struct needed to create new v0.18.0 node from v.0.17.X node

type Nameserver added in v1.1.0

type Nameserver struct {
	IPs            []string `json:"ips"`
	MatchDomain    string   `json:"match_domain"`
	IsSearchDomain bool     `json:"is_search_domain"`
	IsFallback     bool     `json:"is_fallback"`
}

type NameserverReq added in v1.1.0

type NameserverReq struct {
	Name        string   `json:"name"`
	Network     string   `json:"network"`
	Description string   ` json:"description"`
	Servers     []string `json:"servers"`
	MatchDomain string   `json:"match_domain"`
	Tags        []string `json:"tags"`
	Status      bool     `gorm:"status" json:"status"`
}

type Network

type Network struct {
	AddressRange        string   `json:"addressrange" bson:"addressrange" validate:"omitempty,cidrv4"`
	AddressRange6       string   `json:"addressrange6" bson:"addressrange6" validate:"omitempty,cidrv6"`
	NetID               string   `json:"netid" bson:"netid" validate:"required,min=1,max=32,netid_valid"`
	NodesLastModified   int64    `json:"nodeslastmodified" bson:"nodeslastmodified" swaggertype:"primitive,integer" format:"int64"`
	NetworkLastModified int64    `json:"networklastmodified" bson:"networklastmodified" swaggertype:"primitive,integer" format:"int64"`
	DefaultInterface    string   `json:"defaultinterface" bson:"defaultinterface" validate:"min=1,max=35"`
	DefaultListenPort   int32    `json:"defaultlistenport,omitempty" bson:"defaultlistenport,omitempty" validate:"omitempty,min=1024,max=65535"`
	NodeLimit           int32    `json:"nodelimit" bson:"nodelimit"`
	DefaultPostDown     string   `json:"defaultpostdown" bson:"defaultpostdown"`
	DefaultKeepalive    int32    `json:"defaultkeepalive" bson:"defaultkeepalive" validate:"omitempty,max=1000"`
	AllowManualSignUp   string   `json:"allowmanualsignup" bson:"allowmanualsignup" validate:"checkyesorno"`
	IsIPv4              string   `json:"isipv4" bson:"isipv4" validate:"checkyesorno"`
	IsIPv6              string   `json:"isipv6" bson:"isipv6" validate:"checkyesorno"`
	DefaultUDPHolePunch string   `json:"defaultudpholepunch" bson:"defaultudpholepunch" validate:"checkyesorno"`
	DefaultMTU          int32    `json:"defaultmtu" bson:"defaultmtu"`
	DefaultACL          string   `json:"defaultacl" bson:"defaultacl" yaml:"defaultacl" validate:"checkyesorno"`
	NameServers         []string `json:"dns_nameservers"`
	AutoJoin            string   `json:"auto_join"`
	AutoRemove          string   `json:"auto_remove"`
	AutoRemoveTags      []string `json:"auto_remove_tags"`
	AutoRemoveThreshold int      `json:"auto_remove_threshold_mins"`
}

Network Struct - contains info for a given unique network At some point, need to replace all instances of Name with something else like Identifier

func (*Network) GetNetworkNetworkCIDR4 added in v0.21.2

func (network *Network) GetNetworkNetworkCIDR4() *net.IPNet

func (*Network) GetNetworkNetworkCIDR6 added in v0.21.2

func (network *Network) GetNetworkNetworkCIDR6() *net.IPNet

func (*Network) SetDefaults

func (network *Network) SetDefaults() (upsert bool)

Network.SetDefaults - sets default values for a network struct

func (*Network) SetNetworkLastModified

func (network *Network) SetNetworkLastModified()

Network.SetNetworkLastModified - sets network last modified time

func (*Network) SetNodesLastModified

func (network *Network) SetNodesLastModified()

Network.SetNodesLastModified - sets nodes last modified on network, depricated

type NetworkID added in v0.25.0

type NetworkID string
const AllNetworks NetworkID = "all_networks"

func (NetworkID) String added in v0.25.0

func (n NetworkID) String() string

type NetworkMetrics

type NetworkMetrics struct {
	Nodes MetricsMap `json:"nodes" bson:"nodes" yaml:"nodes"`
}

NetworkMetrics - metrics model for all nodes in a network

type NetworkStatResp added in v0.26.0

type NetworkStatResp struct {
	Network
	Hosts int `json:"hosts"`
}

type NetworkUsage added in v1.2.0

type NetworkUsage struct {
	Nodes            int `json:"nodes"`
	Clients          int `json:"clients"`
	Ingresses        int `json:"ingresses"`
	Egresses         int `json:"egresses"`
	Relays           int `json:"relays"`
	InternetGateways int `json:"internet_gateways"`
	FailOvers        int `json:"fail_overs"`
}

type Node

type Node struct {
	CommonNode
	PendingDelete              bool                 `json:"pendingdelete"`
	LastModified               time.Time            `json:"lastmodified"`
	LastCheckIn                time.Time            `json:"lastcheckin"`
	LastPeerUpdate             time.Time            `json:"lastpeerupdate"`
	ExpirationDateTime         time.Time            `json:"expdatetime"`
	EgressGatewayNatEnabled    bool                 `json:"egressgatewaynatenabled"`
	EgressGatewayRequest       EgressGatewayRequest `json:"egressgatewayrequest"`
	IngressGatewayRange        string               `json:"ingressgatewayrange"`
	IngressGatewayRange6       string               `json:"ingressgatewayrange6"`
	IngressPersistentKeepalive int32                `json:"ingresspersistentkeepalive"`
	IngressMTU                 int32                `json:"ingressmtu"`
	Metadata                   string               `json:"metadata"`
	// == PRO ==
	DefaultACL  string `json:"defaultacl,omitempty" validate:"checkyesornoorunset"`
	OwnerID     string `json:"ownerid,omitempty"`
	IsFailOver  bool   `json:"is_fail_over"`
	IsAutoRelay bool   `json:"is_auto_relay"`
	//AutoRelayedPeers   map[string]struct{} `json:"auto_relayed_peers"`
	AutoRelayedPeers map[string]string `json:"auto_relayed_peers_v1"`
	//AutoRelayedBy     uuid.UUID           `json:"auto_relayed_by"`
	FailOverPeers                     map[string]struct{} `json:"fail_over_peers"`
	FailedOverBy                      uuid.UUID           `json:"failed_over_by"`
	IsInternetGateway                 bool                `json:"isinternetgateway"`
	InetNodeReq                       InetNodeReq         `json:"inet_node_req"`
	InternetGwID                      string              `json:"internetgw_node_id"`
	AdditionalRagIps                  []net.IP            `json:"additional_rag_ips" swaggertype:"array,number"`
	Tags                              map[TagID]struct{}  `json:"tags"`
	IsStatic                          bool                `json:"is_static"`
	IsUserNode                        bool                `json:"is_user_node"`
	StaticNode                        ExtClient           `json:"static_node"`
	Status                            NodeStatus          `json:"node_status"`
	Mutex                             *sync.Mutex         `json:"-"`
	EgressDetails                     EgressDetails       `json:"-"`
	PostureChecksViolations           []Violation         `json:"posture_check_violations"`
	PostureCheckVolationSeverityLevel Severity            `json:"posture_check_violation_severity_level"`
	LastEvaluatedAt                   time.Time           `json:"last_evaluated_at"`
	Location                          string              `json:"location"` // Format: "lat,lon"
	CountryCode                       string              `json:"country_code"`
}

Node - a model of a network node

func (*Node) AddressIPNet4 added in v0.30.0

func (node *Node) AddressIPNet4() net.IPNet

func (*Node) AddressIPNet6 added in v0.30.0

func (node *Node) AddressIPNet6() net.IPNet

func (*Node) ConvertToAPINode

func (nm *Node) ConvertToAPINode() *ApiNode

Node.ConvertToAPINode - converts a node to an API node

func (*Node) ConvertToStatusNode added in v0.90.0

func (nm *Node) ConvertToStatusNode() *ApiNodeStatus

func (*Node) DoesACLAllow

func (node *Node) DoesACLAllow() bool

Node.DoesACLAllow - checks if default ACL on node is "yes"

func (*Node) DoesACLDeny

func (node *Node) DoesACLDeny() bool

Node.DoesACLDeny - checks if default ACL on node is "no"

func (*Node) Fill

func (newNode *Node) Fill(
	currentNode *Node,
	isPro bool,
)

Node.Fill - fills other node data into calling node data if not set on calling node (skips DNSOn)

func (*Node) Legacy

func (n *Node) Legacy(h *Host, s *ServerConfig, net *Network) *LegacyNode

Node.Legacy converts node to legacy format

func (*Node) NetworkSettings

func (node *Node) NetworkSettings(n Network)

Node.NetworkSettings updates a node with network settings

func (*Node) PrimaryAddress

func (node *Node) PrimaryAddress() string

Node.PrimaryAddress - return ipv4 address if present, else return ipv6

func (*Node) PrimaryAddressIPNet

func (node *Node) PrimaryAddressIPNet() net.IPNet

Node.PrimaryAddress - return ipv4 address if present, else return ipv6

func (*Node) PrimaryNetworkRange

func (node *Node) PrimaryNetworkRange() net.IPNet

Node.PrimaryNetworkRange - returns node's parent network, returns ipv4 address if present, else return ipv6

func (*Node) SetDefaultConnected

func (node *Node) SetDefaultConnected()

Node.SetDefaultConnected

func (*Node) SetExpirationDateTime

func (node *Node) SetExpirationDateTime()

Node.SetExpirationDateTime - sets node expiry time

func (*Node) SetLastCheckIn

func (node *Node) SetLastCheckIn()

Node.SetLastCheckIn - set checkin time of node

func (*Node) SetLastModified

func (node *Node) SetLastModified()

Node.SetLastModified - set last modified initial time

func (*Node) SetLastPeerUpdate

func (node *Node) SetLastPeerUpdate()

Node.SetLastPeerUpdate - sets last peer update time

type NodeAuth

type NodeAuth struct {
	Network    string
	Password   string
	MacAddress string // Depricated
	ID         string
}

NodeAuth - struct for node auth

type NodeCheckin

type NodeCheckin struct {
	Version   string
	Connected bool
	Ifaces    []Iface
}

NodeCheckin - struct for node checkins with server

type NodeGet

type NodeGet struct {
	Node         Node                 `json:"node" bson:"node" yaml:"node"`
	Host         Host                 `json:"host" yaml:"host"`
	Peers        []wgtypes.PeerConfig `json:"peers" bson:"peers" yaml:"peers"`
	HostPeers    []wgtypes.PeerConfig `json:"host_peers" bson:"host_peers" yaml:"host_peers"`
	ServerConfig ServerConfig         `json:"serverconfig" bson:"serverconfig" yaml:"serverconfig"`
	PeerIDs      PeerMap              `json:"peerids,omitempty" bson:"peerids,omitempty" yaml:"peerids,omitempty"`
}

NodeGet - struct for a single node get response

type NodeJoinResponse

type NodeJoinResponse struct {
	Node         Node                 `json:"node" bson:"node" yaml:"node"`
	Host         Host                 `json:"host" yaml:"host"`
	ServerConfig ServerConfig         `json:"serverconfig" bson:"serverconfig" yaml:"serverconfig"`
	Peers        []wgtypes.PeerConfig `json:"peers" bson:"peers" yaml:"peers"`
}

NodeJoinResponse data returned to node in response to join

type NodeStatus added in v0.30.0

type NodeStatus string
const (
	OnlineSt     NodeStatus = "online"
	OfflineSt    NodeStatus = "offline"
	WarningSt    NodeStatus = "warning"
	ErrorSt      NodeStatus = "error"
	UnKnown      NodeStatus = "unknown"
	Disconnected NodeStatus = "disconnected"
)

type NodesArray

type NodesArray []Node

NodesArray - used for node sorting

func (NodesArray) Len

func (a NodesArray) Len() int

NodesArray.Len - gets length of node array

func (NodesArray) Less

func (a NodesArray) Less(i, j int) bool

NodesArray.Less - gets returns lower rank of two node addressesFill

func (NodesArray) Swap

func (a NodesArray) Swap(i, j int)

NodesArray.Swap - swaps two nodes in array

type OldPeerUpdateFields added in v0.90.0

type OldPeerUpdateFields struct {
	NodePeers         []wgtypes.PeerConfig `json:"peers" bson:"peers" yaml:"peers"`
	OldPeers          []wgtypes.PeerConfig `json:"Peers"`
	EndpointDetection bool                 `json:"endpoint_detection"`
}

type Origin added in v0.99.0

type Origin string
const (
	Dashboard Origin = "DASHBOARD"
	Api       Origin = "API"
	NMCTL     Origin = "NMCTL"
	ClientApp Origin = "CLIENT-APP"
)

type PartialUserLoginResponse added in v1.0.0

type PartialUserLoginResponse struct {
	UserName     string `json:"user_name"`
	PreAuthToken string `json:"pre_auth_token"`
}

PartialUserLoginResponse represents the response returned to the client after successful username and password authentication, but before the completion of TOTP authentication.

This response includes a temporary token required to complete the authentication process.

type PeerIdentity added in v1.4.0

type PeerIdentity struct {
	ID   string   `json:"id"`
	Type PeerType `json:"type"`
}

type PeerMap

type PeerMap map[string]IDandAddr

PeerMap - peer map for ids and addresses in metrics

type PeerRouteInfo

type PeerRouteInfo struct {
	PeerAddr net.IPNet `json:"peer_addr" yaml:"peer_addr"`
	PeerKey  string    `json:"peer_key" yaml:"peer_key"`
	Allow    bool      `json:"allow" yaml:"allow"`
	ID       string    `json:"id,omitempty" yaml:"id,omitempty"`
}

PeerRouteInfo - struct for peer info for an ext. client

type PeerType added in v1.4.0

type PeerType int
const (
	PeerType_Node PeerType = iota
	PeerType_User
	PeerType_WireGuard
	PeerType_EgressRoute
)

type PeersResponse

type PeersResponse struct {
	PublicKey           string `json:"publickey" bson:"publickey"`
	Endpoint            string `json:"endpoint" bson:"endpoint"`
	Address             string `json:"address" bson:"address"`
	Address6            string `json:"address6" bson:"address6"`
	LocalAddress        string `json:"localaddress" bson:"localaddress"`
	LocalListenPort     int32  `json:"locallistenport" bson:"locallistenport"`
	IsEgressGateway     string `json:"isegressgateway" bson:"isegressgateway"`
	EgressGatewayRanges string `json:"egressgatewayrange" bson:"egressgatewayrange"`
	ListenPort          int32  `json:"listenport" bson:"listenport"`
	KeepAlive           int32  `json:"persistentkeepalive" bson:"persistentkeepalive"`
}

PeersResponse - peers response

type PostureCheckDeviceInfo added in v1.4.0

type PostureCheckDeviceInfo struct {
	ClientLocation string
	ClientVersion  string
	OS             string
	OSFamily       string
	OSVersion      string
	KernelVersion  string
	AutoUpdate     bool
	Tags           map[TagID]struct{}
	IsUser         bool
	UserGroups     map[UserGroupID]struct{}
}

type Protocol added in v0.30.0

type Protocol string

Protocol - allowed protocol

const (
	ALL  Protocol = "all"
	UDP  Protocol = "udp"
	TCP  Protocol = "tcp"
	ICMP Protocol = "icmp"
)

func (Protocol) String added in v0.30.0

func (p Protocol) String() string

type ProtocolType added in v0.30.0

type ProtocolType struct {
	Name             string     `json:"name"`
	AllowedProtocols []Protocol `json:"allowed_protocols"`
	PortRange        string     `json:"port_range"`
	AllowPortSetting bool       `json:"allow_port_setting"`
}

type RegisterMsg

type RegisterMsg struct {
	RegisterHost Host   `json:"host"`
	Network      string `json:"network,omitempty"`
	User         string `json:"user,omitempty"`
	Password     string `json:"password,omitempty"`
	JoinAll      bool   `json:"join_all,omitempty"`
	Relay        string `json:"relay,omitempty"`
}

RegisterMsg - login message struct for hosts to join via SSO login

type RegisterResponse

type RegisterResponse struct {
	ServerConf    ServerConfig `json:"server_config"`
	RequestedHost Host         `json:"requested_host"`
}

RegisterResponse - the response to a successful enrollment register

type RelayRequest

type RelayRequest struct {
	NodeID       string   `json:"nodeid"`
	NetID        string   `json:"netid"`
	RelayedNodes []string `json:"relayaddrs"`
}

RelayRequest - relay request struct

type ReturnUser

type ReturnUser struct {
	UserName                   string                                `json:"username"`
	ExternalIdentityProviderID string                                `json:"external_identity_provider_id"`
	IsMFAEnabled               bool                                  `json:"is_mfa_enabled"`
	DisplayName                string                                `json:"display_name"`
	AccountDisabled            bool                                  `json:"account_disabled"`
	IsAdmin                    bool                                  `json:"isadmin"`
	IsSuperAdmin               bool                                  `json:"issuperadmin"`
	AuthType                   AuthType                              `json:"auth_type"`
	RemoteGwIDs                map[string]struct{}                   `json:"remote_gw_ids"` // deprecated
	UserGroups                 map[UserGroupID]struct{}              `json:"user_group_ids"`
	PlatformRoleID             UserRoleID                            `json:"platform_role_id"`
	NetworkRoles               map[NetworkID]map[UserRoleID]struct{} `json:"network_roles"`
	LastLoginTime              time.Time                             `json:"last_login_time"`
	NumAccessTokens            int                                   `json:"num_access_tokens"`
}

ReturnUser - return user struct

type ReturnUserWithRolesAndGroups added in v0.25.0

type ReturnUserWithRolesAndGroups struct {
	ReturnUser
	PlatformRole UserRolePermissionTemplate `json:"platform_role"`
	UserGroups   map[UserGroupID]UserGroup  `json:"user_group_ids"`
}

type RsrcID added in v0.25.0

type RsrcID string
const (
	AllHostRsrcID           RsrcID = "all_host"
	AllRelayRsrcID          RsrcID = "all_relay"
	AllRemoteAccessGwRsrcID RsrcID = "all_remote_access_gw"
	AllExtClientsRsrcID     RsrcID = "all_extclients"
	AllInetGwRsrcID         RsrcID = "all_inet_gw"
	AllEgressGwRsrcID       RsrcID = "all_egress"
	AllNetworkRsrcID        RsrcID = "all_network"
	AllEnrollmentKeysRsrcID RsrcID = "all_enrollment_key"
	AllUserRsrcID           RsrcID = "all_user"
	AllDnsRsrcID            RsrcID = "all_dns"
	AllFailOverRsrcID       RsrcID = "all_fail_over"
	AllAclsRsrcID           RsrcID = "all_acl"
	AllTagsRsrcID           RsrcID = "all_tag"
	AllPostureCheckRsrcID   RsrcID = "all_posturecheck"
	AllNameserverRsrcID     RsrcID = "all_nameserver"
)

func (RsrcID) String added in v0.25.0

func (rid RsrcID) String() string

type RsrcPermissionScope added in v0.25.0

type RsrcPermissionScope struct {
	Create    bool `json:"create"`
	Read      bool `json:"read"`
	Update    bool `json:"update"`
	Delete    bool `json:"delete"`
	VPNaccess bool `json:"vpn_access"`
	SelfOnly  bool `json:"self_only"`
}

type RsrcType added in v0.25.0

type RsrcType string
const (
	HostRsrc           RsrcType = "host"
	RelayRsrc          RsrcType = "relay"
	RemoteAccessGwRsrc RsrcType = "remote_access_gw"
	GatewayRsrc        RsrcType = "gateway"
	ExtClientsRsrc     RsrcType = "extclient"
	InetGwRsrc         RsrcType = "inet_gw"
	EgressGwRsrc       RsrcType = "egress"
	NetworkRsrc        RsrcType = "network"
	EnrollmentKeysRsrc RsrcType = "enrollment_key"
	UserRsrc           RsrcType = "user"
	AclRsrc            RsrcType = "acl"
	TagRsrc            RsrcType = "tag"
	DnsRsrc            RsrcType = "dns"
	NameserverRsrc     RsrcType = "nameserver"
	FailOverRsrc       RsrcType = "fail_over"
	MetricRsrc         RsrcType = "metric"
	PostureCheckRsrc   RsrcType = "posturecheck"
)

func (RsrcType) String added in v0.25.0

func (r RsrcType) String() string

type RsrcURLInfo added in v0.25.0

type RsrcURLInfo struct {
	Method string
	Path   string
}

type SaveData

type SaveData struct {
	NetID string `json:"netid" bson:"netid" validate:"required,min=1,max=32,netid_valid"`
}

SaveData - sensitive fields of a network that should be kept the same

type ServerAddr

type ServerAddr struct {
	IsLeader bool   `json:"isleader" bson:"isleader" yaml:"isleader"`
	Address  string `json:"address" bson:"address" yaml:"address"`
}

ServerAddr - to pass to clients to tell server addresses and if it's the leader or not

type ServerConfig

type ServerConfig struct {
	CoreDNSAddr                 string `yaml:"corednsaddr"`
	API                         string `yaml:"api"`
	APIHost                     string `yaml:"apihost"`
	APIPort                     string `yaml:"apiport"`
	GRPC                        string `yaml:"grpc"`
	DNSMode                     string `yaml:"dnsmode"`
	Version                     string `yaml:"version"`
	MQPort                      string `yaml:"mqport"`
	MQUserName                  string `yaml:"mq_username"`
	MQPassword                  string `yaml:"mq_password"`
	BrokerType                  string `yaml:"broker_type"`
	Server                      string `yaml:"server"`
	Broker                      string `yaml:"broker"`
	IsPro                       bool   `yaml:"isee" json:"Is_EE"`
	TrafficKey                  []byte `yaml:"traffickey"`
	MetricInterval              string `yaml:"metric_interval"`
	MetricsPort                 int    `yaml:"metrics_port"`
	ManageDNS                   bool   `yaml:"manage_dns"`
	Stun                        bool   `yaml:"stun"`
	StunServers                 string `yaml:"stun_servers"`
	EndpointDetection           bool   `yaml:"endpoint_detection"`
	DefaultDomain               string `yaml:"default_domain"`
	PeerConnectionCheckInterval string `yaml:"peer_connection_check_interval"`
	OldAClsSupport              bool   `json:"-"`
}

ServerConfig - struct for dealing with the server information for a netclient

type ServerIDs

type ServerIDs struct {
	ServerIDs []string `json:"server_ids"`
}

ServerIDs - struct to hold server ids.

type ServerSettings added in v0.99.0

type ServerSettings struct {
	NetclientAutoUpdate bool     `json:"netclientautoupdate"`
	Verbosity           int32    `json:"verbosity"`
	AuthProvider        string   `json:"authprovider"`
	OIDCIssuer          string   `json:"oidcissuer"`
	ClientID            string   `json:"client_id"`
	ClientSecret        string   `json:"client_secret"`
	SyncEnabled         bool     `json:"sync_enabled"`
	GoogleAdminEmail    string   `json:"google_admin_email"`
	GoogleSACredsJson   string   `json:"google_sa_creds_json"`
	AzureTenant         string   `json:"azure_tenant"`
	OktaOrgURL          string   `json:"okta_org_url"`
	OktaAPIToken        string   `json:"okta_api_token"`
	UserFilters         []string `json:"user_filters"`
	GroupFilters        []string `json:"group_filters"`
	IDPSyncInterval     string   `json:"idp_sync_interval"`
	Telemetry           string   `json:"telemetry"`
	BasicAuth           bool     `json:"basic_auth"`
	// JwtValidityDuration is the validity duration of auth tokens for users
	// on the dashboard (NMUI).
	JwtValidityDuration int `json:"jwt_validity_duration"`
	// JwtValidityDurationClients is the validity duration of auth tokens for
	// users on the clients (NetDesk).
	JwtValidityDurationClients     int    `json:"jwt_validity_duration_clients"`
	MFAEnforced                    bool   `json:"mfa_enforced"`
	RacRestrictToSingleNetwork     bool   `json:"rac_restrict_to_single_network"`
	EndpointDetection              bool   `json:"endpoint_detection"`
	AllowedEmailDomains            string `json:"allowed_email_domains"`
	EmailSenderAddr                string `json:"email_sender_addr"`
	EmailSenderUser                string `json:"email_sender_user"`
	EmailSenderPassword            string `json:"email_sender_password"`
	SmtpHost                       string `json:"smtp_host"`
	SmtpPort                       int    `json:"smtp_port"`
	MetricInterval                 string `json:"metric_interval"`
	MetricsPort                    int    `json:"metrics_port"`
	ManageDNS                      bool   `json:"manage_dns"`
	DefaultDomain                  string `json:"default_domain"`
	Stun                           bool   `json:"stun"`
	StunServers                    string `json:"stun_servers"`
	AuditLogsRetentionPeriodInDays int    `json:"audit_logs_retention_period"`
	OldAClsSupport                 bool   `json:"old_acl_support"`
	PeerConnectionCheckInterval    string `json:"peer_connection_check_interval"`
	PostureCheckInterval           string `json:"posture_check_interval"` // in minutes
	CleanUpInterval                int    `json:"clean_up_interval_in_mins"`
	EnableFlowLogs                 bool   `json:"enable_flow_logs"`
}

type ServerUpdateData

type ServerUpdateData struct {
	UpdatePeers bool       `json:"updatepeers" bson:"updatepeers"`
	Node        LegacyNode `json:"servernode" bson:"servernode"`
}

ServerUpdateData - contains data to configure server and if it should set peers

type Severity added in v1.4.0

type Severity int
const (
	SeverityUnknown Severity = iota
	SeverityLow
	SeverityMedium
	SeverityHigh
	SeverityCritical
)

type SignInReqDto added in v0.22.0

type SignInReqDto struct {
	FormFields FormFields `json:"formFields"`
}

type SignInResDto added in v0.22.0

type SignInResDto struct {
	Status string `json:"status"`
	User   User   `json:"user"`
}

type Signal

type Signal struct {
	Server               string           `json:"server"`
	FromHostPubKey       string           `json:"from_host_pubkey"`
	ToHostPubKey         string           `json:"to_host_pubkey"`
	FromHostID           string           `json:"from_host_id"`
	ToHostID             string           `json:"to_host_id"`
	FromNodeID           string           `json:"from_node_id"`
	ToNodeID             string           `json:"to_node_id"`
	NetworkID            string           `json:"networkID"`
	Reply                bool             `json:"reply"`
	AutoRelayNodeMetrics map[string]int64 `json:"auto_relay_node_metrics"`
	Action               SignalAction     `json:"action"`
	IsPro                bool             `json:"is_pro"`
	TimeStamp            int64            `json:"timestamp"`
}

Signal - struct for signalling peer

type SignalAction

type SignalAction string

SignalAction - turn peer signal action

const (
	// ConnNegotiation - action to negotiate connection between peers
	ConnNegotiation SignalAction = "CONNECTION_NEGOTIATION"
	// RelayME - action to relay the peer
	RelayME SignalAction = "RELAY_ME"
)

type SsoLoginData added in v0.22.0

type SsoLoginData struct {
	Expiration     time.Time `json:"expiration"`
	OauthProvider  string    `json:"oauthprovider,omitempty"`
	OauthCode      string    `json:"oauthcode,omitempty"`
	Username       string    `json:"username,omitempty"`
	AmbAccessToken string    `json:"ambaccesstoken,omitempty"`
}

type SsoLoginReqDto added in v0.22.0

type SsoLoginReqDto struct {
	OauthProvider string `json:"oauthprovider"`
}

type SsoLoginResDto added in v0.22.0

type SsoLoginResDto struct {
	User      string `json:"UserName"`
	AuthToken string `json:"AuthToken"`
}

type SsoState

type SsoState struct {
	AppName    string    `json:"app_name"`
	Value      string    `json:"value"`
	Expiration time.Time `json:"expiration"`
}

SsoState - holds SSO sign-in session data

func (*SsoState) IsExpired

func (s *SsoState) IsExpired() bool

SsoState.IsExpired - tells if an SsoState is expired or not

type Subject added in v0.99.0

type Subject struct {
	ID   string      `json:"id"`
	Name string      `json:"name"`
	Type SubjectType `json:"subject_type"`
	Info interface{} `json:"info"`
}

type SubjectType added in v0.99.0

type SubjectType string
const (
	UserSub            SubjectType = "USER"
	UserAccessTokenSub SubjectType = "USER_ACCESS_TOKEN"
	DeviceSub          SubjectType = "DEVICE"
	NodeSub            SubjectType = "NODE"
	GatewaySub         SubjectType = "GATEWAY"
	SettingSub         SubjectType = "SETTING"
	AclSub             SubjectType = "ACL"
	TagSub             SubjectType = "TAG"
	UserRoleSub        SubjectType = "USER_ROLE"
	UserGroupSub       SubjectType = "USER_GROUP"
	UserInviteSub      SubjectType = "USER_INVITE"
	PendingUserSub     SubjectType = "PENDING_USER"
	EgressSub          SubjectType = "EGRESS"
	NetworkSub         SubjectType = "NETWORK"
	DashboardSub       SubjectType = "DASHBOARD"
	EnrollmentKeySub   SubjectType = "ENROLLMENT_KEY"
	ClientAppSub       SubjectType = "CLIENT-APP"
	NameserverSub      SubjectType = "NAMESERVER"
	PostureCheckSub    SubjectType = "POSTURE_CHECK"
)

func (SubjectType) String added in v0.99.0

func (sub SubjectType) String() string

type SuccessResponse

type SuccessResponse struct {
	Code     int
	Message  string
	Response interface{}
}

SuccessResponse is struct for sending error message with code.

type SuccessfulLoginResponse

type SuccessfulLoginResponse struct {
	ID        string
	AuthToken string
}

SuccessfulLoginResponse is struct to send the request response

type SuccessfulUserLoginResponse

type SuccessfulUserLoginResponse struct {
	UserName  string
	AuthToken string
}

SuccessfulUserLoginResponse - successlogin struct

type TOTPInitiateResponse added in v1.0.0

type TOTPInitiateResponse struct {
	OTPAuthURL          string `json:"otp_auth_url"`
	OTPAuthURLSignature string `json:"otp_auth_url_signature"`
	QRCode              string `json:"qr_code"`
}

type Tag added in v0.26.0

type Tag struct {
	ID        TagID     `json:"id"`
	TagName   string    `json:"tag_name"`
	Network   NetworkID `json:"network"`
	ColorCode string    `json:"color_code"`
	CreatedBy string    `json:"created_by"`
	CreatedAt time.Time `json:"created_at"`
}

func (Tag) GetIDFromName added in v0.26.0

func (t Tag) GetIDFromName() string

type TagID added in v0.26.0

type TagID string

func (TagID) String added in v0.26.0

func (id TagID) String() string

type TagListResp added in v0.26.0

type TagListResp struct {
	Tag
	UsedByCnt   int       `json:"used_by_count"`
	TaggedNodes []ApiNode `json:"tagged_nodes"`
}

type TagListRespNodes added in v0.26.0

type TagListRespNodes struct {
	Tag
	UsedByCnt   int       `json:"used_by_count"`
	TaggedNodes []ApiNode `json:"tagged_nodes"`
}

type Telemetry

type Telemetry struct {
	UUID           string `json:"uuid" bson:"uuid"`
	LastSend       int64  `json:"lastsend" bson:"lastsend" swaggertype:"primitive,integer" format:"int64"`
	TrafficKeyPriv []byte `json:"traffickeypriv" bson:"traffickeypriv"`
	TrafficKeyPub  []byte `json:"traffickeypub" bson:"traffickeypub"`
}

Telemetry - contains UUID of the server and timestamp of last send to posthog also contains assymetrical encryption pub/priv keys for any server traffic

type TenantLoginResDto added in v0.22.0

type TenantLoginResDto struct {
	Code     int    `json:"code"`
	Message  string `json:"message"`
	Response struct {
		UserName  string `json:"UserName"`
		AuthToken string `json:"AuthToken"`
	} `json:"response"`
}

type Theme added in v0.99.0

type Theme string
const (
	Dark   Theme = "dark"
	Light  Theme = "light"
	System Theme = "system"
)

type TokenType added in v0.99.0

type TokenType string
var (
	UserIDTokenType TokenType = "user_id_token"
	AccessTokenType TokenType = "access_token"
)

func (TokenType) String added in v0.99.0

func (t TokenType) String() string

type TrafficKeys

type TrafficKeys struct {
	Mine   []byte `json:"mine" bson:"mine" yaml:"mine"`
	Server []byte `json:"server" bson:"server" yaml:"server"`
}

TrafficKeys - struct to hold public keys

type UpdateAclRequest added in v0.26.0

type UpdateAclRequest struct {
	Acl
	NewName string `json:"new_name"`
}

type UpdateTagReq added in v0.26.0

type UpdateTagReq struct {
	Tag
	NewName     string    `json:"new_name"`
	ColorCode   string    `json:"color_code"`
	TaggedNodes []ApiNode `json:"tagged_nodes"`
}

type Usage added in v1.2.0

type Usage struct {
	Servers          int                     `json:"servers"`
	Users            int                     `json:"users"`
	Hosts            int                     `json:"hosts"`
	Clients          int                     `json:"clients"`
	Networks         int                     `json:"networks"`
	Ingresses        int                     `json:"ingresses"`
	Egresses         int                     `json:"egresses"`
	Relays           int                     `json:"relays"`
	InternetGateways int                     `json:"internet_gateways"`
	FailOvers        int                     `json:"fail_overs"`
	NetworkUsage     map[string]NetworkUsage `json:"network_usage"`
}

Usage - struct for license usage

func (*Usage) SetDefaults added in v1.2.0

func (l *Usage) SetDefaults()

SetDefaults - sets the default values for usage

type User

type User struct {
	UserName                   string                                `json:"username" bson:"username" validate:"min=3,in_charset|email"`
	ExternalIdentityProviderID string                                `json:"external_identity_provider_id"`
	IsMFAEnabled               bool                                  `json:"is_mfa_enabled"`
	TOTPSecret                 string                                `json:"totp_secret"`
	DisplayName                string                                `json:"display_name"`
	AccountDisabled            bool                                  `json:"account_disabled"`
	Password                   string                                `json:"password" bson:"password" validate:"required,min=5"`
	IsAdmin                    bool                                  `json:"isadmin" bson:"isadmin"` // deprecated
	IsSuperAdmin               bool                                  `json:"issuperadmin"`           // deprecated
	RemoteGwIDs                map[string]struct{}                   `json:"remote_gw_ids"`          // deprecated
	AuthType                   AuthType                              `json:"auth_type"`
	UserGroups                 map[UserGroupID]struct{}              `json:"user_group_ids"`
	PlatformRoleID             UserRoleID                            `json:"platform_role_id"`
	NetworkRoles               map[NetworkID]map[UserRoleID]struct{} `json:"network_roles"`
	LastLoginTime              time.Time                             `json:"last_login_time"`
}

User struct - struct for Users

func (*User) NameInCharSet

func (user *User) NameInCharSet() bool

User.NameInCharset - returns if name is in charset below or not

type UserAccessToken added in v0.99.0

type UserAccessToken struct {
	ID        string    `gorm:"id,primary_key" json:"id"`
	Name      string    `gorm:"name" json:"name"`
	UserName  string    `gorm:"user_name" json:"user_name"`
	ExpiresAt time.Time `gorm:"expires_at" json:"expires_at"`
	LastUsed  time.Time `gorm:"last_used" json:"last_used"`
	CreatedBy string    `gorm:"created_by" json:"created_by"`
	CreatedAt time.Time `gorm:"created_at" json:"created_at"`
}

UserAccessToken - token used to access netmaker

func (*UserAccessToken) Create added in v0.99.0

func (a *UserAccessToken) Create() error

func (*UserAccessToken) Delete added in v0.99.0

func (a *UserAccessToken) Delete() error

func (*UserAccessToken) DeleteAllUserTokens added in v0.99.0

func (a *UserAccessToken) DeleteAllUserTokens() error

func (*UserAccessToken) Get added in v0.99.0

func (a *UserAccessToken) Get() error

func (*UserAccessToken) List added in v0.99.0

func (a *UserAccessToken) List() (ats []UserAccessToken, err error)

func (*UserAccessToken) ListByUser added in v0.99.0

func (a *UserAccessToken) ListByUser() (ats []UserAccessToken)

func (*UserAccessToken) Table added in v0.99.0

func (a *UserAccessToken) Table() string

func (*UserAccessToken) Update added in v0.99.0

func (a *UserAccessToken) Update() error

type UserAuthParams

type UserAuthParams struct {
	UserName string `json:"username"`
	Password string `json:"password"`
}

UserAuthParams - user auth params struct

type UserClaims

type UserClaims struct {
	Role           UserRoleID
	UserName       string
	Api            string
	TokenType      TokenType
	RacAutoDisable bool
	jwt.RegisteredClaims
}

UserClaims - user claims struct

type UserGroup added in v0.25.0

type UserGroup struct {
	ID                         UserGroupID                           `json:"id"`
	ExternalIdentityProviderID string                                `json:"external_identity_provider_id"`
	Default                    bool                                  `json:"default"`
	Name                       string                                `json:"name"`
	NetworkRoles               map[NetworkID]map[UserRoleID]struct{} `json:"network_roles"`
	ColorCode                  string                                `json:"color_code"`
	MetaData                   string                                `json:"meta_data"`
}

type UserGroupID added in v0.25.0

type UserGroupID string

func (UserGroupID) String added in v0.25.0

func (g UserGroupID) String() string

type UserIPMap added in v1.4.0

type UserIPMap struct {
	Mappings map[string]UserMapping `json:"mappings"`
}

UserIPMap maintains the mapping of IP addresses to users and groups

type UserIdentityValidationRequest added in v1.1.0

type UserIdentityValidationRequest struct {
	Password string `json:"password"`
}

UserIdentityValidationRequest - user identity validation request struct

type UserIdentityValidationResponse added in v1.1.0

type UserIdentityValidationResponse struct {
	IdentityValidated bool `json:"identity_validated"`
}

UserIdentityValidationResponse - user identity validation response struct

type UserInvite added in v0.25.0

type UserInvite struct {
	Email          string                                `json:"email"`
	PlatformRoleID string                                `json:"platform_role_id"`
	UserGroups     map[UserGroupID]struct{}              `json:"user_group_ids"`
	NetworkRoles   map[NetworkID]map[UserRoleID]struct{} `json:"network_roles"`
	InviteCode     string                                `json:"invite_code"`
	InviteURL      string                                `json:"invite_url"`
}

UserInvite - model for user invite

type UserMapping added in v1.4.0

type UserMapping struct {
	User   string   `json:"user"`
	Groups []string `json:"groups"`
}

UserMapping - user ip map with groups

type UserRAGs added in v0.26.0

type UserRAGs struct {
	GwID              string `json:"remote_access_gw_id"`
	GWName            string `json:"gw_name"`
	Network           string `json:"network"`
	Connected         bool   `json:"connected"`
	IsInternetGateway bool   `json:"is_internet_gateway"`
	Metadata          string `json:"metadata"`
}

UserRAGs - struct for user access gws

type UserRemoteGws

type UserRemoteGws struct {
	GwID              string     `json:"remote_access_gw_id"`
	GWName            string     `json:"gw_name"`
	Network           string     `json:"network"`
	Connected         bool       `json:"connected"`
	IsInternetGateway bool       `json:"is_internet_gateway"`
	GwClient          ExtClient  `json:"gw_client"`
	GwPeerPublicKey   string     `json:"gw_peer_public_key"`
	GwListenPort      int        `json:"gw_listen_port"`
	Metadata          string     `json:"metadata"`
	AllowedEndpoints  []string   `json:"allowed_endpoints"`
	NetworkAddresses  []string   `json:"network_addresses"`
	Status            NodeStatus `json:"status"`
	ManageDNS         bool       `json:"manage_dns"`
	DnsAddress        string     `json:"dns_address"`
	Addresses         string     `json:"addresses"`
	MatchDomains      []string   `json:"match_domains"`
	SearchDomains     []string   `json:"search_domains"`
}

UserRemoteGws - struct to hold user's remote gws

type UserRemoteGwsReq

type UserRemoteGwsReq struct {
	RemoteAccessClientID string `json:"remote_access_clientid"`
}

UserRemoteGwsReq - struct to hold user remote acccess gws req

type UserRoleID added in v0.25.0

type UserRoleID string
const (
	SuperAdminRole UserRoleID = "super-admin"
	AdminRole      UserRoleID = "admin"
	ServiceUser    UserRoleID = "service-user"
	PlatformUser   UserRoleID = "platform-user"
	Auditor        UserRoleID = "auditor"
	NetworkAdmin   UserRoleID = "network-admin"
	NetworkUser    UserRoleID = "network-user"
)

func GetRAGRoleID added in v0.25.0

func GetRAGRoleID(netID, hostID string) UserRoleID

func (UserRoleID) String added in v0.25.0

func (r UserRoleID) String() string

type UserRolePermissionTemplate added in v0.25.0

type UserRolePermissionTemplate struct {
	ID                  UserRoleID                                  `json:"id"`
	Name                string                                      `json:"name"`
	Default             bool                                        `json:"default"`
	MetaData            string                                      `json:"meta_data"`
	DenyDashboardAccess bool                                        `json:"deny_dashboard_access"`
	FullAccess          bool                                        `json:"full_access"`
	NetworkID           NetworkID                                   `json:"network_id"`
	NetworkLevelAccess  map[RsrcType]map[RsrcID]RsrcPermissionScope `json:"network_level_access"`
	GlobalLevelAccess   map[RsrcType]map[RsrcID]RsrcPermissionScope `json:"global_level_access"`
}

type UserSettings added in v1.1.0

type UserSettings struct {
	Theme         Theme  `json:"theme"`
	TextSize      string `json:"text_size"`
	ReducedMotion bool   `json:"reduced_motion"`
}

type UserTOTPVerificationParams added in v1.0.0

type UserTOTPVerificationParams struct {
	OTPAuthURL          string `json:"otp_auth_url"`
	OTPAuthURLSignature string `json:"otp_auth_url_signature"`
	TOTP                string `json:"totp"`
}

type Violation added in v1.4.0

type Violation struct {
	CheckID   string   `json:"check_id"`
	Name      string   `json:"name"`
	Attribute string   `json:"attribute"`
	Message   string   `json:"message"`
	Severity  Severity `json:"severity"`
}

Jump to

Keyboard shortcuts

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