clientcontext

package
v3.0.0-rc65 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Err is raised when a context definition has issues.
	Err = errors.New("context error")

	ConfigFolder = "~/.config/opensvc/"
	// ConfigFilename is the file where the context information is stored
	ConfigFilename = ConfigFolder + "contexts"
)

Functions

func IsRemote

func IsRemote() bool

IsRemote says the command reaches the daemon as a client only, reading nothing of the node it runs on: a context names the cluster, or the caller, not root, goes through the user socket. A caller that is not remote is root on a node, which may read the node files, as the known nodes or the installed objects, when the daemon does not answer.

func IsSet

func IsSet() bool

IsSet returns true if the OSVC_CONTEXT environment variable is set

func Load

func Load() (config, error)

func UseUserSocketForNonRoot

func UseUserSocketForNonRoot()

UseUserSocketForNonRoot makes the clients of a caller other than root, with no context, reach the user socket, as ox does: the daemon authenticates the local account connected, with the grants the cluster configuration and the usr objects give it.

func UsesUserSocket

func UsesUserSocket() bool

UsesUserSocket says the clients reach the user socket: a caller other than root, with no context, of a command that uses it.

Types

type Cluster

type Cluster struct {
	CertificateAuthority *string `json:"certificate_authority,omitempty"`
	Server               string  `json:"server"`
	InsecureSkipVerify   *bool   `json:"insecure,omitempty"`
}

Cluster host the endpoint address or name, and the certificate authority to trust.

type Relation

type Relation struct {
	ClusterRefName       string             `json:"cluster"`
	UserRefName          string             `json:"user"`
	Namespace            *string            `json:"namespace,omitempty"`
	AccessTokenDuration  *duration.Duration `json:"access_token_duration,omitempty"`
	RefreshTokenDuration *duration.Duration `json:"refresh_token_duration,omitempty"`
}

Relation is a Cluster-User relation.

type T

type T struct {
	Cluster   Cluster `json:"cluster"`
	User      User    `json:"user"`
	Namespace string  `json:"namespace"`
}

T is a dereferenced Cluster-User relation.

func New

func New() (T, error)

New return a remote cluster connection context (endpoint and user)

func (T) String

func (t T) String() string

type TokenInfo

type TokenInfo struct {
	Name            string `json:"name"`
	AccessExpireAt  string `json:"access_expired_at"`
	RefreshExpireAt string `json:"refresh_expired_at"`
	Authenticated   bool   `json:"authenticated"`
	AuthenticatedAt string `json:"authenticated_at"`

	// Store is where the tokens are kept: the context file for a
	// password login, the token store of an openid one.
	Store string `json:"store"`

	// Issuer is the openid issuer of the tokens, empty for a password
	// login.
	Issuer string `json:"issuer,omitempty"`
}

func (*TokenInfo) Unstructured

func (t *TokenInfo) Unstructured() map[string]any

type User

type User struct {
	ClientCertificate *string `json:"client_certificate,omitempty"`
	ClientKey         *string `json:"client_key,omitempty"`
	Name              *string `json:"name,omitempty"`
}

User hosts the certificate and private to use to connect to the remote cluster.

Jump to

Keyboard shortcuts

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