models

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 18 Imported by: 30

Documentation

Overview

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

Index

Constants

View Source
const (
	TrafficDirectionUni = schema.TrafficDirectionUni
	TrafficDirectionBi  = schema.TrafficDirectionBi

	ALL  = schema.ALL
	UDP  = schema.UDP
	TCP  = schema.TCP
	ICMP = schema.ICMP

	UserPolicy   = schema.UserPolicy
	DevicePolicy = schema.DevicePolicy

	UserAclID                = schema.UserAclID
	UserGroupAclID           = schema.UserGroupAclID
	NodeTagID                = schema.NodeTagID
	NodeID                   = schema.NodeID
	EgressRange              = schema.EgressRange
	EgressID                 = schema.EgressID
	NetmakerIPAclID          = schema.NetmakerIPAclID
	NetmakerSubNetRangeAClID = schema.NetmakerSubNetRangeAClID

	Http        = "HTTP"
	Https       = "HTTPS"
	AllTCP      = "All TCP"
	AllUDP      = "All UDP"
	ICMPService = "ICMP"
	SSH         = "SSH"
	Custom      = "Custom"
	Any         = "Any"
)
View Source
const (
	DeviceJoinStatusJoined  = "joined"
	DeviceJoinStatusPending = "pending"
)
View Source
const (
	DeviceNetworkStatusAvailable        = "available"
	DeviceNetworkStatusJoined           = "joined"
	DeviceNetworkStatusPending          = "pending"
	DeviceNetworkStatusBlocked          = "blocked"
	DeviceNetworkStatusJITRequired      = "jit_required"
	DeviceNetworkStatusApprovalRequired = "approval_required"
)
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 (
	DNSEntryType_Node   = schema.DNSEntryType_Node
	DNSEntryType_Custom = schema.DNSEntryType_Custom
)
View Source
const (
	WIREGUARD_INTERFACE        = "netmaker"
	DefaultPersistentKeepAlive = 20 * time.Second
)

WIREGUARD_INTERFACE name of wireguard interface

View Source
const (
	PostureStatusPass = "pass"
	PostureStatusWarn = "warn"
	PostureStatusFail = "fail"
)

Network posture status values.

View Source
const (
	Dark   = schema.Dark
	Light  = schema.Light
	System = schema.System
)
View Source
const (
	OldRemoteAccessTagName = schema.OldRemoteAccessTagName
	GwTagName              = schema.GwTagName
)
View Source
const DefaultExpDuration = schema.DefaultSsoStateDuration
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

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 GetRAGRoleID added in v0.25.0

func GetRAGRoleID(netID, hostID string) schema.UserRoleID

func GetRAGRoleName added in v0.25.0

func GetRAGRoleName(netID, hostName string) string

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

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"`
	Default           bool     `json:"default"`
	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 = schema.Acl

type AclGroupType added in v0.26.0

type AclGroupType = schema.AclGroupType

type AclPolicy added in v0.26.0

type AclPolicy struct {
	TypeID        AclPolicyType
	PrefixTagUser AclGroupType
}

type AclPolicyTag added in v0.26.0

type AclPolicyTag = schema.AclPolicyTag

type AclPolicyType added in v0.26.0

type AclPolicyType = schema.AclPolicyType

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"`
	AllowedPorts    []string                `json:"allowed_ports"`
	Direction       AllowedTrafficDirection `json:"direction"`
	Dst             []net.IPNet             `json:"dst"`
	Dst6            []net.IPNet             `json:"dst6"`
	Allowed         bool
}

type AllowedTrafficDirection added in v0.26.0

type AllowedTrafficDirection = schema.AllowedTrafficDirection

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"`
	TcpProxyEnabled         bool       `json:"tcp_proxy_enabled"`
	TcpProxyListenPort      int        `json:"tcp_proxy_listen_port"`
	TcpProxyTLSMode         string     `json:"tcp_proxy_tls_mode"`
	TcpProxyListenAddr      string     `json:"tcp_proxy_listen_addr,omitempty"`
	TcpProxyPublicHostname  string     `json:"tcp_proxy_public_hostname,omitempty"`
	TcpProxyCertFingerprint string     `json:"tcp_proxy_cert_fingerprint,omitempty"`
	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"`
	// Device-matching identifiers reported by netclient; read-only via the API.
	EntraDeviceID string `json:"entra_device_id" yaml:"entra_device_id"`
	SerialNumber  string `json:"serial_number"   yaml:"serial_number"`
	HardwareUUID  string `json:"hardware_uuid"   yaml:"hardware_uuid"`
}

