Documentation ¶
Index ¶
- type Peer
- func (p *Peer) AddedWithSSOLogin() bool
- func (p *Peer) Copy() *Peer
- func (p *Peer) EventMeta(dnsDomain string) map[string]any
- func (p *Peer) FQDN(dnsDomain string) string
- func (p *Peer) LoginExpired(expiresIn time.Duration) (bool, time.Duration)
- func (p *Peer) MarkLoginExpired(expired bool)
- func (p *Peer) UpdateLastLogin() *Peer
- func (p *Peer) UpdateMetaIfNew(meta PeerSystemMeta) bool
- type PeerStatus
- type PeerSystemMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Peer ¶
type Peer struct { // ID is an internal ID of the peer ID string `gorm:"primaryKey"` // AccountID is a reference to Account that this object belongs AccountID string `json:"-" gorm:"index;uniqueIndex:idx_peers_account_id_ip"` // WireGuard public key Key string `gorm:"index"` // A setup key this peer was registered with SetupKey string // IP address of the Peer IP net.IP `gorm:"uniqueIndex:idx_peers_account_id_ip"` // Meta is a Peer system meta data Meta PeerSystemMeta `gorm:"embedded;embeddedPrefix:meta_"` // Name is peer's name (machine name) Name string // DNSLabel is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's // domain to the peer label. e.g. peer-dns-label.netbird.cloud DNSLabel string // Status peer's management connection status Status *PeerStatus `gorm:"embedded;embeddedPrefix:peer_status_"` // The user ID that registered the peer UserID string // SSHKey is a public SSH key of the peer SSHKey string // SSHEnabled indicates whether SSH server is enabled on the peer SSHEnabled bool // LoginExpirationEnabled indicates whether peer's login expiration is enabled and once expired the peer has to re-login. // Works with LastLogin LoginExpirationEnabled bool // LastLogin the time when peer performed last login operation LastLogin time.Time // Indicate ephemeral peer attribute Ephemeral bool }
Peer represents a machine connected to the network. The Peer is a WireGuard peer identified by a public key
func (*Peer) AddedWithSSOLogin ¶
AddedWithSSOLogin indicates whether this peer has been added with an SSO login by a user.
func (*Peer) FQDN ¶
FQDN returns peers FQDN combined of the peer's DNS label and the system's DNS domain
func (*Peer) LoginExpired ¶
LoginExpired indicates whether the peer's login has expired or not. If Peer.LastLogin plus the expiresIn duration has happened already; then login has expired. Return true if a login has expired, false otherwise, and time left to expiration (negative when expired). Login expiration can be disabled/enabled on a Peer level via Peer.LoginExpirationEnabled property. Login expiration can also be disabled/enabled globally on the Account level via Settings.PeerLoginExpirationEnabled. Only peers added by interactive SSO login can be expired.
func (*Peer) MarkLoginExpired ¶
MarkLoginExpired marks peer's status expired or not
func (*Peer) UpdateLastLogin ¶
UpdateLastLogin and set login expired false
func (*Peer) UpdateMetaIfNew ¶
func (p *Peer) UpdateMetaIfNew(meta PeerSystemMeta) bool
UpdateMetaIfNew updates peer's system metadata if new information is provided returns true if meta was updated, false otherwise
type PeerStatus ¶
type PeerStatus struct { // LastSeen is the last time peer was connected to the management service LastSeen time.Time // Connected indicates whether peer is connected to the management service or not Connected bool // LoginExpired LoginExpired bool // RequiresApproval indicates whether peer requires approval or not RequiresApproval bool }