Documentation ¶
Overview ¶
TODO: Either add a returnNetwork and returnKey, or delete this
Index ¶
- Constants
- Variables
- func FormatBool(b bool) string
- func GenerateNodeName() string
- func GetRAGRoleName(netID, hostName string) string
- func IsIpv4Net(host string) bool
- func ParseBool(s string) bool
- func RetrieveLogo() string
- func SetLogo(logo string)
- func StringWithCharset(length int, charset string) string
- type APIEnrollmentKey
- type AccessToken
- type Acl
- type AclGroupType
- type AclPolicy
- type AclPolicyTag
- type AclPolicyType
- type AclPolicyTypes
- type AclRule
- type AllowedTrafficDirection
- type ApiHost
- type ApiIface
- type ApiNode
- type AuthParams
- type AuthType
- type CheckInResponse
- type Claims
- type ClientConfig
- type CommonNode
- type CreateGroupReq
- type CreateTagReq
- type CustomExtClient
- type DNSEntry
- type DNSError
- type DNSUpdate
- type DNSUpdateAction
- type DefaultGwInfo
- type DisplayKey
- type EgressGatewayRequest
- type EgressInfo
- type EgressNetworkRoutes
- type EnrollmentKey
- type EnrollmentToken
- type Error
- type ErrorResponse
- type ExtClient
- type ExtClientInfo
- type ExtPeersResponse
- type FailOverMeReq
- type FormField
- type FormFields
- type FwRule
- type FwUpdate
- type GetClientConfReqDto
- type GlobalConfig
- type HookDetails
- type Host
- type HostInfoMap
- type HostMqAction
- type HostNetworkInfo
- type HostPeerUpdate
- type HostPull
- type HostRelayRequest
- type HostTurnRegister
- type HostUpdate
- type IDandAddr
- type Iface
- type InetNodeReq
- type IngressGwUsers
- type IngressInfo
- type IngressRequest
- type IntClient
- type InviteUsersReq
- type JoinData
- type KeyType
- type KeyUpdate
- type LegacyNode
- func (ln *LegacyNode) ConvertToNewNode() (*Host, *Node)
- func (node *LegacyNode) NameInNodeCharSet() bool
- func (node *LegacyNode) SetDNSOnDefault()
- func (node *LegacyNode) SetDefaultACL()
- func (node *LegacyNode) SetDefaultAction()
- func (node *LegacyNode) SetDefaultEgressGateway()
- func (node *LegacyNode) SetDefaultFailover()
- func (node *LegacyNode) SetDefaultIngressGateway()
- func (node *LegacyNode) SetDefaultIsDocker()
- func (node *LegacyNode) SetDefaultIsHub()
- func (node *LegacyNode) SetDefaultIsK8S()
- func (node *LegacyNode) SetDefaultIsRelay()
- func (node *LegacyNode) SetDefaultIsRelayed()
- func (node *LegacyNode) SetDefaultMTU()
- func (node *LegacyNode) SetDefaultNFTablesPresent()
- func (node *LegacyNode) SetDefaultName()
- func (node *LegacyNode) SetIPForwardingDefault()
- func (node *LegacyNode) SetIsServerDefault()
- func (node *LegacyNode) SetIsStaticDefault()
- type LicenseLimits
- type LoginReqDto
- type Metric
- type Metrics
- type MetricsMap
- type MigrationData
- type Network
- type NetworkID
- type NetworkMetrics
- type NetworkStatResp
- type Node
- func (node *Node) AddressIPNet4() net.IPNet
- func (node *Node) AddressIPNet6() net.IPNet
- func (nm *Node) ConvertToAPINode() *ApiNode
- func (node *Node) DoesACLAllow() bool
- func (node *Node) DoesACLDeny() bool
- func (newNode *Node) Fill(currentNode *Node, isPro bool)
- func (n *Node) Legacy(h *Host, s *ServerConfig, net *Network) *LegacyNode
- func (node *Node) NetworkSettings(n Network)
- func (node *Node) PrimaryAddress() string
- func (node *Node) PrimaryAddressIPNet() net.IPNet
- func (node *Node) PrimaryNetworkRange() net.IPNet
- func (node *Node) SetDefaultConnected()
- func (node *Node) SetExpirationDateTime()
- func (node *Node) SetLastCheckIn()
- func (node *Node) SetLastModified()
- func (node *Node) SetLastPeerUpdate()
- type NodeAuth
- type NodeCheckin
- type NodeGet
- type NodeJoinResponse
- type NodeStatus
- type NodesArray
- type PeerMap
- type PeerRouteInfo
- type PeersResponse
- type Protocol
- type ProtocolType
- type RegisterMsg
- type RegisterResponse
- type RelayRequest
- type ReturnUser
- type ReturnUserWithRolesAndGroups
- type RsrcID
- type RsrcPermissionScope
- type RsrcType
- type RsrcURLInfo
- type SaveData
- type ServerAddr
- type ServerConfig
- type ServerIDs
- type ServerUpdateData
- type ServiceType
- type SignInReqDto
- type SignInResDto
- type Signal
- type SignalAction
- type SsoLoginData
- type SsoLoginReqDto
- type SsoLoginResDto
- type SsoState
- type SuccessResponse
- type SuccessfulLoginResponse
- type SuccessfulUserLoginResponse
- type Tag
- type TagID
- type TagListResp
- type TagListRespNodes
- type Telemetry
- type TenantLoginResDto
- type TrafficKeys
- type UpdateAclRequest
- type UpdateTagReq
- type User
- type UserAuthParams
- type UserClaims
- type UserGroup
- type UserGroupID
- type UserInvite
- type UserRAGs
- type UserRemoteGws
- type UserRemoteGwsReq
- type UserRoleID
- type UserRolePermissionTemplate
Constants ¶
const ( Http = "HTTP" Https = "HTTPS" AllTCP = "All TCP" AllUDP = "All UDP" ICMPService = "ICMP" Custom = "Custom" Any = "Any" )
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 )
const ( WIREGUARD_INTERFACE = "netmaker" DefaultPersistentKeepAlive = 20 * time.Second )
WIREGUARD_INTERFACE name of wireguard interface
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" )
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" )
const DefaultExpDuration = time.Minute * 5
DefaultExpDuration - the default expiration time of SsoState
const EnrollmentKeyLength = 32
EnrollmentKeyLength - the length of an enrollment key - 62^16 unique possibilities
const LastCheckInThreshold = time.Minute * 10
LastCheckInThreshold - if node's checkin more than this threshold,then node is declared as offline
const (
RemoteAccessTagName = "remote-access-gws"
)
const (
ResHeaderKeyStAccessToken = "St-Access-Token"
)
Variables ¶
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") )
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)
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
var RsrcTypeMap = map[RsrcType]struct{}{
HostRsrc: {},
RelayRsrc: {},
RemoteAccessGwRsrc: {},
ExtClientsRsrc: {},
InetGwRsrc: {},
EgressGwRsrc: {},
NetworkRsrc: {},
EnrollmentKeysRsrc: {},
UserRsrc: {},
AclRsrc: {},
DnsRsrc: {},
FailOverRsrc: {},
}
Functions ¶
func GenerateNodeName ¶
func GenerateNodeName() string
GenerateNodeName - generates a random node name
func GetRAGRoleName ¶ added in v0.25.0
func IsIpv4Net ¶
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 RetrieveLogo ¶
func RetrieveLogo() string
RetrieveLogo - retrieves the ascii art logo for Netmaker
func StringWithCharset ¶
StringWithCharset - returns random string inside defined charset
Types ¶
type APIEnrollmentKey ¶
type APIEnrollmentKey struct { Expiration int64 `json:"expiration" swaggertype:"primitive,integer" format:"int64"` UsesRemaining int `json:"uses_remaining"` Networks []string `json:"networks"` Unlimited bool `json:"unlimited"` Tags []string `json:"tags" validate:"required,dive,min=3,max=32"` Type KeyType `json:"type"` Relay string `json:"relay"` Groups []TagID `json:"groups"` }
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 Acl ¶ added in v0.26.0
type Acl struct { ID string `json:"id"` Default bool `json:"default"` MetaData string `json:"meta_data"` Name string `json:"name"` NetworkID NetworkID `json:"network_id"` RuleType AclPolicyType `json:"policy_type"` Src []AclPolicyTag `json:"src_type"` Dst []AclPolicyTag `json:"dst_type"` Proto Protocol `json:"protocol"` // tcp, udp, etc. ServiceType string `json:"type"` Port []string `json:"ports"` AllowedDirection AllowedTrafficDirection `json:"allowed_traffic_direction"` Enabled bool `json:"enabled"` CreatedBy string `json:"created_by"` CreatedAt time.Time `json:"created_at"` }
type AclGroupType ¶ added in v0.26.0
type AclGroupType string
const ( UserAclID AclGroupType = "user" UserGroupAclID AclGroupType = "user-group" DeviceAclID AclGroupType = "tag" NetmakerIPAclID AclGroupType = "ip" NetmakerSubNetRangeAClID AclGroupType = "ipset" )
func (AclGroupType) String ¶ added in v0.26.0
func (g AclGroupType) String() string
type AclPolicy ¶ added in v0.26.0
type AclPolicy struct { TypeID AclPolicyType PrefixTagUser AclGroupType }
type AclPolicyTag ¶ added in v0.26.0
type AclPolicyTag struct { ID AclGroupType `json:"id"` Value string `json:"value"` }
type AclPolicyType ¶ added in v0.26.0
type AclPolicyType string
const ( UserPolicy AclPolicyType = "user-policy" DevicePolicy AclPolicyType = "device-policy" )
type AclPolicyTypes ¶ added in v0.26.0
type AclPolicyTypes struct { ProtocolTypes []ProtocolType RuleTypes []AclPolicyType `json:"policy_types"` SrcGroupTypes []AclGroupType `json:"src_grp_types"` DstGroupTypes []AclGroupType `json:"dst_grp_types"` }
type AclRule ¶ added in v0.30.0
type AclRule struct { ID string `json:"id"` IPList []net.IPNet `json:"ip_list"` IP6List []net.IPNet `json:"ip6_list"` AllowedProtocol Protocol `json:"allowed_protocols"` // tcp, udp, etc. AllowedPorts []string `json:"allowed_ports"` Direction AllowedTrafficDirection `json:"direction"` // single or two-way Allowed bool }
type AllowedTrafficDirection ¶ added in v0.26.0
type AllowedTrafficDirection int
AllowedTrafficDirection - allowed direction of traffic
const ( // TrafficDirectionUni implies traffic is only allowed in one direction (src --> dst) TrafficDirectionUni AllowedTrafficDirection = iota // TrafficDirectionBi implies traffic is allowed both direction (src <--> dst ) TrafficDirectionBi )
type ApiHost ¶
type ApiHost struct { ID string `json:"id"` Verbosity int `json:"verbosity"` FirewallInUse string `json:"firewallinuse"` Version string `json:"version"` Name string `json:"name"` OS string `json:"os"` Debug bool `json:"debug"` IsStaticPort bool `json:"isstaticport"` IsStatic bool `json:"isstatic"` ListenPort int `json:"listenport"` WgPublicListenPort int `json:"wg_public_listen_port" yaml:"wg_public_listen_port"` MTU int `json:"mtu" yaml:"mtu"` Interfaces []ApiIface `json:"interfaces" yaml:"interfaces"` DefaultInterface string `json:"defaultinterface" yaml:"defautlinterface"` EndpointIP string `json:"endpointip" yaml:"endpointip"` EndpointIPv6 string `json:"endpointipv6" yaml:"endpointipv6"` PublicKey string `json:"publickey"` MacAddress string `json:"macaddress"` Nodes []string `json:"nodes"` IsDefault bool `json:"isdefault" yaml:"isdefault"` NatType string `json:"nat_type" yaml:"nat_type"` PersistentKeepalive int `json:"persistentkeepalive" yaml:"persistentkeepalive"` AutoUpdate bool `json:"autoupdate" yaml:"autoupdate"` }
ApiHost - the host struct for API usage
func (*ApiHost) ConvertAPIHostToNMHost ¶
APIHost.ConvertAPIHostToNMHost - convert's a given apihost struct to a Host struct
type ApiIface ¶ added in v0.24.0
ApiIface - the interface struct for API usage The original Iface struct contains a net.Address, which does not get marshalled correctly
type ApiNode ¶
type ApiNode struct { ID string `json:"id,omitempty" validate:"required,min=5,id_unique"` HostID string `json:"hostid,omitempty" validate:"required,min=5,id_unique"` Address string `json:"address" validate:"omitempty,cidrv4"` Address6 string `json:"address6" validate:"omitempty,cidrv6"` LocalAddress string `json:"localaddress" validate:"omitempty,cidr"` AllowedIPs []string `json:"allowedips"` LastModified int64 `json:"lastmodified" swaggertype:"primitive,integer" format:"int64"` ExpirationDateTime int64 `json:"expdatetime" swaggertype:"primitive,integer" format:"int64"` LastCheckIn int64 `json:"lastcheckin" swaggertype:"primitive,integer" format:"int64"` LastPeerUpdate int64 `json:"lastpeerupdate" swaggertype:"primitive,integer" format:"int64"` Network string `json:"network"` NetworkRange string `json:"networkrange"` NetworkRange6 string `json:"networkrange6"` IsRelayed bool `json:"isrelayed"` IsRelay bool `json:"isrelay"` 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"` IngressPersistentKeepalive int32 `json:"ingresspersistentkeepalive"` IngressMTU int32 `json:"ingressmtu"` Server string `json:"server"` Connected bool `json:"connected"` PendingDelete bool `json:"pendingdelete"` Metadata string `json:"metadata"` // == PRO == DefaultACL string `json:"defaultacl,omitempty" validate:"checkyesornoorunset"` IsFailOver bool `json:"is_fail_over"` FailOverPeers map[string]struct{} `json:"fail_over_peers" yaml:"fail_over_peers"` FailedOverBy uuid.UUID `json:"failed_over_by" yaml:"failed_over_by"` IsInternetGateway bool `json:"isinternetgateway" yaml:"isinternetgateway"` InetNodeReq InetNodeReq `json:"inet_node_req" yaml:"inet_node_req"` InternetGwID string `json:"internetgw_node_id" yaml:"internetgw_node_id"` AdditionalRagIps []string `json:"additional_rag_ips" yaml:"additional_rag_ips"` Tags map[TagID]struct{} `json:"tags" yaml:"tags"` IsStatic bool `json:"is_static"` IsUserNode bool `json:"is_user_node"` StaticNode ExtClient `json:"static_node"` Status NodeStatus `json:"status"` }
ApiNode is a stripped down Node DTO that exposes only required fields to external systems
func (*ApiNode) ConvertToServerNode ¶
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 ¶
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" 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" bson:"egressgatewayranges"` IsIngressGateway bool `json:"isingressgateway" yaml:"isingressgateway"` IsRelayed bool `json:"isrelayed" yaml:"isrelayed" bson:"isrelayed"` RelayedBy string `json:"relayedby" yaml:"relayedby" bson:"relayedby"` IsRelay bool `json:"isrelay" yaml:"isrelay" bson:"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 CreateGroupReq ¶ added in v0.25.0
type CreateTagReq ¶ added in v0.26.0
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"` Os string `json:"os"` DeviceName string `json:"device_name"` IsAlreadyConnectedToInetGw bool `json:"is_already_connected_to_inet_gw"` PublicEndpoint string `json:"public_endpoint"` Country string `json:"country"` }
CustomExtClient - struct for CustomExtClient params
type DNSEntry ¶
type DNSEntry struct { Address string `json:"address" validate:"omitempty,ip"` Address6 string `json:"address6" validate:"omitempty,ip"` Name string `json:"name" validate:"required,name_unique,min=1,max=192,whitespace"` Network string `json:"network" validate:"network_exists"` }
DNSEntry - a DNS entry represented as struct
type DNSError ¶
type DNSError struct {
ErrorStrings []string
}
DNSError error struct capable of holding multiple error messages
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 ¶
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"` Groups []TagID `json:"groups"` Default bool `json:"default"` }
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 ¶
EnrollmentToken - the tokenized version of an enrollmentkey; to be used for host registration
type ErrorResponse ¶
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" swaggertype:"primitive,integer" format:"int64"` Enabled bool `json:"enabled" bson:"enabled"` OwnerID string `json:"ownerid" bson:"ownerid"` DeniedACLs map[string]struct{} `json:"deniednodeacls" bson:"acls,omitempty"` RemoteAccessClientID string `json:"remote_access_client_id"` // unique ID (MAC address) of RAC machine PostUp string `json:"postup" bson:"postup"` PostDown string `json:"postdown" bson:"postdown"` Tags map[TagID]struct{} `json:"tags"` Os string `json:"os"` DeviceName string `json:"device_name"` PublicEndpoint string `json:"public_endpoint"` Country string `json:"country"` }
ExtClient - struct for external clients
func (*ExtClient) AddressIPNet4 ¶ added in v0.22.0
ExtClient.PrimaryAddress - returns ipv4 IPNet format
func (*ExtClient) AddressIPNet6 ¶ added in v0.22.0
ExtClient.AddressIPNet6 - return ipv6 IPNet format
func (*ExtClient) ConvertToStaticNode ¶ added in v0.26.0
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 FormFields ¶ added in v0.22.0
type FormFields []FormField
type FwUpdate ¶
type FwUpdate struct { AllowAll bool `json:"allow_all"` AllowedNetworks []net.IPNet `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 HookDetails ¶
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"` IsStaticPort bool `json:"isstaticport" yaml:"isstaticport"` 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" swaggertype:"primitive,integer" format:"int64" yaml:"persistentkeepalive"` }
Host - represents a host on the network
func (*Host) ConvertNMHostToAPI ¶
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" // SignalPull - request a pull from a host without restart SignalPull HostMqAction = "SIGNAL_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"` IsStaticPort bool `json:"is_static_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"` ManageDNS bool `yaml:"manage_dns"` Stun bool `yaml:"stun"` StunServers string `yaml:"stun_servers"` }
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 { 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"` AllowAll bool `json:"allow_all"` EgressRanges []net.IPNet `json:"egress_ranges"` EgressRanges6 []net.IPNet `json:"egress_ranges6"` }
IngressInfo - struct for ingress info
type IngressRequest ¶
type IngressRequest struct { ExtclientDNS string `json:"extclientdns"` IsInternetGateway bool `json:"is_internet_gw"` Metadata string `json:"metadata"` PersistentKeepalive int32 `json:"persistentkeepalive"` MTU int32 `json:"mtu"` }
IngressRequest - ingress request struct
type IntClient ¶
type IntClient struct { ClientID string `json:"clientid" bson:"clientid"` PrivateKey string `json:"privatekey" bson:"privatekey"` PublicKey string `json:"publickey" bson:"publickey"` AccessKey string `json:"accesskey" bson:"accesskey"` Address string `json:"address" bson:"address"` Address6 string `json:"address6" bson:"address6"` Network string `json:"network" bson:"network"` ServerPublicEndpoint string `json:"serverpublicendpoint" bson:"serverpublicendpoint"` ServerAPIPort string `json:"serverapiport" bson:"serverapiport"` ServerPrivateAddress string `json:"serverprivateaddress" bson:"serverprivateaddress"` ServerWGPort string `json:"serverwgport" bson:"serverwgport"` ServerKey string `json:"serverkey" bson:"serverkey"` IsServer string `json:"isserver" bson:"isserver"` }
type InviteUsersReq ¶ added in v0.25.0
type InviteUsersReq struct { UserEmails []string `json:"user_emails"` PlatformRoleID string `json:"platform_role_id"` UserGroups map[UserGroupID]struct{} `json:"user_group_ids"` NetworkRoles map[NetworkID]map[UserRoleID]struct{} `json:"network_roles"` }
type JoinData ¶
type JoinData struct { Host Host `json:"host" yaml:"host"` Node Node `json:"node" yaml:"node"` Key string `json:"key" yaml:"key"` }
JoinData - struct to hold data required for node to join a network on server
type KeyUpdate ¶
type KeyUpdate struct { Network string `json:"network" bson:"network"` Interface string `json:"interface" bson:"interface"` }
KeyUpdate - key update struct
type LegacyNode ¶
type LegacyNode struct { ID string `` /* 128-byte string literal not displayed */ Address string `json:"address" bson:"address" yaml:"address" validate:"omitempty,ipv4"` Address6 string `json:"address6" bson:"address6" yaml:"address6" validate:"omitempty,ipv6"` LocalAddress string `json:"localaddress" bson:"localaddress" yaml:"localaddress" validate:"omitempty"` Interfaces []Iface `json:"interfaces" yaml:"interfaces"` Name string `` /* 131-byte string literal not displayed */ NetworkSettings Network `json:"networksettings" bson:"networksettings" yaml:"networksettings" validate:"-"` ListenPort int32 `` /* 140-byte string literal not displayed */ LocalListenPort int32 `` /* 127-byte string literal not displayed */ PublicKey string `json:"publickey" bson:"publickey" yaml:"publickey" validate:"required,base64"` Endpoint string `json:"endpoint" bson:"endpoint" yaml:"endpoint" validate:"required,ip"` AllowedIPs []string `json:"allowedips" bson:"allowedips" yaml:"allowedips"` PersistentKeepalive int32 `` /* 130-byte string literal not displayed */ IsHub string `json:"ishub" bson:"ishub" yaml:"ishub" validate:"checkyesorno"` AccessKey string `json:"accesskey" bson:"accesskey" yaml:"accesskey"` Interface string `json:"interface" bson:"interface" yaml:"interface"` LastModified int64 `` /* 128-byte string literal not displayed */ ExpirationDateTime int64 `` /* 127-byte string literal not displayed */ LastPeerUpdate int64 `` /* 130-byte string literal not displayed */ LastCheckIn int64 `` /* 127-byte string literal not displayed */ MacAddress string `json:"macaddress" bson:"macaddress" yaml:"macaddress"` Password string `json:"password" bson:"password" yaml:"password" validate:"required,min=6"` Network string `json:"network" bson:"network" yaml:"network" validate:"network_exists"` IsRelayed string `json:"isrelayed" bson:"isrelayed" yaml:"isrelayed"` IsPending string `json:"ispending" bson:"ispending" yaml:"ispending"` IsRelay string `json:"isrelay" bson:"isrelay" yaml:"isrelay" validate:"checkyesorno"` IsDocker string `json:"isdocker" bson:"isdocker" yaml:"isdocker" validate:"checkyesorno"` IsK8S string `json:"isk8s" bson:"isk8s" yaml:"isk8s" validate:"checkyesorno"` IsEgressGateway string `json:"isegressgateway" bson:"isegressgateway" yaml:"isegressgateway" validate:"checkyesorno"` IsIngressGateway string `json:"isingressgateway" bson:"isingressgateway" yaml:"isingressgateway" validate:"checkyesorno"` EgressGatewayRanges []string `json:"egressgatewayranges" bson:"egressgatewayranges" yaml:"egressgatewayranges"` EgressGatewayNatEnabled string `json:"egressgatewaynatenabled" bson:"egressgatewaynatenabled" yaml:"egressgatewaynatenabled"` EgressGatewayRequest EgressGatewayRequest `json:"egressgatewayrequest" bson:"egressgatewayrequest" yaml:"egressgatewayrequest"` RelayAddrs []string `json:"relayaddrs" bson:"relayaddrs" yaml:"relayaddrs"` FailoverNode string `json:"failovernode" bson:"failovernode" yaml:"failovernode"` IngressGatewayRange string `json:"ingressgatewayrange" bson:"ingressgatewayrange" yaml:"ingressgatewayrange"` IngressGatewayRange6 string `json:"ingressgatewayrange6" bson:"ingressgatewayrange6" yaml:"ingressgatewayrange6"` // IsStatic - refers to if the Endpoint is set manually or dynamically IsStatic string `json:"isstatic" bson:"isstatic" yaml:"isstatic" validate:"checkyesorno"` UDPHolePunch string `json:"udpholepunch" bson:"udpholepunch" yaml:"udpholepunch" validate:"checkyesorno"` DNSOn string `json:"dnson" bson:"dnson" yaml:"dnson" validate:"checkyesorno"` IsServer string `json:"isserver" bson:"isserver" yaml:"isserver" validate:"checkyesorno"` Action string `json:"action" bson:"action" yaml:"action"` IPForwarding string `json:"ipforwarding" bson:"ipforwarding" yaml:"ipforwarding" validate:"checkyesorno"` OS string `json:"os" bson:"os" yaml:"os"` MTU int32 `json:"mtu" bson:"mtu" yaml:"mtu"` Version string `json:"version" bson:"version" yaml:"version"` Server string `json:"server" bson:"server" yaml:"server"` TrafficKeys TrafficKeys `json:"traffickeys" bson:"traffickeys" yaml:"traffickeys"` FirewallInUse string `json:"firewallinuse" bson:"firewallinuse" yaml:"firewallinuse"` InternetGateway string `json:"internetgateway" bson:"internetgateway" yaml:"internetgateway"` Connected string `json:"connected" bson:"connected" yaml:"connected" validate:"checkyesorno"` // == PRO == DefaultACL string `json:"defaultacl,omitempty" bson:"defaultacl,omitempty" yaml:"defaultacl,omitempty" validate:"checkyesornoorunset"` OwnerID string `json:"ownerid,omitempty" bson:"ownerid,omitempty" yaml:"ownerid,omitempty"` Failover string `json:"failover" bson:"failover" yaml:"failover" validate:"checkyesorno"` }
LegacyNode - legacy struct for node model
func (*LegacyNode) ConvertToNewNode ¶
func (ln *LegacyNode) ConvertToNewNode() (*Host, *Node)
func (*LegacyNode) NameInNodeCharSet ¶
func (node *LegacyNode) NameInNodeCharSet() bool
Node.NameInNodeCharset - returns if name is in charset below or not
func (*LegacyNode) SetDNSOnDefault ¶
func (node *LegacyNode) SetDNSOnDefault()
Node.SetDNSOnDefault - sets dns on default
func (*LegacyNode) 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 Metric ¶
type Metric struct { NodeName string `json:"node_name" bson:"node_name" yaml:"node_name"` Uptime int64 `json:"uptime" bson:"uptime" yaml:"uptime" swaggertype:"primitive,integer" format:"int64"` TotalTime int64 `json:"totaltime" bson:"totaltime" yaml:"totaltime" swaggertype:"primitive,integer" format:"int64"` Latency int64 `json:"latency" bson:"latency" yaml:"latency" swaggertype:"primitive,integer" format:"int64"` TotalReceived int64 `json:"totalreceived" bson:"totalreceived" yaml:"totalreceived" swaggertype:"primitive,integer" format:"int64"` LastTotalReceived int64 `json:"lasttotalreceived" bson:"lasttotalreceived" yaml:"lasttotalreceived" swaggertype:"primitive,integer" format:"int64"` TotalSent int64 `json:"totalsent" bson:"totalsent" yaml:"totalsent" swaggertype:"primitive,integer" format:"int64"` LastTotalSent int64 `json:"lasttotalsent" bson:"lasttotalsent" yaml:"lasttotalsent" swaggertype:"primitive,integer" format:"int64"` ActualUptime time.Duration `json:"actualuptime" swaggertype:"primitive,integer" format:"int64" bson:"actualuptime" yaml:"actualuptime"` PercentUp float64 `json:"percentup" bson:"percentup" yaml:"percentup"` Connected bool `json:"connected" bson:"connected" yaml:"connected"` }
Metric - holds a metric for data between nodes
type Metrics ¶
type Metrics struct { Network string `json:"network" bson:"network" yaml:"network"` NodeID string `json:"node_id" bson:"node_id" yaml:"node_id"` NodeName string `json:"node_name" bson:"node_name" yaml:"node_name"` Connectivity map[string]Metric `json:"connectivity" bson:"connectivity" yaml:"connectivity"` }
Metrics - metrics struct
type MetricsMap ¶
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" swaggertype:"primitive,integer" format:"int64"` NetworkLastModified int64 `json:"networklastmodified" bson:"networklastmodified" swaggertype:"primitive,integer" format:"int64"` DefaultInterface string `json:"defaultinterface" bson:"defaultinterface" validate:"min=1,max=35"` DefaultListenPort int32 `json:"defaultlistenport,omitempty" bson:"defaultlistenport,omitempty" validate:"omitempty,min=1024,max=65535"` NodeLimit int32 `json:"nodelimit" bson:"nodelimit"` DefaultPostDown string `json:"defaultpostdown" bson:"defaultpostdown"` DefaultKeepalive int32 `json:"defaultkeepalive" bson:"defaultkeepalive" validate:"omitempty,max=1000"` AllowManualSignUp string `json:"allowmanualsignup" bson:"allowmanualsignup" validate:"checkyesorno"` IsIPv4 string `json:"isipv4" bson:"isipv4" validate:"checkyesorno"` IsIPv6 string `json:"isipv6" bson:"isipv6" validate:"checkyesorno"` DefaultUDPHolePunch string `json:"defaultudpholepunch" bson:"defaultudpholepunch" validate:"checkyesorno"` DefaultMTU int32 `json:"defaultmtu" bson:"defaultmtu"` DefaultACL string `json:"defaultacl" bson:"defaultacl" yaml:"defaultacl" validate:"checkyesorno"` }
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) GetNetworkNetworkCIDR6 ¶ added in v0.21.2
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 NetworkID ¶ added in v0.25.0
type NetworkID string
const AllNetworks NetworkID = "all_networks"
type NetworkMetrics ¶
type NetworkMetrics struct {
Nodes MetricsMap `json:"nodes" bson:"nodes" yaml:"nodes"`
}
NetworkMetrics - metrics model for all nodes in a network
type NetworkStatResp ¶ added in v0.26.0
type 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"` IngressPersistentKeepalive int32 `json:"ingresspersistentkeepalive" bson:"ingresspersistentkeepalive" yaml:"ingresspersistentkeepalive"` IngressMTU int32 `json:"ingressmtu" bson:"ingressmtu" yaml:"ingressmtu"` 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 `` /* 150-byte string literal not displayed */ Tags map[TagID]struct{} `json:"tags" yaml:"tags"` IsStatic bool `json:"is_static"` IsUserNode bool `json:"is_user_node"` StaticNode ExtClient `json:"static_node"` Status NodeStatus `json:"node_status"` }
Node - a model of a network node
func (*Node) AddressIPNet4 ¶ added in v0.30.0
func (*Node) AddressIPNet6 ¶ added in v0.30.0
func (*Node) ConvertToAPINode ¶
Node.ConvertToAPINode - converts a node to an API node
func (*Node) DoesACLAllow ¶
Node.DoesACLAllow - checks if default ACL on node is "yes"
func (*Node) DoesACLDeny ¶
Node.DoesACLDeny - checks if default ACL on node is "no"
func (*Node) Fill ¶
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 ¶
Node.NetworkSettings updates a node with network settings
func (*Node) PrimaryAddress ¶
Node.PrimaryAddress - return ipv4 address if present, else return ipv6
func (*Node) PrimaryAddressIPNet ¶
Node.PrimaryAddress - return ipv4 address if present, else return ipv6
func (*Node) PrimaryNetworkRange ¶
Node.PrimaryNetworkRange - returns node's parent network, returns ipv4 address if present, else return ipv6
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 NodeCheckin ¶
NodeCheckin - struct for node checkins with server
type NodeGet ¶
type NodeGet struct { Node Node `json:"node" bson:"node" yaml:"node"` Host Host `json:"host" yaml:"host"` Peers []wgtypes.PeerConfig `json:"peers" bson:"peers" yaml:"peers"` HostPeers []wgtypes.PeerConfig `json:"host_peers" bson:"host_peers" yaml:"host_peers"` ServerConfig ServerConfig `json:"serverconfig" bson:"serverconfig" yaml:"serverconfig"` PeerIDs PeerMap `json:"peerids,omitempty" bson:"peerids,omitempty" yaml:"peerids,omitempty"` }
NodeGet - struct for a single node get response
type NodeJoinResponse ¶
type NodeJoinResponse struct { Node Node `json:"node" bson:"node" yaml:"node"` Host Host `json:"host" yaml:"host"` ServerConfig ServerConfig `json:"serverconfig" bson:"serverconfig" yaml:"serverconfig"` Peers []wgtypes.PeerConfig `json:"peers" bson:"peers" yaml:"peers"` }
NodeJoinResponse data returned to node in response to join
type NodeStatus ¶ added in v0.30.0
type NodeStatus string
const ( OnlineSt NodeStatus = "online" OfflineSt NodeStatus = "offline" WarningSt NodeStatus = "warning" ErrorSt NodeStatus = "error" UnKnown NodeStatus = "unknown" )
type NodesArray ¶
type NodesArray []Node
NodesArray - used for node sorting
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 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 ProtocolType ¶ added in v0.30.0
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"` AuthType AuthType `json:"auth_type"` RemoteGwIDs map[string]struct{} `json:"remote_gw_ids"` // deprecated UserGroups map[UserGroupID]struct{} `json:"user_group_ids"` PlatformRoleID UserRoleID `json:"platform_role_id"` NetworkRoles map[NetworkID]map[UserRoleID]struct{} `json:"network_roles"` LastLoginTime time.Time `json:"last_login_time"` }
ReturnUser - return user struct
type ReturnUserWithRolesAndGroups ¶ added in v0.25.0
type ReturnUserWithRolesAndGroups struct { ReturnUser PlatformRole UserRolePermissionTemplate `json:"platform_role"` }
type RsrcID ¶ added in v0.25.0
type RsrcID string
const ( AllHostRsrcID RsrcID = "all_host" AllRelayRsrcID RsrcID = "all_relay" AllRemoteAccessGwRsrcID RsrcID = "all_remote_access_gw" AllExtClientsRsrcID RsrcID = "all_extclients" AllInetGwRsrcID RsrcID = "all_inet_gw" AllEgressGwRsrcID RsrcID = "all_egress" AllNetworkRsrcID RsrcID = "all_network" AllEnrollmentKeysRsrcID RsrcID = "all_enrollment_key" AllUserRsrcID RsrcID = "all_user" AllDnsRsrcID RsrcID = "all_dns" AllFailOverRsrcID RsrcID = "all_fail_over" AllAclsRsrcID RsrcID = "all_acl" AllTagsRsrcID RsrcID = "all_tag" )
type RsrcPermissionScope ¶ added in v0.25.0
type RsrcType ¶ added in v0.25.0
type RsrcType string
const ( HostRsrc RsrcType = "hosts" RelayRsrc RsrcType = "relays" RemoteAccessGwRsrc RsrcType = "remote_access_gw" ExtClientsRsrc RsrcType = "extclients" InetGwRsrc RsrcType = "inet_gw" EgressGwRsrc RsrcType = "egress" NetworkRsrc RsrcType = "networks" EnrollmentKeysRsrc RsrcType = "enrollment_key" UserRsrc RsrcType = "users" AclRsrc RsrcType = "acl" TagRsrc RsrcType = "tag" DnsRsrc RsrcType = "dns" FailOverRsrc RsrcType = "fail_over" MetricRsrc RsrcType = "metrics" )
type RsrcURLInfo ¶ added in v0.25.0
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"` MetricInterval string `yaml:"metric_interval"` ManageDNS bool `yaml:"manage_dns"` Stun bool `yaml:"stun"` StunServers string `yaml:"stun_servers"` DefaultDomain string `yaml:"default_domain"` }
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 ServiceType ¶ added in v0.30.0
type ServiceType string
type SignInReqDto ¶ added in v0.22.0
type SignInReqDto struct {
FormFields FormFields `json:"formFields"`
}
type SignInResDto ¶ added in v0.22.0
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 SsoLoginReqDto ¶ added in v0.22.0
type SsoLoginReqDto struct {
OauthProvider string `json:"oauthprovider"`
}
type SsoLoginResDto ¶ added in v0.22.0
type SuccessResponse ¶
SuccessResponse is struct for sending error message with code.
type SuccessfulLoginResponse ¶
SuccessfulLoginResponse is struct to send the request response
type SuccessfulUserLoginResponse ¶
SuccessfulUserLoginResponse - successlogin struct
type Tag ¶ added in v0.26.0
type Tag struct { ID TagID `json:"id"` TagName string `json:"tag_name"` Network NetworkID `json:"network"` CreatedBy string `json:"created_by"` CreatedAt time.Time `json:"created_at"` }
func (Tag) GetIDFromName ¶ added in v0.26.0
type TagListResp ¶ added in v0.26.0
type TagListRespNodes ¶ added in v0.26.0
type Telemetry ¶
type Telemetry struct { UUID string `json:"uuid" bson:"uuid"` LastSend int64 `json:"lastsend" bson:"lastsend" swaggertype:"primitive,integer" format:"int64"` TrafficKeyPriv []byte `json:"traffickeypriv" bson:"traffickeypriv"` TrafficKeyPub []byte `json:"traffickeypub" bson:"traffickeypub"` }
Telemetry - contains UUID of the server and timestamp of last send to posthog also contains assymetrical encryption pub/priv keys for any server traffic
type TenantLoginResDto ¶ added in v0.22.0
type TrafficKeys ¶
type TrafficKeys struct { Mine []byte `json:"mine" bson:"mine" yaml:"mine"` Server []byte `json:"server" bson:"server" yaml:"server"` }
TrafficKeys - struct to hold public keys
type UpdateAclRequest ¶ added in v0.26.0
type UpdateTagReq ¶ added in v0.26.0
type User ¶
type User struct { UserName string `json:"username" bson:"username" validate:"min=3,in_charset|email"` ExternalIdentityProviderID string `json:"external_identity_provider_id"` Password string `json:"password" bson:"password" validate:"required,min=5"` IsAdmin bool `json:"isadmin" bson:"isadmin"` // deprecated IsSuperAdmin bool `json:"issuperadmin"` // deprecated RemoteGwIDs map[string]struct{} `json:"remote_gw_ids"` // deprecated AuthType AuthType `json:"auth_type"` UserGroups map[UserGroupID]struct{} `json:"user_group_ids"` PlatformRoleID UserRoleID `json:"platform_role_id"` NetworkRoles map[NetworkID]map[UserRoleID]struct{} `json:"network_roles"` LastLoginTime time.Time `json:"last_login_time"` }
User struct - struct for Users
func (*User) NameInCharSet ¶
User.NameInCharset - returns if name is in charset below or not
type UserAuthParams ¶
UserAuthParams - user auth params struct
type UserClaims ¶
type UserClaims struct { Role UserRoleID UserName string RacAutoDisable bool jwt.RegisteredClaims }
UserClaims - user claims struct
type UserGroup ¶ added in v0.25.0
type UserGroup struct { ID UserGroupID `json:"id"` Default bool `json:"default"` Name string `json:"name"` NetworkRoles map[NetworkID]map[UserRoleID]struct{} `json:"network_roles"` MetaData string `json:"meta_data"` }
type UserGroupID ¶ added in v0.25.0
type UserGroupID string
func (UserGroupID) String ¶ added in v0.25.0
func (g UserGroupID) String() string
type UserInvite ¶ added in v0.25.0
type UserInvite struct { Email string `json:"email"` PlatformRoleID string `json:"platform_role_id"` UserGroups map[UserGroupID]struct{} `json:"user_group_ids"` NetworkRoles map[NetworkID]map[UserRoleID]struct{} `json:"network_roles"` InviteCode string `json:"invite_code"` InviteURL string `json:"invite_url"` }
UserInvite - model for user invite
type 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"` }
UserRemoteGws - struct to hold user's remote gws
type UserRemoteGwsReq ¶
type UserRemoteGwsReq struct {
RemoteAccessClientID string `json:"remote_access_clientid"`
}
UserRemoteGwsReq - struct to hold user remote acccess gws req
type UserRoleID ¶ added in v0.25.0
type UserRoleID string
const ( SuperAdminRole UserRoleID = "super-admin" AdminRole UserRoleID = "admin" ServiceUser UserRoleID = "service-user" PlatformUser UserRoleID = "platform-user" NetworkAdmin UserRoleID = "network-admin" NetworkUser UserRoleID = "network-user" )
func GetRAGRoleID ¶ added in v0.25.0
func GetRAGRoleID(netID, hostID string) UserRoleID
func (UserRoleID) String ¶ added in v0.25.0
func (r UserRoleID) String() string
type UserRolePermissionTemplate ¶ added in v0.25.0
type UserRolePermissionTemplate struct { ID UserRoleID `json:"id"` Name string `json:"name"` Default bool `json:"default"` MetaData string `json:"meta_data"` DenyDashboardAccess bool `json:"deny_dashboard_access"` FullAccess bool `json:"full_access"` NetworkID NetworkID `json:"network_id"` NetworkLevelAccess map[RsrcType]map[RsrcID]RsrcPermissionScope `json:"network_level_access"` GlobalLevelAccess map[RsrcType]map[RsrcID]RsrcPermissionScope `json:"global_level_access"` }