ApiHost - the host struct for API usage

func NewApiHostFromSchemaHost added in v1.5.1

func NewApiHostFromSchemaHost(h *schema.Host) *ApiHost

NewApiHostFromSchemaHost - converts a Netmaker host to an API editable host

func (*ApiHost) ConvertAPIHostToNMHost

func (a *ApiHost) ConvertAPIHostToNMHost(currentHost *schema.Host) *schema.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"`
	TenantID               string            `json:"tenant_id"`
	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"`
	TcpProxyEnabled        bool              `json:"tcp_proxy_enabled"`
	TcpProxyListenPort     int               `json:"tcp_proxy_listen_port"`
	TcpProxyTLSMode        string            `json:"tcp_proxy_tls_mode"`
	TcpProxyListenAddr     string            `json:"tcp_proxy_listen_addr,omitempty"`
	TcpProxyPublicHostname string            `json:"tcp_proxy_public_hostname,omitempty"`
	UseTcpUplink           bool              `json:"use_tcp_uplink"`
	//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"`
	SelectedInternetEgressID          string              `json:"selected_internet_egress_id" yaml:"selected_internet_egress_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                            schema.NodeStatus   `json:"status"`
	Location                          string              `json:"location"`
	Country                           string              `json:"country"`
	PostureChecksViolations           []Violation         `json:"posture_check_violations"`
	PostureCheckVolationSeverityLevel schema.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     schema.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 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 BulkDeleteError added in v1.5.1

type BulkDeleteError struct {
	ID    string `json:"id"`
	Error string `json:"error"`
}

type BulkDeleteRequest added in v1.5.1

type BulkDeleteRequest struct {
	IDs []string `json:"ids"`
}

type BulkDeleteResponse added in v1.5.1

type BulkDeleteResponse struct {
	Deleted []string          `json:"deleted"`
	Failed  []BulkDeleteError `json:"failed,omitempty"`
}

type BulkExtClientStatusUpdate added in v1.5.1

type BulkExtClientStatusUpdate struct {
	IDs     []string `json:"ids"`
	Enabled bool     `json:"enabled"`
}

type BulkNodeStatusUpdate added in v1.5.1

type BulkNodeStatusUpdate struct {
	IDs       []string `json:"ids"`
	Connected bool     `json:"connected"`
}

type BulkStatusResponse added in v1.5.1

type BulkStatusResponse struct {
	Updated []string          `json:"updated"`
	Failed  []BulkDeleteError `json:"failed,omitempty"`
}

type BulkUserStatusUpdate added in v1.5.1

type BulkUserStatusUpdate struct {
	IDs     []string `json:"ids"`
	Disable bool     `json:"disable"`
}

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"`
	TenantID               string    `json:"tenant_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"`
	TcpProxyEnabled        bool      `json:"tcp_proxy_enabled"`
	TcpProxyListenPort     int       `json:"tcp_proxy_listen_port"`
	TcpProxyTLSMode        string    `json:"tcp_proxy_tls_mode"`
	TcpProxyListenAddr     string    `json:"tcp_proxy_listen_addr,omitempty"`
	TcpProxyPublicHostname string    `json:"tcp_proxy_public_hostname,omitempty"`
	UseTcpUplink           bool      `json:"use_tcp_uplink"`
}

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

type CreateGwReq added in v0.90.0

type CreateGwReq struct {
	IngressRequest
	RelayRequest
	InetNodeReq
	TcpProxyEnabled        bool   `json:"tcp_proxy_enabled"`
	TcpProxyListenPort     int    `json:"tcp_proxy_listen_port"`
	TcpProxyTLSMode        string `json:"tcp_proxy_tls_mode"`
	TcpProxyListenAddr     string `json:"tcp_proxy_listen_addr,omitempty"`
	TcpProxyPublicHostname string `json:"tcp_proxy_public_hostname,omitempty"`
}

