clientutil

package
v0.1.2-iss62-2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: MIT Imports: 10 Imported by: 1 module, 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

Overview

Package clientutil provides some util functions to set client

Index

Constants

View Source
const (
	// TokenPrefix is the prefix used for cached tokens in the file system.
	TokenPrefix = "token"

	// BarearTokenKey is the key used to store the barear token in the file cache.
	BarearTokenKey = "barear"
)

Variables

This section is empty.

Functions

func NewAuthedClient

func NewAuthedClient(
	config *config.GlobalConfig,
) (*client.Client, error)

NewAuthedClient creates a new authenticated OpAMP client using the cached barear token. It retrieves the token from the file cache and initializes the client with it.

func NewAuthedClientByIssuingTokenInCli

func NewAuthedClientByIssuingTokenInCli(
	conf *config.GlobalConfig,

	writer io.Writer,

	logger *slog.Logger,
) (*client.Client, error)

NewAuthedClientByIssuingTokenInCli creates a new authenticated OpAMP client by issuing a token in the CLI. It supports different authentication methods such as basic auth, manual token input, and GitHub device.

func NewClient

func NewClient(
	config *config.GlobalConfig,
	writer io.Writer,
	logger *slog.Logger,
) (*client.Client, error)

NewClient creates a new authenticated Client.

func TokenPath

func TokenPath(username string) string

TokenPath constructs the file path for the cached token of a specific user.

Types

type UnsupportedAuthMethodError

type UnsupportedAuthMethodError struct {
	Method string
}

UnsupportedAuthMethodError represents an error for unsupported authentication methods.

func (*UnsupportedAuthMethodError) Error

Error implements the error interface for UnsupportedAuthMethodError.

Jump to

Keyboard shortcuts

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