models

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 12 Imported by: 27

Documentation

Overview

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

Index

Constants

View Source
const (
	// DNSDeleteByIP delete the dns entry
	DNSDeleteByIP = iota
	// DNSDeleteByName delete the dns entry
	DNSDeleteByName
	// DNSReplaceName replace the dns entry
	DNSReplaceName
	// DNSReplaceIP resplace the dns entry
	DNSReplaceIP
	// DNSInsert insert a new dns entry
	DNSInsert
)
View Source
const (
	WIREGUARD_INTERFACE        = "netmaker"
	DefaultPersistentKeepAlive = 20 * time.Second
)

WIREGUARD_INTERFACE name of wireguard interface

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

DefaultExpDuration - the default expiration time of SsoState

View Source
const EnrollmentKeyLength = 32

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

View Source
const (
	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 NAMES = []string{}/* 136 elements not displayed */

NAMES - list of names 4-7 chars in length

View Source
var NAT_Types = struct {
	Public    string
	BehindNAT string
}{
	Public:    "public",
	BehindNAT: "behind_nat",
}

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

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

OS_Types - list of OS types Netmaker cares about

View Source
var SMALL_NAMES = []string{
	"ace",
	"odd",
	"hot",
	"ill",
	"root",
	"sudo",
	"moon",
	"beef",
	"bro",
	"dank",
	"red",
	"gold",
	"big",
	"old",
	"og",
	"best",
	"blue",
	"lil",
	"mom",
	"bot",
	"evil",
	"good",
	"holy",
	"rad",
	"bad",
	"sad",
	"mad",
	"chad",
	"pre",
	"post",
	"foot",
	"soft",
	"hard",
	"lite",
	"dark",
	"true",
	"toy",
	"soy",
	"rude",
	"nice",
	"fun",
	"fat",
	"pro",
	"sly",
	"tan",
	"pet",
	"fine",
	"main",
	"last",
	"wide",
	"free",
	"open",
	"poor",
	"rich",
	"next",
	"real",
	"long",
	"huge",
	"wild",
	"sick",
	"weak",
	"firm",
	"pink",
	"okay",
	"dull",
	"loud",
	"lazy",
	"dumb",
	"tidy",
	"idle",
	"bony",
	"cute",
	"oily",
	"lame",
	"mega",
	"limp",
	"wavy",
	"edgy",
	"nosy",
	"zany",
	"base",
	"cold",
}

SMALL_NAMES - list of small (4 char or less) names

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 IsIpv4Net

func IsIpv4Net(host string) bool

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

func ParseBool

func ParseBool(s string) bool

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

func RetrieveLogo() string

RetrieveLogo - retrieves the ascii art logo for Netmaker

func SetLogo(logo string)

SetLogo - sets the logo ascii art

func StringWithCharset

func StringWithCharset(length int, charset string) string

StringWithCharset - returns random string inside defined charset

Types

type APIEnrollmentKey

type APIEnrollmentKey struct {
	Expiration    int64    `json:"expiration"`
	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"`
}

APIEnrollmentKey - used to create enrollment keys via API

type AccessToken

type AccessToken struct {
	APIConnString string `json:"apiconnstring"`
	ClientConfig
}

AccessToken - token used to access netmaker

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"`
	Debug               bool       `json:"debug"`
	IsStatic            bool       `json:"isstatic"`
	ListenPort          int        `json:"listenport"`
	WgPublicListenPort  int        `json:"wg_public_listen_port" yaml:"wg_public_listen_port"`
	MTU                 int        `json:"mtu"                   yaml:"mtu"`
	Interfaces          []ApiIface `json:"interfaces"            yaml:"interfaces"`
	DefaultInterface    string     `json:"defaultinterface"      yaml:"defautlinterface"`
	EndpointIP          string     `json:"endpointip"            yaml:"endpointip"`
	EndpointIPv6        string     `json:"endpointipv6"            yaml:"endpointipv6"`
	PublicKey           string     `json:"publickey"`
	MacAddress          string     `json:"macaddress"`
	Nodes               []string   `json:"nodes"`
	IsDefault           bool       `json:"isdefault"             yaml:"isdefault"`
	NatType             string     `json:"nat_type"              yaml:"nat_type"`
	PersistentKeepalive int        `json:"persistentkeepalive"   yaml:"persistentkeepalive"`
	AutoUpdate          bool       `json:"autoupdate"              yaml:"autoupdate"`
}