type CreateTagReq added in v0.26.0

type CreateTagReq struct {
	TagName     string           `json:"tag_name"`
	Network     schema.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
	UseInternetEgress          *bool               `json:"use_internet_egress,omitempty"`
	SelectedInternetEgressID   string              `json:"selected_internet_egress_id,omitempty"`
}

CustomExtClient - struct for CustomExtClient params

type DNSEntry

type DNSEntry = schema.DNSEntry

type DNSEntryType added in v1.6.0

type DNSEntryType = schema.DNSEntryType

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 DeviceExitNode added in v1.7.0

type DeviceExitNode struct {
	EgressID        string `json:"egress_id"`
	Name            string `json:"name"`
	Description     string `json:"description,omitempty"`
	Network         string `json:"network"`
	RoutingNodeID   string `json:"routing_node_id,omitempty"`
	RoutingHostName string `json:"routing_host_name,omitempty"`
	// TcpProxyEnabled is true when the routing node (or its host) accepts TCP uplinks.
	TcpProxyEnabled    bool `json:"tcp_proxy_enabled"`
	TcpProxyListenPort int  `json:"tcp_proxy_listen_port,omitempty"`
	Selected           bool `json:"selected"`
	Status             bool `json:"status"`
}

DeviceExitNode describes an internet egress exit node available to a desktop device.

type DeviceExitNodeSelectionReq added in v1.7.0

type DeviceExitNodeSelectionReq struct {
	EgressID     string `json:"egress_id"`
	UseTcpUplink bool   `json:"use_tcp_uplink"`
}

DeviceExitNodeSelectionReq selects or clears the exit node for a device on a network.

type DeviceJoinResult added in v1.7.0

type DeviceJoinResult struct {
	Status string `json:"status"` // joined | pending
}

DeviceJoinResult is returned from the device join API.

type DeviceNetwork added in v1.7.0

type DeviceNetwork struct {
	NetworkID   string `json:"network_id"`
	DisplayName string `json:"display_name,omitempty"`
	Joined      bool   `json:"joined"`
	Connected   bool   `json:"connected"`
	Pending     bool   `json:"pending"`
	Status      string `json:"status"` // available | joined | pending | blocked | jit_required | approval_required

	ApprovalRequired    bool   `json:"approval_required"`
	ApprovalRequestedAt *int64 `json:"approval_requested_at,omitempty"`

	JITEnabled        bool   `json:"jit_enabled"`
	JITAppliesToUser  bool   `json:"jit_applies_to_user"`
	HasJITAccess      bool   `json:"has_jit_access"`
	JITPendingRequest bool   `json:"jit_pending_request"`
	JITGrant          any    `json:"jit_grant,omitempty"`
	JITRequest        any    `json:"jit_request,omitempty"`
	JITExpiresAt      *int64 `json:"jit_expires_at,omitempty"`
}

DeviceNetwork describes a network from the device (desktop/netclient) API perspective.

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        schema.Host `json:"host"`
	Domain      string      `json:"domain"`
	ResolvedIPs []string    `json:"resolved_ips,omitempty"`
}

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 EgressPresetApp added in v1.6.0

type EgressPresetApp struct {
	Name            string   `json:"name"`
	ID              string   `json:"id"`
	Description     string   `json:"description,omitempty"`
	Sources         []string `json:"sources"`
	Domains         []string `json:"domains"`
	Routes          []string `json:"routes,omitempty"`
	Group           string   `json:"group"`
	SuggestedDomain string   `json:"suggestedDomain"`
}

