conninfo

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package conninfo provides access to connection-specific information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ctx

func Ctx(ctx context.Context, connInfo *ConnInfo) context.Context

Ctx returns a derived context with the given ConnInfo.

Types

type ConnInfo

type ConnInfo struct {
	PeerAddr string

	// If true, backend implementations should not perform authentication
	// by adding username and password to the connection string.
	// It is set to true for background connections (such us capped collections cleanup)
	// and by the new authentication mechanism.
	// See where it is used for more details.
	BypassBackendAuth bool
	// contains filtered or unexported fields
}

ConnInfo represents client connection information.

func Get

func Get(ctx context.Context) *ConnInfo

Get returns the ConnInfo value stored in ctx.

func New

func New() *ConnInfo

New returns a new ConnInfo.

func (*ConnInfo) Auth

func (connInfo *ConnInfo) Auth() (username, password string)

Auth returns stored username and password.

func (*ConnInfo) MetadataRecv

func (connInfo *ConnInfo) MetadataRecv() bool

MetadataRecv returns whatever client metadata was received already.

func (*ConnInfo) SetAuth

func (connInfo *ConnInfo) SetAuth(username, password string)

SetAuth stores username and password.

func (*ConnInfo) SetMetadataRecv

func (connInfo *ConnInfo) SetMetadataRecv()

SetMetadataRecv marks client metadata as received.

func (*ConnInfo) Username

func (connInfo *ConnInfo) Username() string

Username returns stored username.

Jump to

Keyboard shortcuts

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