ApiHost - the host struct for API usage

func (*ApiHost) ConvertAPIHostToNMHost

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

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

type ApiIface added in v0.24.0

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

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

type ApiNode

type ApiNode struct {
	ID                      string   `json:"id,omitempty" validate:"required,min=5,id_unique"`
	HostID                  string   `json:"hostid,omitempty" validate:"required,min=5,id_unique"`
	Address                 string   `json:"address" validate:"omitempty,cidrv4"`
	Address6                string   `json:"address6" validate:"omitempty,cidrv6"`
	LocalAddress            string   `json:"localaddress" validate:"omitempty,cidr"`
	AllowedIPs              []string `json:"allowedips"`
	LastModified            int64    `json:"lastmodified"`
	ExpirationDateTime      int64    `json:"expdatetime"`
	LastCheckIn             int64    `json:"lastcheckin"`
	LastPeerUpdate          int64    `json:"lastpeerupdate"`
	Network                 string   `json:"network"`
	NetworkRange            string   `json:"networkrange"`
	NetworkRange6           string   `json:"networkrange6"`
	IsRelayed               bool     `json:"isrelayed"`
	IsRelay                 bool     `json:"isrelay"`
	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"`
	DNSOn                   bool     `json:"dnson"`
	IngressDns              string   `json:"ingressdns"`
	Server                  string   `json:"server"`
	Connected               bool     `json:"connected"`
	PendingDelete           bool     `json:"pendingdelete"`
	Metadata                string   `json:"metadata" validate:"max=256"`
	// == PRO ==
	DefaultACL        string              `json:"defaultacl,omitempty" validate:"checkyesornoorunset"`
	IsFailOver        bool                `json:"is_fail_over"`
	FailOverPeers     map[string]struct{} `json:"fail_over_peers" yaml:"fail_over_peers"`
	FailedOverBy      uuid.UUID           `json:"failed_over_by" yaml:"failed_over_by"`
	IsInternetGateway bool                `json:"isinternetgateway" yaml:"isinternetgateway"`
	InetNodeReq       InetNodeReq         `json:"inet_node_req" yaml:"inet_node_req"`
	InternetGwID      string              `json:"internetgw_node_id" yaml:"internetgw_node_id"`
	AdditionalRagIps  []string            `json:"additional_rag_ips" yaml:"additional_rag_ips"`
}

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 AuthParams

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

AuthParams - struct for auth params

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 ClientConfig

type ClientConfig struct {
	Network string `json:"network"`
	Key     string `json:"key"`
}

ClientConfig - the config of the client

type CommonNode

type CommonNode struct {
	ID                  uuid.UUID `json:"id" yaml:"id"`
	HostID              uuid.UUID `json:"hostid" yaml:"hostid"`
	Network             string    `json:"network" yaml:"network"`
	NetworkRange        net.IPNet `json:"networkrange" yaml:"networkrange"`
	NetworkRange6       net.IPNet `json:"networkrange6" yaml:"networkrange6"`
	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" bson:"egressgatewayranges" yaml:"egressgatewayranges"`
	IsIngressGateway    bool      `json:"isingressgateway" yaml:"isingressgateway"`
	IsRelayed           bool      `json:"isrelayed" bson:"isrelayed" yaml:"isrelayed"`
	RelayedBy           string    `json:"relayedby" bson:"relayedby" yaml:"relayedby"`
	IsRelay             bool      `json:"isrelay" bson:"isrelay" yaml:"isrelay"`
	RelayedNodes        []string  `json:"relaynodes" yaml:"relayedNodes"`
	IngressDNS          string    `json:"ingressdns" yaml:"ingressdns"`
	DNSOn               bool      `json:"dnson" yaml:"dnson"`
}

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

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"`
}

CustomExtClient - struct for CustomExtClient params

type DNSEntry

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

DNSEntry - a DNS entry represented as struct

type DNSError

type DNSError struct {
	ErrorStrings []string
}

DNSError error struct capable of holding multiple error messages

func (DNSError) Error

func (e DNSError) Error() string

DNSError.Error implementation of error interface

type DNSUpdate

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

DNSUpdate data for updating entries in /etc/hosts

type DNSUpdateAction