EgressPresetApp is a catalog entry for domain-based egress (UI + optional apply by preset_id).

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:"-"`
	// EgressName is the name of the egress gateway identified by EgressID. Might not be always set.
	EgressName     string               `json:"-"`
	Network        string               `json:"network"`
	VirtualNetwork string               `json:"virtual_network"`
	RouteMetric    uint32               `json:"route_metric"` // preffered range 1-999
	Nat            bool                 `json:"nat"`
	Mode           schema.EgressNATMode `json:"nat_mode"`
}

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"`
	Type        schema.EgressType `json:"type"`
	Nodes       map[string]int    `json:"nodes"`
	Tags        map[string]int    `json:"tags"`
	Range       string            `json:"range"`
	// Domains optional list of logical hostnames for domain-based egress (exact or *.example.com).
	Domains []string             `json:"domains"`
	Nat     bool                 `json:"nat"`
	Mode    schema.EgressNATMode `json:"mode"`
	Status  bool                 `json:"status"`
	// PresetID optional: reference to a catalog preset (see GET /api/v1/egress/presets). Explicit name/domain in the body override preset defaults.
	PresetID string `json:"preset_id"`
}

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"`
	// SkipDeviceApproval bypasses pending-host approval (device JWT API only; not serialized).
	SkipDeviceApproval bool `json:"-"`
}

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"`
	TenantID string `json:"tenant_id"`
	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 {
	TenantID    string
	Action      schema.Action
	Source      Subject
	Origin      schema.Origin
	Target      Subject
	TriggeredBy string
	NetworkID   schema.NetworkID
	Diff        Diff
}

type ExporterFeatureFlags added in v1.4.0

type ExporterFeatureFlags struct {
	EnableFlowLogs bool
}

type ExtClient

type ExtClient = schema.ExtClient

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 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"`
	EnableGwsHA                   bool `json:"enable_gws_ha"`
	EnableDeviceApproval          bool `json:"enable_device_approval"`
	EnableFlowLogs                bool `json:"enable_flow_logs"`
	EnablePostureChecks           bool `json:"enable_posture_checks"`
	EnableJIT                     bool `json:"enable_jit"`
	EnableOverlappingEgressRanges bool `json:"enable_overlapping_egress_ranges"`
	EnableSIEMIntegration         bool `json:"enable_siem_integration"`
}

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"`
	TcpProxyEnabled         bool             `json:"tcp_proxy_enabled"       yaml:"tcp_proxy_enabled"`
	TcpProxyListenPort      int              `json:"tcp_proxy_listen_port"   yaml:"tcp_proxy_listen_port"`
	TcpProxyTLSMode         string           `json:"tcp_proxy_tls_mode"      yaml:"tcp_proxy_tls_mode"`
	TcpProxyListenAddr      string           `json:"tcp_proxy_listen_addr,omitempty" yaml:"tcp_proxy_listen_addr,omitempty"`
	TcpProxyPublicHostname  string           `json:"tcp_proxy_public_hostname,omitempty" yaml:"tcp_proxy_public_hostname,omitempty"`
	TcpProxyCertFingerprint string           `json:"tcp_proxy_cert_fingerprint,omitempty" yaml:"tcp_proxy_cert_fingerprint,omitempty"`
	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              []schema.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"`

	// MDM device-matching identifiers. Reported by netclient on host check-in
	// and consumed by the MDM sync worker to match a Netmaker host to its
	// upstream MDM-managed device record.
	EntraDeviceID string `json:"entra_device_id" yaml:"entra_device_id"`
	SerialNumber  string `json:"serial_number"   yaml:"serial_number"`
	HardwareUUID  string `json:"hardware_uuid"   yaml:"hardware_uuid"`
	OwnerUsername string `json:"owner_username" yaml:"owner_username"`
}

Host - represents a host on the network

type HostEDRStatus added in v1.7.0

type HostEDRStatus struct {
	Provider       string    `json:"provider"`
	MatchedBy      string    `json:"matched_by"`
	AgentInstalled bool      `json:"agent_installed"`
	AgentHealthy   bool      `json:"agent_healthy"`
	RiskLevel      string    `json:"risk_level"`
	LastSyncedAt   time.Time `json:"last_synced_at"`
	LastSeenAt     time.Time `json:"last_seen_at"`
	LastError      string    `json:"last_error,omitempty"`
}

HostEDRStatus is the current EDR sync snapshot for the host's configured EDR provider (if any).

type HostInfoMap

type HostInfoMap map[string]HostNetworkInfo

HostInfoMap - map of host public keys to host networking info

type HostMDMStatus added in v1.7.0

