transport

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 10 Imported by: 1

Documentation

Overview

Package transport implements the protocol stack responsible for exchanging data between Secure Scuttlebutt peers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	PerformRequest(ctx context.Context, req *rpc.Request) (rpc.ResponseStream, error)

	// WasInitiatedByRemote returns true if this is a connection that was
	// initiated by the remote peer.
	WasInitiatedByRemote() bool

	Close() error
}

Connection represents an RPC connection to a peer.

type NewPeerHandler

type NewPeerHandler interface {
	HandleNewPeer(ctx context.Context, peer Peer)
}

type Peer

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

Peer exists just for the purpose of keeping track of a connection together with the identity of the remote node.

In theory that identity could be kept at the connection level and returned by the Connection interface however at the protocol level the concept of a remote identity exists only during the handshake. According to the protocol the RPC connection itself doesn't really know about the handshake or the identity. Those are properties of the underlying boxstream transport layer.

func MustNewPeer

func MustNewPeer(remote identity.Public, conn Connection) Peer

func NewPeer

func NewPeer(remote identity.Public, conn Connection) (Peer, error)

func (Peer) Conn

func (p Peer) Conn() Connection

func (Peer) Identity

func (p Peer) Identity() identity.Public

func (Peer) IsZero

func (p Peer) IsZero() bool

func (Peer) String

func (p Peer) String() string

type PeerInitializer

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

func NewPeerInitializer

func NewPeerInitializer(
	handshaker boxstream.Handshaker,
	requestHandler rpc.RequestHandler,
	connectionIdGenerator *rpc.ConnectionIdGenerator,
	newPeerHandler NewPeerHandler,
	logger logging.Logger,
) *PeerInitializer

func (PeerInitializer) InitializeClientPeer

func (i PeerInitializer) InitializeClientPeer(ctx context.Context, rwc io.ReadWriteCloser, remote identity.Public) (Peer, error)

func (PeerInitializer) InitializeServerPeer

func (i PeerInitializer) InitializeServerPeer(ctx context.Context, rwc io.ReadWriteCloser) (Peer, error)

Directories

Path Synopsis
Package boxstream implements the Secret Handshake and the box stream protocol.
Package boxstream implements the Secret Handshake and the box stream protocol.
rpc
mux

Jump to

Keyboard shortcuts

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