type DNSUpdateAction int

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

func (DNSUpdateAction) String

func (action DNSUpdateAction) String() string

type DefaultGwInfo added in v0.23.0

type DefaultGwInfo struct {
}

type DisplayKey

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

DisplayKey - what is displayed for key

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"`
}

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"`
}

EgressInfo - struct for egress info

type EgressNetworkRoutes

type EgressNetworkRoutes struct {
	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"`
}

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

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"`
}

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

func (*EnrollmentKey) IsValid

func (k *EnrollmentKey) IsValid() bool

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

func (*EnrollmentKey) Validate

func (k *EnrollmentKey) Validate() error

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

type EnrollmentToken

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

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

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type ErrorResponse

type ErrorResponse struct {
	Code    int
	Message string
}

ErrorResponse is struct for error

type ExtClient

type ExtClient struct {
	ClientID               string              `json:"clientid" bson:"clientid"`
	PrivateKey             string              `json:"privatekey" bson:"privatekey"`
	PublicKey              string              `json:"publickey" bson:"publickey"`
	Network                string              `json:"network" bson:"network"`
	DNS                    string              `json:"dns" bson:"dns"`
	Address                string              `json:"address" bson:"address"`
	Address6               string              `json:"address6" bson:"address6"`
	ExtraAllowedIPs        []string            `json:"extraallowedips" bson:"extraallowedips"`
	AllowedIPs             []string            `json:"allowed_ips"`
	IngressGatewayID       string              `json:"ingressgatewayid" bson:"ingressgatewayid"`
	IngressGatewayEndpoint string              `json:"ingressgatewayendpoint" bson:"ingressgatewayendpoint"`
	LastModified           int64               `json:"lastmodified" bson:"lastmodified"`
	Enabled                bool                `json:"enabled" bson:"enabled"`
	OwnerID                string              `json:"ownerid" bson:"ownerid"`
	DeniedACLs             map[string]struct{} `json:"deniednodeacls" bson:"acls,omitempty"`
	RemoteAccessClientID   string              `json:"remote_access_client_id"` // unique ID (MAC address) of RAC machine
	PostUp                 string              `json:"postup" bson:"postup"`
	PostDown               string              `json:"postdown" bson:"postdown"`
}

ExtClient - struct for external clients

func (*ExtClient) AddressIPNet4 added in v0.22.0

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

ExtClient.PrimaryAddress - returns ipv4 IPNet format

func (*ExtClient) AddressIPNet6 added in v0.22.0

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

ExtClient.AddressIPNet6 - return ipv6 IPNet format

type ExtClientInfo

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

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

type ExtPeersResponse

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

ExtPeersResponse - ext peers response

type FailOverMeReq added in v0.22.0

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

FailOverMeReq - struct for failover req

type 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 FwUpdate

type FwUpdate struct {
	IsEgressGw bool                  `json:"is_egress_gw"`
	EgressInfo map[string]EgressInfo `json:"egress_info"`
}

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 HookDetails

type HookDetails struct {
	Hook     func() error
	Interval time.Duration
}

HookDetails - struct to hold hook info

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"`
	Interface           string           `json:"interface"               yaml:"interface"`
	Debug               bool             `json:"debug"                   yaml:"debug"`
	ListenPort          int              `json:"listenport"              yaml:"listenport"`
	WgPublicListenPort  int              `json:"wg_public_listen_port"   yaml:"wg_public_listen_port"`
	MTU                 int              `json:"mtu"                     yaml:"mtu"`
	PublicKey           wgtypes.Key      `json:"publickey"               yaml:"publickey"`
	MacAddress          net.HardwareAddr `json:"macaddress"              yaml:"macaddress"`
	TrafficKeyPublic    []byte           `json:"traffickeypublic"        yaml:"traffickeypublic"`
	Nodes               []string         `json:"nodes"                   yaml:"nodes"`
	Interfaces          []Iface          `json:"interfaces"              yaml:"interfaces"`
	DefaultInterface    string           `json:"defaultinterface"        yaml:"defaultinterface"`
	EndpointIP          net.IP           `json:"endpointip"              yaml:"endpointip"`
	EndpointIPv6        net.IP           `json:"endpointipv6"            yaml:"endpointipv6"`
	IsDocker            bool             `json:"isdocker"                yaml:"isdocker"`
	IsK8S               bool             `json:"isk8s"                   yaml:"isk8s"`
	IsStatic            bool             `json:"isstatic"                yaml:"isstatic"`
	IsDefault           bool             `json:"isdefault"               yaml:"isdefault"`
	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"     yaml:"persistentkeepalive"`
}

