lp2p

package
v0.0.0-...-6be4821 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0, MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRPCTimeout = time.Duration(5 * time.Minute)

Functions

func ConnectAndProtect

func ConnectAndProtect(ctx context.Context, nodeHost Host, ai AddrInfo) (closer func(), tookMsecs int64, err error)

func NewPlainNodeTCP

func NewPlainNodeTCP(withTimeout time.Duration) (lp2phost.Host, *infomempeerstore.PeerStore, error)

Types

type AddrInfo

type AddrInfo struct {
	PeerID     *PeerID               `json:"peerid"`
	MultiAddrs []multiaddr.Multiaddr `json:"multiaddrs"`
}

AddrInfo is a better annotated version of lp2ppeer.AddrInfo

func AddrInfoFromLp2p

func AddrInfoFromLp2p(ai lp2ppeer.AddrInfo) AddrInfo

func AssembleAddrInfo

func AssembleAddrInfo[M interface{ ~string | ~[]byte }](pID *PeerID, addrs []M) (AddrInfo, error)

func (*AddrInfo) ToLp2p

func (ai *AddrInfo) ToLp2p() lp2ppeer.AddrInfo

type Host

type Host = lp2phost.Host

type PeerID

type PeerID = lp2ppeer.ID

type RPCTook

type RPCTook struct {
	LocalPeerID      *PeerID `json:"dialing_peerid"`
	PeerConnectMsecs *int64  `json:"peer_connect_took_msecs,omitempty"`
	StreamOpenMsecs  *int64  `json:"stream_open_took_msecs,omitempty"`
	StreamWriteMsecs *int64  `json:"stream_write_took_msecs,omitempty"`
	StreamReadMsecs  *int64  `json:"stream_read_took_msecs,omitempty"`
}

func ExecCborRPC

func ExecCborRPC(
	ctx context.Context, nodeHost Host,
	peerAddr AddrInfo, proto lp2pproto.ID,
	args interface{}, resp interface{},
) (RPCTook, error)

Jump to

Keyboard shortcuts

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