connectmycomputer

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessAndIdentity

type AccessAndIdentity interface {
	// See services.Access.GetRole.
	GetRole(ctx context.Context, name string) (types.Role, error)
	// See services.Access.CreateRole.
	CreateRole(context.Context, types.Role) (types.Role, error)
	// See services.Access.UpdateRole.
	UpdateRole(context.Context, types.Role) (types.Role, error)
	// See auth.Cache.NewWatcher.
	NewWatcher(ctx context.Context, watch types.Watch) (types.Watcher, error)

	// See services.Identity.GetUser.
	GetUser(ctx context.Context, name string, withSecrets bool) (types.User, error)
	// See services.Identity.UpdateUser.
	UpdateUser(context.Context, types.User) (types.User, error)

	// See services.Presence.GetNode.
	GetNode(ctx context.Context, namespace, name string) (types.Server, error)
}

AccessAndIdentity represents services.Access, services.Identity, services.Presence and auth.Cache methods used by RoleSetup. During a normal operation, auth.ClientI is passed as this interface.

type CertManager

type CertManager interface {
	// See [client.ProxyClient.ReissueUserCerts].
	ReissueUserCerts(context.Context, client.CertCachePolicy, client.ReissueParams) error
}

CertManager enables the usage of only select methods from client.ProxyClient so that there is no need to mock the whole ProxyClient interface in tests.

type NodeDelete

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

func NewNodeDelete

func NewNodeDelete(cfg *NodeDeleteConfig) (*NodeDelete, error)

func (*NodeDelete) Run

func (n *NodeDelete) Run(ctx context.Context, presence Presence, cluster *clusters.Cluster) error

Run grabs the host UUID of an agent from a disk and deletes the node with that name.

type NodeDeleteConfig

type NodeDeleteConfig struct {
	// AgentsDir contains agent config files and data directories for Connect My Computer.
	AgentsDir string
}

type NodeJoinWait

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

func NewNodeJoinWait

func NewNodeJoinWait(cfg *NodeJoinWaitConfig) (*NodeJoinWait, error)

func (*NodeJoinWait) Run

func (n *NodeJoinWait) Run(ctx context.Context, accessAndIdentity AccessAndIdentity, cluster *clusters.Cluster) (clusters.Server, error)

Run grabs the host UUID of an agent from disk and then waits for the node with the given name to show up in the cluster.

The Electron app calls this method soon after starting the agent process.

type NodeJoinWaitConfig

type NodeJoinWaitConfig struct {
	// AgentsDir contains agent config files and data directories for Connect My Computer.
	AgentsDir string
}

func (*NodeJoinWaitConfig) CheckAndSetDefaults

func (c *NodeJoinWaitConfig) CheckAndSetDefaults() error

type NodeName

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

func NewNodeName

func NewNodeName(cfg *NodeNameConfig) (*NodeName, error)

func (*NodeName) Get

func (n *NodeName) Get(cluster *clusters.Cluster) (string, error)

Get returns the host UUID of the agent from a disk.

type NodeNameConfig

type NodeNameConfig struct {
	// AgentsDir contains agent config files and data directories for Connect My Computer.
	AgentsDir string
}

type Presence

type Presence interface {
	// See services.Presence.GetNode.
	DeleteNode(ctx context.Context, namespace, name string) error
}

Presence represents services.Presence methods used by NodeDelete. During a normal operation, auth.ClientI is passed as this interface.

type Provisioner

type Provisioner interface {
	// See services.Provisioner.CreateToken.
	CreateToken(ctx context.Context, token types.ProvisionToken) error
}

Provisioner represents services.Provisioner methods used by TokenProvisioner. During a normal operation, auth.ClientI is passed as this interface.

type RoleSetup

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

func NewRoleSetup

func NewRoleSetup(cfg *RoleSetupConfig) (*RoleSetup, error)

func (*RoleSetup) Run

func (s *RoleSetup) Run(ctx context.Context, accessAndIdentity AccessAndIdentity, certManager CertManager, cluster *clusters.Cluster) (RoleSetupResult, error)

Run ensures that at the end of its execution the user has their own individual Connect My Computer role and that the role includes the current system username in allowed logins.

If the role list of the user got updated, the return value has CertsReloaded set to true.

type RoleSetupConfig

type RoleSetupConfig struct {
	Log *logrus.Entry
}

func (*RoleSetupConfig) CheckAndSetDefaults

func (c *RoleSetupConfig) CheckAndSetDefaults() error

type RoleSetupResult

type RoleSetupResult struct {
	CertsReloaded bool
}

type TokenProvisioner

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

func NewTokenProvisioner

func NewTokenProvisioner(cfg *TokenProvisionerConfig) *TokenProvisioner

func (*TokenProvisioner) CreateNodeToken

func (t *TokenProvisioner) CreateNodeToken(ctx context.Context, provisioner Provisioner, cluster *clusters.Cluster) (string, error)

CreateNodeToken creates a node join token that is valid for 5 minutes.

type TokenProvisionerConfig

type TokenProvisionerConfig struct {
	Clock clockwork.Clock
}

Jump to

Keyboard shortcuts

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