activity

package
v0.0.0-...-93fed14 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SystemInitiator = "sys"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity

type Activity int

Activity that triggered an Event

const (
	// PeerAddedByUser indicates that a user added a new peer to the system
	PeerAddedByUser Activity = iota
	// PeerAddedWithSetupKey indicates that a new peer joined the system using a setup key
	PeerAddedWithSetupKey
	// UserJoined indicates that a new user joined the account
	UserJoined
	// UserInvited indicates that a new user was invited to join the account
	UserInvited
	// AccountCreated indicates that a new account has been created
	AccountCreated
	// PeerRemovedByUser indicates that a user removed a peer from the system
	PeerRemovedByUser
	// RuleAdded indicates that a user added a new rule
	RuleAdded
	// RuleUpdated indicates that a user updated a rule
	RuleUpdated
	// RuleRemoved indicates that a user removed a rule
	RuleRemoved
	// PolicyAdded indicates that a user added a new policy
	PolicyAdded
	// PolicyUpdated indicates that a user updated a policy
	PolicyUpdated
	// PolicyRemoved indicates that a user removed a policy
	PolicyRemoved
	// SetupKeyCreated indicates that a user created a new setup key
	SetupKeyCreated
	// SetupKeyUpdated indicates that a user updated a setup key
	SetupKeyUpdated
	// SetupKeyRevoked indicates that a user revoked a setup key
	SetupKeyRevoked
	// SetupKeyOverused indicates that setup key usage exhausted
	SetupKeyOverused
	// GroupCreated indicates that a user created a group
	GroupCreated
	// GroupUpdated indicates that a user updated a group
	GroupUpdated
	// GroupAddedToPeer indicates that a user added group to a peer
	GroupAddedToPeer
	// GroupRemovedFromPeer indicates that a user removed peer group
	GroupRemovedFromPeer
	// GroupAddedToUser indicates that a user added group to a user
	GroupAddedToUser
	// GroupRemovedFromUser indicates that a user removed a group from a user
	GroupRemovedFromUser
	// UserRoleUpdated indicates that a user changed the role of a user
	UserRoleUpdated
	// GroupAddedToSetupKey indicates that a user added group to a setup key
	GroupAddedToSetupKey
	// GroupRemovedFromSetupKey indicates that a user removed a group from a setup key
	GroupRemovedFromSetupKey
	// GroupAddedToDisabledManagementGroups indicates that a user added a group to the DNS setting Disabled management groups
	GroupAddedToDisabledManagementGroups
	// GroupRemovedFromDisabledManagementGroups indicates that a user removed a group from the DNS setting Disabled management groups
	GroupRemovedFromDisabledManagementGroups
	// RouteCreated indicates that a user created a route
	RouteCreated
	// RouteRemoved indicates that a user deleted a route
	RouteRemoved
	// RouteUpdated indicates that a user updated a route
	RouteUpdated
	// PeerSSHEnabled indicates that a user enabled SSH server on a peer
	PeerSSHEnabled
	// PeerSSHDisabled indicates that a user disabled SSH server on a peer
	PeerSSHDisabled
	// PeerRenamed indicates that a user renamed a peer
	PeerRenamed
	// PeerLoginExpirationEnabled indicates that a user enabled login expiration of a peer
	PeerLoginExpirationEnabled
	// PeerLoginExpirationDisabled indicates that a user disabled login expiration of a peer
	PeerLoginExpirationDisabled
	// NameserverGroupCreated indicates that a user created a nameservers group
	NameserverGroupCreated
	// NameserverGroupDeleted indicates that a user deleted a nameservers group
	NameserverGroupDeleted
	// NameserverGroupUpdated indicates that a user updated a nameservers group
	NameserverGroupUpdated
	// AccountPeerLoginExpirationEnabled indicates that a user enabled peer login expiration for the account
	AccountPeerLoginExpirationEnabled
	// AccountPeerLoginExpirationDisabled indicates that a user disabled peer login expiration for the account
	AccountPeerLoginExpirationDisabled
	// AccountPeerLoginExpirationDurationUpdated indicates that a user updated peer login expiration duration for the account
	AccountPeerLoginExpirationDurationUpdated
	// PersonalAccessTokenCreated indicates that a user created a personal access token
	PersonalAccessTokenCreated
	// PersonalAccessTokenDeleted indicates that a user deleted a personal access token
	PersonalAccessTokenDeleted
	// ServiceUserCreated indicates that a user created a service user
	ServiceUserCreated
	// ServiceUserDeleted indicates that a user deleted a service user
	ServiceUserDeleted
	// UserBlocked indicates that a user blocked another user
	UserBlocked
	// UserUnblocked indicates that a user unblocked another user
	UserUnblocked
	// UserDeleted indicates that a user deleted another user
	UserDeleted
	// GroupDeleted indicates that a user deleted group
	GroupDeleted
	// UserLoggedInPeer indicates that user logged in their peer with an interactive SSO login
	UserLoggedInPeer
	// PeerLoginExpired indicates that the user peer login has been expired and peer disconnected
	PeerLoginExpired
	// DashboardLogin indicates that the user logged in to the dashboard
	DashboardLogin
	// IntegrationCreated indicates that the user created an integration
	IntegrationCreated
	// IntegrationUpdated indicates that the user updated an integration
	IntegrationUpdated
	// IntegrationDeleted indicates that the user deleted an integration
	IntegrationDeleted
	// AccountPeerApprovalEnabled indicates that the user enabled peer approval for the account
	AccountPeerApprovalEnabled
	// AccountPeerApprovalDisabled indicates that the user disabled peer approval for the account
	AccountPeerApprovalDisabled
	// PeerApproved indicates that the peer has been approved
	PeerApproved
	// PeerApprovalRevoked indicates that the peer approval has been revoked
	PeerApprovalRevoked
	// TransferredOwnerRole indicates that the user transferred the owner role of the account
	TransferredOwnerRole
)

