grpc

package
v0.0.0-...-6419794 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Overview

Package grpc contains utilities for interacting with CloudVision's gRPC APIs

Package grpc contains utilities for interacting with CloudVision's gRPC APIs

Index

Constants

View Source
const AuthFlagUsage = "Authentication scheme used to connect to CloudVision. " +
	"Possible values\n:" +
	"\t\"token,{token_file}[,{ca_file}]\": client-side certificate with token-based " +
	"authentication. Uses host's root CA if {ca_file} is not provided.\n"

AuthFlagUsage indicates how to use the authentication config flag.

Variables

View Source
var ErrNoClusterTargets = errors.New("no redirection cluster targets")

ErrNoClusterTargets is returned when no clusters are returned.

Functions

func DialWithAuth

func DialWithAuth(ctx context.Context, target string, auth *Auth, opts ...grpc.DialOption) (
	*grpc.ClientConn, error)

DialWithAuth dials a gRPC endpoint, target, with the provided authentication config and dial options.

func DialWithToken

func DialWithToken(ctx context.Context, target, token string, opts ...grpc.DialOption) (
	*grpc.ClientConn, error)

DialWithToken dials a gRPC endpoint, target, with the provided token and dial options.

func NewAccessTokenCredential

func NewAccessTokenCredential(token string) credentials.PerRPCCredentials

NewAccessTokenCredential constructs a new per-RPC credential from a token.

func TLSConfig

func TLSConfig() *tls.Config

TLSConfig returns a *tls.Config with sane defaults

Types

type Auth

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

Auth holds an authentication scheme used to connect to CloudVision.

func AuthFlag

func AuthFlag() *Auth

AuthFlag adds an authentication config flag with the name "auth".

func NewTokenAuth

func NewTokenAuth(tokenFile, caFile string) (*Auth, error)

NewTokenAuth creates a new token authentication config. If caFile is not provided, the host's root CA will be used.

func (*Auth) CAFile

func (a *Auth) CAFile() string

CAFile returns the CA certificate file specified in Auth.

func (*Auth) ClientCredentials

func (a *Auth) ClientCredentials() ([]grpc.DialOption, error)

ClientCredentials returns dial options corresponding to the client credentials.

func (*Auth) Configure

func (a *Auth) Configure() ([]grpc.DialOption, error)

Configure returns the authentication configuration as a series of gRPC dial options.

func (*Auth) Set

func (a *Auth) Set(v string) error

Set implements flag.Value.

func (*Auth) String

func (a *Auth) String() string

Jump to

Keyboard shortcuts

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