Host - represents a host on the network

func (*Host) ConvertNMHostToAPI

func (h *Host) ConvertNMHostToAPI() *ApiHost

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

type HostInfoMap

type HostInfoMap map[string]HostNetworkInfo

HostInfoMap - map of host public keys to host networking info

type HostMqAction

type HostMqAction string

HostMqAction - type for host update action

const (
	// Upgrade - const to request host to update it's client
	Upgrade HostMqAction = "UPGRADE"
	// SignalHost - const for host signal action
	SignalHost HostMqAction = "SIGNAL_HOST"
	// UpdateHost - constant for host update action
	UpdateHost HostMqAction = "UPDATE_HOST"
	// 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"
	// UpdateMetrics - updates metrics data
	UpdateMetrics HostMqAction = "UPDATE_METRICS"
)

type HostNetworkInfo

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

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

type HostPeerUpdate

type HostPeerUpdate struct {
	Host              Host                 `json:"host" bson:"host" yaml:"host"`
	ChangeDefaultGw   bool                 `json:"change_default_gw"`
	DefaultGwIp       net.IP               `json:"default_gw_ip"`
	IsInternetGw      bool                 `json:"is_inet_gw"`
	NodeAddrs         []net.IPNet          `json:"nodes_addrs" yaml:"nodes_addrs"`
	Server            string               `json:"server" bson:"server" yaml:"server"`
	ServerVersion     string               `json:"serverversion" bson:"serverversion" yaml:"serverversion"`
	ServerAddrs       []ServerAddr         `json:"serveraddrs" bson:"serveraddrs" yaml:"serveraddrs"`
	NodePeers         []wgtypes.PeerConfig `json:"peers" bson:"peers" yaml:"peers"`
	Peers             []wgtypes.PeerConfig
	PeerIDs           PeerMap               `json:"peerids" bson:"peerids" yaml:"peerids"`
	HostNetworkInfo   HostInfoMap           `json:"host_network_info,omitempty" bson:"host_network_info,omitempty" yaml:"host_network_info,omitempty"`
	EgressRoutes      []EgressNetworkRoutes `json:"egress_network_routes"`
	FwUpdate          FwUpdate              `json:"fw_update"`
	ReplacePeers      bool                  `json:"replace_peers"`
	EndpointDetection bool                  `json:"endpoint_detection"`
}

HostPeerUpdate - struct for host peer updates

type HostPull

type HostPull struct {
	Host              Host                  `json:"host" yaml:"host"`
	Nodes             []Node                `json:"nodes" yaml:"nodes"`
	Peers             []wgtypes.PeerConfig  `json:"peers" yaml:"peers"`
	ServerConfig      ServerConfig          `json:"server_config" yaml:"server_config"`
	PeerIDs           PeerMap               `json:"peer_ids,omitempty" yaml:"peer_ids,omitempty"`
	HostNetworkInfo   HostInfoMap           `json:"host_network_info,omitempty"  yaml:"host_network_info,omitempty"`
	EgressRoutes      []EgressNetworkRoutes `json:"egress_network_routes"`
	FwUpdate          FwUpdate              `json:"fw_update"`
	ChangeDefaultGw   bool                  `json:"change_default_gw"`
	DefaultGwIp       net.IP                `json:"default_gw_ip"`
	IsInternetGw      bool                  `json:"is_inet_gw"`
	EndpointDetection bool                  `json:"endpoint_detection"`
}

HostPull - response of a host's pull

type HostRelayRequest

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

HostRelayRequest - struct for host relay creation

type HostTurnRegister

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

HostTurnRegister - struct for host turn registration

type HostUpdate

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

HostUpdate - struct for host update

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"`
	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"`
}

IDandAddr - struct to hold ID and primary Address

type Iface

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

Iface struct for local interfaces of a node

type InetNodeReq added in v0.23.0

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

InetNodeReq - exit node request struct

type IngressGwUsers

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

IngressGwUsers - struct to hold users on a ingress gw

type IngressInfo

