relay

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 31 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MinimumRelayNodes       int   = 1
	MinimumRelayConnections int64 = 1
)
View Source
const (
	EdgeAliveProto = "/alive/0.2"
)

Variables

View Source
var (
	ErrNoRelaynodes  = errors.New("no relaynodes specified")
	ErrNoBootnodes   = errors.New("no bootnodes specified")
	ErrMinRelaynodes = errors.New("minimum 1 relaynode is required")
	ErrMinBootnodes  = errors.New("minimum 1 bootnode is required")
)

Functions

This section is empty.

Types

type AliveService

type AliveService struct {
	proto.UnimplementedAliveServer
	// contains filtered or unexported fields
}

BOOTNODE QUERIES // AliveService is a service that finds other peers in the network and connects them to the current running node

func NewAliveService

func NewAliveService(
	server networkingServer,
	logger hclog.Logger,
	syncAppPeerClient application.SyncAppPeerClient,
) *AliveService

NewAliveService creates a new instance of the alive service

func (*AliveService) Hello

type PeerConnInfo

type PeerConnInfo struct {
	Info peer.AddrInfo
	// contains filtered or unexported fields
}

PeerConnInfo holds the connection information about the peer

type Protocol

type Protocol interface {
	Client(network.Stream) *rawGrpc.ClientConn
	Handler() func(network.Stream)
}

type RelayClient

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

func NewRelayClient

func NewRelayClient(logger hclog.Logger, config *emcNetwork.Config, relayOn bool, relayNodes []string) (*RelayClient, error)

NewRelayClient returns a new instance of the relay client

func (*RelayClient) AddToPeerStore

func (s *RelayClient) AddToPeerStore(peerInfo *peer.AddrInfo)

AddToPeerStore adds peer information to the node's peer store

func (*RelayClient) Close

func (m *RelayClient) Close()

Close terminates running processes for SyncAppPeerClient

func (*RelayClient) CloseProtocolStream

func (s *RelayClient) CloseProtocolStream(protocol string, peerID peer.ID) error

func (*RelayClient) ConnectToBootnodes

func (d *RelayClient) ConnectToBootnodes(bootnodes []*peer.AddrInfo)

ConnectToBootnodes attempts to connect to the bootnodes and add them to the peer / routing table

func (*RelayClient) GetBootnodes

func (s *RelayClient) GetBootnodes() []*peer.AddrInfo

func (*RelayClient) GetHost

func (s *RelayClient) GetHost() host.Host

func (*RelayClient) GetNotifyBundle

func (s *RelayClient) GetNotifyBundle() *network.NotifyBundle

func (*RelayClient) GetRandomBootnode

func (s *RelayClient) GetRandomBootnode() *peer.AddrInfo

func (*RelayClient) GetRandomRelaynode

func (s *RelayClient) GetRandomRelaynode() *peer.AddrInfo

GetRandomRelaynode fetches a random relaynode that's currently NOT connected, if any

func (*RelayClient) GetRelayPeerInfo

func (s *RelayClient) GetRelayPeerInfo() *RelayPeerInfo

func (*RelayClient) NewAliveClient

func (s *RelayClient) NewAliveClient(peerID peer.ID) (proto.AliveClient, error)

NewAliveClient returns a new or existing alive service client connection

func (*RelayClient) NewProtoConnection

func (s *RelayClient) NewProtoConnection(protocol string, peerID peer.ID) (*rawGrpc.ClientConn, error)

NewProtoConnection opens up a new stream on the set protocol to the peer, and returns a reference to the connection

func (*RelayClient) NewStream

func (s *RelayClient) NewStream(proto string, id peer.ID) (network.Stream, error)

func (*RelayClient) RegisterProtocol

func (s *RelayClient) RegisterProtocol(id string, p Protocol)

func (*RelayClient) RelayPeers

func (s *RelayClient) RelayPeers() []*RelayPeerInfo

RelayPeers returns a copy of the networking server's relay peer connection info set. Only one (initial) connection (inbound OR outbound) per peer is contained [Thread safe]

func (*RelayClient) RemoveFromPeerStore

func (s *RelayClient) RemoveFromPeerStore(peerInfo *peer.AddrInfo)

func (*RelayClient) SaveProtocolStream

func (s *RelayClient) SaveProtocolStream(
	protocol string,
	stream *rawGrpc.ClientConn,
	peerID peer.ID,
)

func (*RelayClient) StartAlive

func (s *RelayClient) StartAlive(subscription application.Subscription) error

setupAlive Sets up the live service for the node

func (*RelayClient) StartRelayReserv

func (s *RelayClient) StartRelayReserv() error

Start starts the networking relay reserve job

type RelayConnInfo

type RelayConnInfo struct {
	Info peer.AddrInfo
	// contains filtered or unexported fields
}

RelayConnInfo holds the connection information about the peer

type RelayPeerInfo

type RelayPeerInfo struct {
	Info        *RelayConnInfo
	Reservation *client.Reservation
}

RelayPeerInfo holds the relay information about the peer

type RelayServer

type RelayServer struct {
	MaxReservations int
	// contains filtered or unexported fields
}

func NewRelayServer

func NewRelayServer(logger hclog.Logger, secretsManager secrets.SecretsManager, relayListenAddr multiaddr.Multiaddr, proxyAddr *net.TCPAddr, syncAppPeerClient application.SyncAppPeerClient, RelayDiscovery bool, relayNodes []string) (*RelayServer, error)

NewRelayServer returns a new instance of the relay server

func NewRelayServerWithHost

func NewRelayServerWithHost(logger hclog.Logger, host host.Host) (*RelayServer, error)

func (*RelayServer) GetHost

func (s *RelayServer) GetHost() host.Host

func (*RelayServer) GetNotifyBundle

func (s *RelayServer) GetNotifyBundle() *network.NotifyBundle

func (*RelayServer) GetPeerAddrInfo

func (s *RelayServer) GetPeerAddrInfo(peerID peer.ID) peer.AddrInfo

GetPeerAddrInfo fetches the AddrInfo of a peer

func (*RelayServer) GetRandomBootnode

func (s *RelayServer) GetRandomBootnode() *peer.AddrInfo

func (*RelayServer) GetRelayProxyAddr

func (s *RelayServer) GetRelayProxyAddr() *net.TCPAddr

func (*RelayServer) PublishApplicationStatus

func (s *RelayServer) PublishApplicationStatus(status *appProto.AppStatus)

func (*RelayServer) RegisterProtocol

func (s *RelayServer) RegisterProtocol(id string, p Protocol)

func (*RelayServer) SetupAliveService

func (s *RelayServer) SetupAliveService(syncAppPeerClient application.SyncAppPeerClient) error

setupAlive Sets up the live service for the node

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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