type HostMDMStatus struct {
	Provider     string    `json:"provider"`
	MatchedBy    string    `json:"matched_by"`
	Enrolled     bool      `json:"enrolled"`
	Compliant    bool      `json:"compliant"`
	LastSyncedAt time.Time `json:"last_synced_at"`
}

HostMDMStatus is the current MDM sync snapshot for the host's configured MDM provider (if any).

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"
	// CollectMetrics - request the host to immediately collect and publish metrics
	CollectMetrics HostMqAction = "COLLECT_METRICS"
)

type HostNetworkInfo

type HostNetworkInfo struct {
	Interfaces              []schema.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"`
	TcpProxyEnabled         bool           `json:"tcp_proxy_enabled,omitempty"`
	TcpProxyListenPort      int            `json:"tcp_proxy_listen_port,omitempty"`
	TcpProxyTLSMode         string         `json:"tcp_proxy_tls_mode,omitempty"`
	TcpProxyListenAddr      string         `json:"tcp_proxy_listen_addr,omitempty"`
	TcpProxyPublicHostname  string         `json:"tcp_proxy_public_hostname,omitempty"`
	TcpProxyCertFingerprint string         `json:"tcp_proxy_cert_fingerprint,omitempty"`
}

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[schema.NetworkID]PeerMap `json:"network_peers"`
}

type HostPeerUpdate

type HostPeerUpdate struct {
	Host               schema.Host                 `json:"host"`
	Nodes              []Node                      `json:"nodes"`
	ChangeDefaultGw    bool                        `json:"change_default_gw"`
	DefaultGwIp        net.IP                      `json:"default_gw_ip"`
	DefaultGwIp6       net.IP                      `json:"default_gw_ip6"`
	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[schema.NetworkID][]Node `json:"auto_relay_nodes"`
	GwNodes            map[schema.NetworkID][]Node `json:"gw_nodes"`
	AddressIdentityMap map[string]PeerIdentity     `json:"address_identity_map"`
	ServerConfig
	OldPeerUpdateFields
}

HostPeerUpdate - struct for host peer updates

type HostPostureStatus added in v1.7.0

type HostPostureStatus struct {
	HostID      string                 `json:"host_id"`
	EvaluatedAt time.Time              `json:"evaluated_at"`
	MDM         *HostMDMStatus         `json:"mdm,omitempty"`
	EDR         *HostEDRStatus         `json:"edr,omitempty"`
	Networks    []NetworkPostureStatus `json:"networks"`
}

HostPostureStatus is the netclient-facing summary of a host's last evaluated posture state. Returned by GET /api/v1/host/{hostid}/posture_status.

type HostPull

type HostPull struct {
	Host               schema.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"`
	DefaultGwIp6       net.IP                      `json:"default_gw_ip6"`
	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[schema.NetworkID][]Node `json:"auto_relay_nodes"`
	GwNodes            map[schema.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         schema.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"`
	TcpProxyEndpoint        string `json:"tcp_proxy_endpoint,omitempty"` // wss://host:port/uplink/v1 when peer is a TCP-enabled gateway
	TcpProxyCertFingerprint string `json:"tcp_proxy_cert_fingerprint,omitempty"`
}

IDandAddr - struct to hold ID and primary Address

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[schema.UserGroupID]struct{}                     `json:"user_group_ids"`
	NetworkRoles   map[schema.NetworkID]map[schema.UserRoleID]struct{} `json:"network_roles"`
}

type JITAccessRequest added in v1.5.0

type JITAccessRequest struct {
	NetworkID string `json:"network_id"` // Network identifier
	Reason    string `json:"reason"`     // Reason for access request (required)
}

JITAccessRequest - request body for user JIT access request

type JITOperationRequest added in v1.5.0

type JITOperationRequest struct {
	Action       string   `json:"action"` // enable, disable, update_jit_user_groups, request, approve, deny
	RequestID    string   `json:"request_id,omitempty"`
	GrantID      string   `json:"grant_id,omitempty"`
	Reason       string   `json:"reason,omitempty"`
	ExpiresAt    int64    `json:"expires_at,omitempty"`     // Unix epoch timestamp (seconds) for when access should expire
	UserGroupIDs []string `json:"user_group_ids,omitempty"` // optional JIT allowlist; empty on enable = all users
}