type IngressInfo struct {
	ExtPeers     map[string]ExtClientInfo `json:"ext_peers" yaml:"ext_peers"`
	EgressRanges []string                 `json:"egress_ranges" yaml:"egress_ranges"`
}

IngressInfo - struct for ingress info

type IngressRequest

type IngressRequest struct {
	ExtclientDNS      string `json:"extclientdns"`
	IsInternetGateway bool   `json:"is_internet_gw"`
}

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 JoinData

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

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

type KeyType

type KeyType int

KeyType - the type of enrollment key

const (
	Undefined KeyType = iota
	TimeExpiration
	Uses
	Unlimited
)

func (KeyType) String

func (k KeyType) String() string

String - returns the string representation of a KeyType

type KeyUpdate

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

KeyUpdate - key update struct

type LegacyNode

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

LegacyNode - legacy struct for node model

func (*LegacyNode) ConvertToNewNode

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

func (*LegacyNode) NameInNodeCharSet

func (node *LegacyNode) NameInNodeCharSet() bool

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

func (*LegacyNode) SetDNSOnDefault

func (node *LegacyNode) SetDNSOnDefault()

Node.SetDNSOnDefault - sets dns on default

func (*LegacyNode) SetDefaultACL

func (node *LegacyNode) SetDefaultACL()

Node.SetDefaultACL

func (*LegacyNode) SetDefaultAction

func (node *LegacyNode) SetDefaultAction()

Node.SetDefaultAction - sets default action status

func (*LegacyNode) SetDefaultEgressGateway

func (node *LegacyNode) SetDefaultEgressGateway()

Node.SetDefaultEgressGateway - sets default egress gateway status

func (*LegacyNode) SetDefaultFailover

func (node *LegacyNode) SetDefaultFailover()

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

func (*LegacyNode) SetDefaultIngressGateway

func (node *LegacyNode) SetDefaultIngressGateway()

Node.SetDefaultIngressGateway - sets default ingress gateway status

func (*LegacyNode) SetDefaultIsDocker

func (node *LegacyNode) SetDefaultIsDocker()

Node.SetDefaultIsDocker - set default isdocker

func (*LegacyNode) SetDefaultIsHub

func (node *LegacyNode) SetDefaultIsHub()

Node.SetDefaultIsRelayed - set default is relayed

func (*LegacyNode) SetDefaultIsK8S

func (node *LegacyNode) SetDefaultIsK8S()

Node.SetDefaultIsK8S - set default isk8s

func (*LegacyNode) SetDefaultIsRelay

func (node *LegacyNode) SetDefaultIsRelay()

Node.SetDefaultIsRelay - set default isrelay

func (*LegacyNode) SetDefaultIsRelayed

func (node *LegacyNode) SetDefaultIsRelayed()

Node.SetDefaultIsRelayed - set default is relayed

func (*LegacyNode) SetDefaultMTU

func (node *LegacyNode) SetDefaultMTU()

Node.SetDefaultMTU - sets default MTU of a node

func (*LegacyNode) SetDefaultNFTablesPresent

func (node *LegacyNode) SetDefaultNFTablesPresent()

Node.SetDefaultNFTablesPresent - sets default for nftables check

func (*LegacyNode) SetDefaultName

func (node *LegacyNode) SetDefaultName()

Node.SetDefaultName - sets a random name to node

func (*LegacyNode) SetIPForwardingDefault

func (node *LegacyNode) SetIPForwardingDefault()

Node.SetIPForwardingDefault - set ip forwarding default

func (*LegacyNode) SetIsServerDefault

func (node *LegacyNode) SetIsServerDefault()

Node.SetIsServerDefault - sets node isserver default

func (*LegacyNode) SetIsStaticDefault

func (node *LegacyNode) SetIsStaticDefault()

Node.SetIsStaticDefault - set is static default

type LicenseLimits

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

LicenseLimits - struct license limits

type LoginReqDto added in v0.22.0

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

type Metric

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

Metric - holds a metric for data between nodes

type Metrics

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

Metrics - metrics struct

type MetricsMap

type MetricsMap map[string]Metrics

MetricsMap - map for holding multiple metrics in memory

type MigrationData

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

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

