client

package
v0.0.0-...-39c03fc Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MetadataHostName = "Host"

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, c Info) context.Context

NewContext takes an existing context and derives a new context with the client.Info value stored on it.

Types

type AuthData

type AuthData interface {
	// GetAttribute returns the value for the given attribute. Authenticator
	// implementations might define different data types for different
	// attributes. While "string" is used most of the time, a key named
	// "membership" might return a list of strings.
	GetAttribute(string) interface{}

	// GetAttributes returns the names of all attributes in this authentication
	// data.
	GetAttributeNames() []string
}

AuthData represents the authentication data as seen by authenticators tied to the receivers.

type Info

type Info struct {
	// Addr for the client connecting to this collector. Available in a
	// best-effort basis, and generally reliable for receivers making use of
	// confighttp.ToServer and configgrpc.ToServerOption.
	Addr net.Addr

	// Auth information from the incoming request as provided by
	// configauth.ServerAuthenticator implementations tied to the receiver for
	// this connection.
	Auth AuthData

	// Metadata is the request metadata from the client connecting to this connector.
	// Experimental: *NOTE* this structure is subject to change or removal in the future.
	Metadata Metadata
}

Info contains data related to the clients connecting to receivers.

func FromContext

func FromContext(ctx context.Context) Info

FromContext takes a context and returns a ClientInfo from it. When a ClientInfo isn't present, a new empty one is returned.

type Metadata

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

Metadata is an immutable map, meant to contain request metadata.

func NewMetadata

func NewMetadata(md map[string][]string) Metadata

NewMetadata creates a new Metadata object to use in Info. md is used as-is.

func (Metadata) Get

func (m Metadata) Get(key string) []string

Get gets the value of the key from metadata, returning a copy.

Jump to

Keyboard shortcuts

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