JITOperationRequest - request body for JIT admin operations

type JoinData

type JoinData struct {
	Host schema.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 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 LoginMethodRequest added in v1.7.0

type LoginMethodRequest struct {
	Username string `json:"username"`
}

type LoginMethodsAvailable added in v1.7.0

type LoginMethodsAvailable struct {
	BasicAuth      bool   `json:"basic_auth"`
	SSO            bool   `json:"sso"`
	SSOProvider    string `json:"sso_provider,omitempty"`
	OrgAuth        bool   `json:"org_auth,omitempty"`
	OrganizationID string `json:"organization_id,omitempty"`
}

LoginMethodsAvailable describes which auth methods are available for a login context.

type LoginMethodsResponse added in v1.7.0

type LoginMethodsResponse struct {
	Options []LoginOption `json:"login_options"`
}

LoginMethodsResponse is the response payload for fetch user login methods.

type LoginOption added in v1.7.0

type LoginOption struct {
	Scope         scope.Scope           `json:"scope"`
	ScopeID       string                `json:"scope_id"`
	ScopeName     string                `json:"scope_name"`
	ScopeSlug     string                `json:"scope_slug"`
	ScopeMetadata string                `json:"scope_metadata"`
	Methods       LoginMethodsAvailable `json:"methods"`
}

LoginOption represents a single login scope (tenant or org) and its available methods.

type LoginReqDto added in v0.22.0

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

type Metric

type Metric = schema.Metric

type Metrics

type Metrics = schema.Metrics

type MetricsMap

type MetricsMap map[string]Metrics

MetricsMap - map for holding multiple metrics in memory

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"`
	IsADDomain     bool     `json:"is_ad_domain"`
}

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"`
	DefaultKeepalive    int32    `json:"defaultkeepalive" bson:"defaultkeepalive" validate:"omitempty,max=1000"`
	IsIPv4              string   `json:"isipv4" bson:"isipv4" validate:"checkyesorno"`
	IsIPv6              string   `json:"isipv6" bson:"isipv6" 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"`
	JITEnabled          string   `json:"jit_enabled" bson:"jit_enabled" validate:"checkyesorno"`
	// VirtualNATPoolIPv4 is the IPv4 CIDR pool from which virtual NAT ranges are allocated for egress gateways
	VirtualNATPoolIPv4 string `json:"virtual_nat_pool_ipv4"`
	// VirtualNATSitePrefixLenIPv4 is the prefix length (e.g., 24) for individual site allocations from the IPv4 virtual NAT pool
	VirtualNATSitePrefixLenIPv4 int    `json:"virtual_nat_site_prefixlen_ipv4"`
	CreatedBy                   string `json:"created_by"`
	CreatedAt                   time.Time
}

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

type NetworkMetrics

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

NetworkMetrics - metrics model for all nodes in a network

type NetworkPostureStatus added in v1.7.0

type NetworkPostureStatus struct {
	NetworkID  string          `json:"network_id"`
	NodeID     string          `json:"node_id"`
	Severity   schema.Severity `json:"severity"`
	Status     string          `json:"status"` // pass | warn | fail
	Violations []Violation     `json:"violations"`
}

