connection

package
v0.0.0-...-daa1150 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddrBook

type AddrBook interface {
	GetPeers() []Peer
	GetPeerByID(id string) (Peer, bool)
	AddPeer(Peer Peer) error
	RemovePeerByID(id string)
}

func NewAddrBook

func NewAddrBook() AddrBook

type DefaultAddrBook

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

func (*DefaultAddrBook) AddPeer

func (ab *DefaultAddrBook) AddPeer(peer Peer) error

func (*DefaultAddrBook) GetPeerByID

func (ab *DefaultAddrBook) GetPeerByID(id string) (Peer, bool)

func (*DefaultAddrBook) GetPeers

func (ab *DefaultAddrBook) GetPeers() []Peer

func (*DefaultAddrBook) RemovePeerByID

func (ab *DefaultAddrBook) RemovePeerByID(id string)

type DefaultPeer

type DefaultPeer struct {
	ID string
	// contains filtered or unexported fields
}

func (*DefaultPeer) CloseStream

func (p *DefaultPeer) CloseStream() error

func (*DefaultPeer) Send

func (p *DefaultPeer) Send(message services.P2PMessage) error

func (*DefaultPeer) Start

func (p *DefaultPeer) Start() error

type Peer

type Peer interface {
	Start() error

	Send(message services.P2PMessage) error
	CloseStream() error
	// contains filtered or unexported methods
}

func NewPeer

func NewPeer(stream network.Stream) Peer

Jump to

Keyboard shortcuts

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