type 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"`
	NetworkLastModified int64  `json:"networklastmodified" bson:"networklastmodified"`
	DefaultInterface    string `json:"defaultinterface" bson:"defaultinterface" validate:"min=1,max=35"`
	DefaultListenPort   int32  `json:"defaultlistenport,omitempty" bson:"defaultlistenport,omitempty" validate:"omitempty,min=1024,max=65535"`
	NodeLimit           int32  `json:"nodelimit" bson:"nodelimit"`
	DefaultPostDown     string `json:"defaultpostdown" bson:"defaultpostdown"`
	DefaultKeepalive    int32  `json:"defaultkeepalive" bson:"defaultkeepalive" validate:"omitempty,max=1000"`
	AllowManualSignUp   string `json:"allowmanualsignup" bson:"allowmanualsignup" validate:"checkyesorno"`
	IsIPv4              string `json:"isipv4" bson:"isipv4" validate:"checkyesorno"`
	IsIPv6              string `json:"isipv6" bson:"isipv6" validate:"checkyesorno"`
	DefaultUDPHolePunch string `json:"defaultudpholepunch" bson:"defaultudpholepunch" validate:"checkyesorno"`
	DefaultMTU          int32  `json:"defaultmtu" bson:"defaultmtu"`
	DefaultACL          string `json:"defaultacl" bson:"defaultacl" yaml:"defaultacl" validate:"checkyesorno"`
}

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

func (*Network) GetNetworkNetworkCIDR4 added in v0.21.2

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

func (*Network) GetNetworkNetworkCIDR6 added in v0.21.2

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

func (*Network) SetDefaults

func (network *Network) SetDefaults()

Network.SetDefaults - sets default values for a network struct

func (*Network) SetNetworkLastModified

func (network *Network) SetNetworkLastModified()

Network.SetNetworkLastModified - sets network last modified time

func (*Network) SetNodesLastModified

func (network *Network) SetNodesLastModified()

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

type NetworkMetrics

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

NetworkMetrics - metrics model for all nodes in a network

type Node

type Node struct {
	CommonNode
	PendingDelete           bool                 `json:"pendingdelete" bson:"pendingdelete" yaml:"pendingdelete"`
	LastModified            time.Time            `json:"lastmodified" bson:"lastmodified" yaml:"lastmodified"`
	LastCheckIn             time.Time            `json:"lastcheckin" bson:"lastcheckin" yaml:"lastcheckin"`
	LastPeerUpdate          time.Time            `json:"lastpeerupdate" bson:"lastpeerupdate" yaml:"lastpeerupdate"`
	ExpirationDateTime      time.Time            `json:"expdatetime" bson:"expdatetime" yaml:"expdatetime"`
	EgressGatewayNatEnabled bool                 `json:"egressgatewaynatenabled" bson:"egressgatewaynatenabled" yaml:"egressgatewaynatenabled"`
	EgressGatewayRequest    EgressGatewayRequest `json:"egressgatewayrequest" bson:"egressgatewayrequest" yaml:"egressgatewayrequest"`
	IngressGatewayRange     string               `json:"ingressgatewayrange" bson:"ingressgatewayrange" yaml:"ingressgatewayrange"`
	IngressGatewayRange6    string               `json:"ingressgatewayrange6" bson:"ingressgatewayrange6" yaml:"ingressgatewayrange6"`
	Metadata                string               `json:"metadata"`
	// == PRO ==
	DefaultACL        string              `json:"defaultacl,omitempty" bson:"defaultacl,omitempty" yaml:"defaultacl,omitempty" validate:"checkyesornoorunset"`
	OwnerID           string              `json:"ownerid,omitempty" bson:"ownerid,omitempty" yaml:"ownerid,omitempty"`
	IsFailOver        bool                `json:"is_fail_over" yaml:"is_fail_over"`
	FailOverPeers     map[string]struct{} `json:"fail_over_peers" yaml:"fail_over_peers"`
	FailedOverBy      uuid.UUID           `json:"failed_over_by" yaml:"failed_over_by"`
	IsInternetGateway bool                `json:"isinternetgateway" yaml:"isinternetgateway"`
	InetNodeReq       InetNodeReq         `json:"inet_node_req" yaml:"inet_node_req"`
	InternetGwID      string              `json:"internetgw_node_id" yaml:"internetgw_node_id"`
	AdditionalRagIps  []net.IP            `json:"additional_rag_ips" yaml:"additional_rag_ips"`
}

