handshake

package
v1.6.0-query-cache-cou... Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaybeWrapTransport

func MaybeWrapTransport(t transport.Transport, nc NetworkCookie, opts ...Option) transport.Transport

MaybeWrapTransport adds a handshake wrapper around the Transport if network cookie nc is not empty, otherwise it just returns the transport.

Types

type NetworkCookie

type NetworkCookie []byte

NetworkCookie specifies a sequence of bytes that can be used to prevent peers from different networks from communicating with each other.

var NoNetworkCookie NetworkCookie = nil

NoNetworkCookie represents an empty NetworkCookie.

func (NetworkCookie) Empty

func (nc NetworkCookie) Empty() bool

Empty returns true if the network cookie is empty.

func (NetworkCookie) Equal

func (nc NetworkCookie) Equal(other NetworkCookie) bool

Equal returns true if this cookie is the same as the other cookie.

func (NetworkCookie) String

func (nc NetworkCookie) String() string

String returns string representation of the NetworkCookie, which is a hex string.

type Option

type Option func(w *transportWrapper)

Option specifies a handshake option.

func WithAttempts

func WithAttempts(n int) Option

WithAttempts specifies handshake retry count.

func WithLog

func WithLog(logger log.Log) Option

WithLog specifies a logger for handshake.

func WithRetryInterval

func WithRetryInterval(i time.Duration) Option

WithLog specifies handshake retry interval.

func WithTimeout

func WithTimeout(t time.Duration) Option

WithLog specifies handshake timeout.

Jump to

Keyboard shortcuts

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