NetworkPostureStatus describes posture state for a single (host, network).

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 ==
	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"`
	// SelectedInternetEgressID is the internet-type egress this node uses as its exit node (empty = none).
	SelectedInternetEgressID           string             `json:"selected_internet_egress_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                             schema.NodeStatus  `json:"node_status"`
	Mutex                              *sync.Mutex        `json:"-"`
	EgressDetails                      EgressDetails      `json:"-"`
	PostureChecksViolations            []Violation        `json:"posture_check_violations"`
	PostureCheckViolationSeverityLevel schema.Severity    `json:"posture_check_violation_severity_level"`
	LastEvaluationCycleID              string             `json:"last_evaluation_cycle_id"`
	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 ConvertToStaticNode added in v1.7.0

func ConvertToStaticNode(ext ExtClient) 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) 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) 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    []schema.Iface
}

NodeCheckin - struct for node checkins with server

type NodeExitNodeSelectionReq added in v1.7.0

type NodeExitNodeSelectionReq struct {
	EgressID     string `json:"egress_id"`
	UseTcpUplink bool   `json:"use_tcp_uplink"`
}

NodeExitNodeSelectionReq selects or clears the exit node for a node (admin API).

type NodeGet

type NodeGet struct {
	Node         Node                 `json:"node" bson:"node" yaml:"node"`
	Host         schema.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         schema.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 NodeWithHost added in v1.6.0

type NodeWithHost struct {
	ID                                string                                `json:"id"`
	TenantID                          string                                `json:"tenant_id"`
	HostID                            string                                `json:"host_id"`
	Host                              *ApiHost                              `json:"host,omitempty"`
	NetworkID                         string                                `json:"network_id"`
	Address                           string                                `json:"address"`
	Address6                          string                                `json:"address6"`
	Connected                         bool                                  `json:"connected"`
	Action                            string                                `json:"action"`
	Status                            schema.NodeStatus                     `json:"status"`
	PendingDelete                     bool                                  `json:"pending_delete"`
	AutoAssignGateway                 bool                                  `json:"auto_assign_gateway"`
	IsGateway                         bool                                  `json:"is_gateway"`
	IsAutoRelay                       bool                                  `json:"is_auto_relay"`
	IsInternetGateway                 bool                                  `json:"is_internet_gateway"`
	RelayedClients                    datatypes.JSONMap                     `json:"relayed_clients"`
	RelayedIGWClients                 datatypes.JSONMap                     `json:"relayed_igw_clients"`
	RelayedByNodeID                   *string                               `json:"relayed_by_node_id"`
	IsIGWClient                       bool                                  `json:"is_igw_client"`
	SelectedInternetEgressID          string                                `json:"selected_internet_egress_id"`
	AutoRelayedPeers                  datatypes.JSONType[map[string]string] `json:"auto_relayed_peers"`
	Tags                              datatypes.JSONMap                     `json:"tags"`
	PostureCheckSeverity              schema.Severity                       `json:"posture_check_severity"`
	PostureCheckLastEvaluationCycleID string                                `json:"posture_check_last_evaluation_cycle_id"`
	Metadata                          string                                `json:"metadata"`
	LastCheckIn                       time.Time                             `json:"last_check_in"`
	ExpirationDateTime                time.Time                             `json:"expiration_date_time"`
	CreatedAt                         time.Time                             `json:"created_at"`
	UpdatedAt                         time.Time                             `json:"updated_at"`
}

func (*NodeWithHost) Fill added in v1.6.0

func (n *NodeWithHost) Fill(_node *schema.Node)

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 OnboardingStatus added in v1.6.0

type OnboardingStatus struct {
	ShowOnboarding bool `json:"show_onboarding"`
	NetworkCount   int  `json:"network_count"`
}

OnboardingStatus tells the UI whether to show the first-network onboarding flow.

type PaginatedResponse added in v1.5.1

type PaginatedResponse struct {
	Data       interface{} `json:"data"`
	Page       int         `json:"page"`
	PerPage    int         `json:"per_page"`
	Total      int         `json:"total"`
	TotalPages int         `json:"total_pages"`
}

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"`
	Name string   `json:"name"`
}

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
	SkipAutoUpdate bool
	Tags           map[TagID]struct{}
	IsUser         bool
	UserGroups     map[schema.UserGroupID]struct{}
	// HostID is the Netmaker host's UUID; used to look up MDM state.
	HostID string
	// MDMState is the most recent sync snapshot for the configured MDM
	// provider; nil if MDM is not configured or the host hasn't synced yet.
	MDMState *schema.DeviceMDMState
	// EDRState is the most recent sync snapshot for the configured EDR
	// provider; nil if EDR is not configured or the host hasn't synced yet.
	EDRState *schema.DeviceEDRState
}

type Protocol added in v0.30.0

