conninfo

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 4 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 added in v1.11.0

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

Ctx returns a derived context with the given ConnInfo.

Types

type ConnInfo

type ConnInfo struct {
	Peer netip.AddrPort // invalid for Unix domain sockets
	// contains filtered or unexported fields
}

ConnInfo represents client connection information.

func Get added in v0.8.0

func Get(ctx context.Context) *ConnInfo

Get returns the ConnInfo value stored in ctx.

func New added in v1.11.0

func New() *ConnInfo

New returns a new ConnInfo.

func (*ConnInfo) Auth added in v0.8.0

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

Auth returns stored username, password and mechanism.

func (*ConnInfo) BypassBackendAuth added in v1.19.0

func (connInfo *ConnInfo) BypassBackendAuth() bool

BypassBackendAuth returns whether the connection requires backend authentication.

func (*ConnInfo) Conv added in v1.20.0

func (connInfo *ConnInfo) Conv() *scram.ServerConversation

Conv returns stored SCRAM server conversation.

func (*ConnInfo) LocalPeer added in v1.21.0

func (connInfo *ConnInfo) LocalPeer() bool

LocalPeer returns whether the peer is considered local (using Unix domain socket or loopback IP).

func (*ConnInfo) MetadataRecv added in v1.12.0

func (connInfo *ConnInfo) MetadataRecv() bool

MetadataRecv returns whatever client metadata was received already.

func (*ConnInfo) SetAuth added in v0.8.0

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

SetAuth stores username, password.

func (*ConnInfo) SetBypassBackendAuth added in v1.20.0

func (connInfo *ConnInfo) SetBypassBackendAuth()

SetBypassBackendAuth marks the connection as not requiring backend authentication.

func (*ConnInfo) SetConv added in v1.20.0

func (connInfo *ConnInfo) SetConv(sc *scram.ServerConversation)

SetConv stores the SCRAM server conversation.

func (*ConnInfo) SetMetadataRecv added in v1.12.0

func (connInfo *ConnInfo) SetMetadataRecv()

SetMetadataRecv marks client metadata as received.

func (*ConnInfo) Username added in v1.18.0

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