func (Activity) Message

func (a Activity) Message() string

Message returns a string representation of an activity

func (Activity) StringCode

func (a Activity) StringCode() string

StringCode returns a string code of the activity

type Code

type Code struct {
	// contains filtered or unexported fields
}

Code is an activity string representation

type Event

type Event struct {
	// Timestamp of the event
	Timestamp time.Time
	// Activity that was performed during the event
	Activity Activity
	// ID of the event (can be empty, meaning that it wasn't yet generated)
	ID uint64
	// InitiatorID is the ID of an object that initiated the event (e.g., a user)
	InitiatorID string
	// InitiatorName is the name of an object that initiated the event.
	InitiatorName string
	// InitiatorEmail is the email address of an object that initiated the event.
	InitiatorEmail string
	// TargetID is the ID of an object that was effected by the event (e.g., a peer)
	TargetID string
	// AccountID is the ID of an account where the event happened
	AccountID string

	// Meta of the event, e.g. deleted peer information like name, IP, etc
	Meta map[string]any
}

Event represents a network/system activity event.

func (*Event) Copy

func (e *Event) Copy() *Event

Copy the event

type InMemoryEventStore

type InMemoryEventStore struct {
	// contains filtered or unexported fields
}

InMemoryEventStore implements the Store interface storing data in-memory

func (*InMemoryEventStore) Close

func (store *InMemoryEventStore) Close() error

Close cleans up the event list

func (*InMemoryEventStore) Get

func (store *InMemoryEventStore) Get(accountID string, offset, limit int, descending bool) ([]*Event, error)

Get returns a list of ALL events that belong to the given accountID without taking offset, limit and order into consideration

func (*InMemoryEventStore) Save

func (store *InMemoryEventStore) Save(event *Event) (*Event, error)

Save sets the Event.ID to 1

type Store

type Store interface {
	// Save an event in the store
	Save(event *Event) (*Event, error)
	// Get returns "limit" number of events from the "offset" index ordered descending or ascending by a timestamp
	Get(accountID string, offset, limit int, descending bool) ([]*Event, error)
	// Close the sink flushing events if necessary
	Close() error
}

Store provides an interface to store or stream events.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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