Node - a model of a network node

func (*Node) ConvertToAPINode

func (nm *Node) ConvertToAPINode() *ApiNode

Node.ConvertToAPINode - converts a node to an API node

func (*Node) DoesACLAllow

func (node *Node) DoesACLAllow() bool

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

func (*Node) DoesACLDeny

func (node *Node) DoesACLDeny() bool

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

func (*Node) Fill

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

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

func (*Node) Legacy

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

Node.Legacy converts node to legacy format

func (*Node) NetworkSettings

func (node *Node) NetworkSettings(n Network)

Node.NetworkSettings updates a node with network settings

func (*Node) PrimaryAddress

func (node *Node) PrimaryAddress() string

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

func (*Node) PrimaryAddressIPNet

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

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

func (*Node) PrimaryNetworkRange

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

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

func (*Node) SetDefaultConnected

func (node *Node) SetDefaultConnected()

Node.SetDefaultConnected

func (*Node) SetExpirationDateTime

func (node *Node) SetExpirationDateTime()

Node.SetExpirationDateTime - sets node expiry time

func (*Node) SetLastCheckIn

func (node *Node) SetLastCheckIn()

Node.SetLastCheckIn - set checkin time of node

func (*Node) SetLastModified

func (node *Node) SetLastModified()

Node.SetLastModified - set last modified initial time

func (*Node) SetLastPeerUpdate

func (node *Node) SetLastPeerUpdate()

Node.SetLastPeerUpdate - sets last peer update time

type NodeAuth

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

NodeAuth - struct for node auth

type NodeCheckin

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

NodeCheckin - struct for node checkins with server

type NodeGet

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

NodeGet - struct for a single node get response

type NodeJoinResponse

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

NodeJoinResponse data returned to node in response to join

type 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 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 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 RegisterMsg

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

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

type RegisterResponse

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

RegisterResponse - the response to a successful enrollment register

type RelayRequest

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

RelayRequest - relay request struct

type ReturnUser

type ReturnUser struct {
	UserName      string              `json:"username"`
	IsAdmin       bool                `json:"isadmin"`
	IsSuperAdmin  bool                `json:"issuperadmin"`
	RemoteGwIDs   map[string]struct{} `json:"remote_gw_ids"`
	LastLoginTime time.Time           `json:"last_login_time"`
}

ReturnUser - return user struct

type SaveData

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

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

type ServerAddr

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

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

type ServerConfig

type ServerConfig struct {
	CoreDNSAddr string `yaml:"corednsaddr"`
	API         string `yaml:"api"`
	APIPort     string `yaml:"apiport"`
	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"`
}

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 ServerUpdateData

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

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

type 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"`
	Reply          bool         `json:"reply"`
	Action         SignalAction `json:"action"`
	IsPro          bool         `json:"is_pro"`
	TimeStamp      int64        `json:"timestamp"`
}

Signal - struct for signalling peer

type SignalAction

type SignalAction string

SignalAction - turn peer signal action

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

type SsoLoginData added in v0.22.0

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

type SsoLoginReqDto added in v0.22.0

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

type SsoLoginResDto added in v0.22.0

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

type SsoState

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

SsoState - holds SSO sign-in session data

func (*SsoState) IsExpired

func (s *SsoState) IsExpired() bool

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

type 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 Telemetry

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

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

type TenantLoginResDto added in v0.22.0

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

type 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 User

type User struct {
	UserName      string              `json:"username" bson:"username" validate:"min=3,max=40,in_charset|email"`
	Password      string              `json:"password" bson:"password" validate:"required,min=5"`
	IsAdmin       bool                `json:"isadmin" bson:"isadmin"`
	IsSuperAdmin  bool                `json:"issuperadmin"`
	RemoteGwIDs   map[string]struct{} `json:"remote_gw_ids"`
	LastLoginTime time.Time           `json:"last_login_time"`
}

User struct - struct for Users

func (*User) NameInCharSet

func (user *User) NameInCharSet() bool

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

type UserAuthParams

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

UserAuthParams - user auth params struct

type UserClaims

type UserClaims struct {
	IsAdmin      bool
	IsSuperAdmin bool
	UserName     string
	jwt.RegisteredClaims
}

UserClaims - user claims struct

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"`
}

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

Jump to

Keyboard shortcuts

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