listenmux

package
v14.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handshaker

type Handshaker interface {
	// Handshake is called with a valid Conn and AuthInfo when grpc-go
	// accepts a connection that presents the Magic() magic bytes. From the
	// point of view of grpc-go, it is part of the
	// credentials.TransportCredentials.ServerHandshake callback. The return
	// values of Handshake become the return values of
	// credentials.TransportCredentials.ServerHandshake.
	Handshake(net.Conn, credentials.AuthInfo) (net.Conn, credentials.AuthInfo, error)

	// Magic returns the magic bytes that clients must send on the wire to
	// reach this handshaker. The string must be no more than 11 bytes long.
	// If it is longer, this handshaker will never be called.
	Magic() string
}

Handshaker represents a multiplexed connection type.

type Mux

type Mux struct {
	credentials.TransportCredentials
	// contains filtered or unexported fields
}

Mux is a listener multiplexer that plugs into grpc-go as a "TransportCredentials" callback.

func New

New returns a *Mux that wraps existing transport credentials. This does nothing interesting unless you also call Register to add handshakers to the Mux.

func (*Mux) Register

func (m *Mux) Register(h Handshaker)

Register registers a handshaker. It is not thread-safe.

func (*Mux) ServerHandshake

func (m *Mux) ServerHandshake(conn net.Conn) (net.Conn, credentials.AuthInfo, error)

ServerHandshake peeks the connection to determine whether the client wants to make a multiplexed connection. It is part of the TransportCredentials interface.

Jump to

Keyboard shortcuts

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