handshake

package
v0.3.6-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventHandshakeComplete

type EventHandshakeComplete struct {
	PID       peer.ID
	Direction network.Direction
}

EventHandshakeComplete is emitted after handshake is completed.

type Handshake

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

Handshake is a protocol for application specific handshake.

func New

func New(h host.Host, genesisID types.Hash20, opts ...Opt) *Handshake

New instantiates handshake protocol for the host.

func (*Handshake) Request

func (h *Handshake) Request(ctx context.Context, pid peer.ID) error

Request handshake with a peer.

func (*Handshake) Stop

func (h *Handshake) Stop()

Stop closes any background workers.

type HandshakeAck

type HandshakeAck struct {
	Error string `scale:"max=256"` // TODO(mafa): make error code instead of string
}

HandshakeAck is a handshake ack.

func (*HandshakeAck) DecodeScale

func (t *HandshakeAck) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*HandshakeAck) EncodeScale

func (t *HandshakeAck) EncodeScale(enc *scale.Encoder) (total int, err error)

type HandshakeMessage

type HandshakeMessage struct {
	GenesisID types.Hash20
}

HandshakeMessage is a handshake message.

func (*HandshakeMessage) DecodeScale

func (t *HandshakeMessage) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*HandshakeMessage) EncodeScale

func (t *HandshakeMessage) EncodeScale(enc *scale.Encoder) (total int, err error)

type Opt

type Opt func(*Handshake)

Opt is for configuring Handshake.

func WithLog

func WithLog(logger log.Log) Opt

WithLog configures logger for handshake protocol.

Jump to

Keyboard shortcuts

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