type Protocol = schema.Protocol

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 schema.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 schema.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"`
	EmailValidated             bool                                                `json:"email_validated"`
	DisplayName                string                                              `json:"display_name"`
	AccountDisabled            bool                                                `json:"account_disabled"`
	IsAdmin                    bool                                                `json:"isadmin"`
	IsSuperAdmin               bool                                                `json:"issuperadmin"`
	AuthType                   schema.AuthType                                     `json:"auth_type"`
	RemoteGwIDs                map[string]struct{}                                 `json:"remote_gw_ids"` // deprecated
	UserGroups                 map[schema.UserGroupID]struct{}                     `json:"user_group_ids"`
	PlatformRoleID             schema.UserRoleID                                   `json:"platform_role_id"`
	NetworkRoles               map[schema.NetworkID]map[schema.UserRoleID]struct{} `json:"network_roles"`
	LastLoginTime              time.Time                                           `json:"last_login_time"`
	NumAccessTokens            int                                                 `json:"num_access_tokens"`
	CreatedBy                  string                                              `json:"created_by"`
	CreatedAt                  time.Time                                           `json:"created_at"`
	UpdatedAt                  time.Time                                           `json:"updated_at"`
}

ReturnUser - return user struct

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 {
	TenantID                    string `yaml:"tenant_id"`
	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"`
	IPDetectionInterval         int    `yaml:"ip_detection_interval"`
	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 = schema.TenantSettings

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 = schema.SsoState

type Subject added in v0.99.0

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

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 = schema.Tag

type TagID added in v0.26.0

type TagID = schema.TagID

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 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 = schema.Theme

type TokenType added in v0.99.0

type TokenType string
var (
	UserIDTokenType  TokenType = "user_id_token"
	AccessTokenType  TokenType = "access_token"
	PreAuthTokenType TokenType = "pre_auth_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 TransferOrgOwnerRequest added in v1.7.0

type TransferOrgOwnerRequest struct {
	Username string `json:"username"`
}

TransferOrgOwnerRequest - request struct for transferring org ownership

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                   schema.AuthType                                     `json:"auth_type"`
	UserGroups                 map[schema.UserGroupID]struct{}                     `json:"user_group_ids"`
	PlatformRoleID             schema.UserRoleID                                   `json:"platform_role_id"`
	NetworkRoles               map[schema.NetworkID]map[schema.UserRoleID]struct{} `json:"network_roles"`
	LastLoginTime              time.Time                                           `json:"last_login_time"`
	CreatedBy                  string                                              `json:"created_by"`
	CreatedAt                  time.Time                                           `json:"created_at"`
	UpdatedAt                  time.Time                                           `json:"updated_at"`
}

User struct - struct for Users

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 {
	Scope          scope.Scope
	ScopeID        string
	UserName       string
	Api            string
	TokenType      TokenType
	RacAutoDisable bool
	jwt.RegisteredClaims
}

UserClaims - user claims struct

type UserEventLog added in v1.5.1

type UserEventLog struct {
	ReturnUser
	UserGroupsWithNames map[string]string `json:"user_groups_with_names"`
}

UserEventLog - user representation for activity logs with resolved names

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[schema.UserGroupID]struct{}                     `json:"user_group_ids"`
	NetworkRoles   map[schema.NetworkID]map[schema.UserRoleID]struct{} `json:"network_roles"`
	InviteCode     string                                              `json:"invite_code"`
	InviteURL      string                                              `json:"invite_url"`
}

UserInvite - model for user invite

type UserJITNetworkStatus added in v1.5.0

type UserJITNetworkStatus struct {
	NetworkID        string `json:"network_id"`
	NetworkName      string `json:"network_name,omitempty"`
	JITEnabled       bool   `json:"jit_enabled"`
	JitAppliesToUser bool   `json:"jit_applies_to_user"`
	HasAccess        bool   `json:"has_access"`
	Grant            any    `json:"grant,omitempty"`   // schema.JITGrant
	Request          any    `json:"request,omitempty"` // schema.JITRequest
	PendingRequest   bool   `json:"pending_request"`
}

UserJITNetworkStatus represents JIT status for a network from user's perspective

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            schema.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"`
	Nameservers       []Nameserver      `json:"nameservers"`
}

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 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 = schema.Violation

Jump to

Keyboard shortcuts

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