Categorygithub.com/plexsysio/go-libp2p-genrpc
modulepackage
0.0.0-20230918082239-64a1e9d7bd5c
Repository: https://github.com/plexsysio/go-libp2p-genrpc.git
Documentation: pkg.go.dev

# README

go-libp2p-genrpc

Go Go Reference Coverage Status

Generics based RPC framework using libp2p

go-libp2p-genrpc is a small library which provides a type-safe API to write go functions as RPCs over libp2p transport.

The goal was to see if we can provide similar functionality as go-libp2p-gorpc but using generics in a type-safe manner. The result is a slightly different API which is more verbose. Additional functionality like writing middlewares is also possible.

Install

This module can be installed with go get:

> go get github.com/plexsysio/go-libp2p-genrpc

Usage

Check docs.

There are also some examples.

# Packages

No description provided by the author
No description provided by the author

# Functions

BidirStream provides a network.StreamHandler wrapped with message handling required for bidirectional streaming APIs.
DownStream provides a network.StreamHandler wrapped with the message handling required for streaming response type APIs.
GetPeerID returns the peer id of the remote peer from the context.
New returns a Mux which uses the default semantic version.
NewBidirStreamReq initializes a new BidirStreamRequest.
NewDownStreamReq initializes a new DownStreamRequest.
NewUnaryReq initializes a new UnaryRequest.
NewUpStreamReq initializes a new UpStreamRequest.
NewWithVersion returns a Mux which uses the provided semantic version.
Register is used to register the Mux on a libp2p host.
SetPeerID sets the peer id of the remote peer in the context.
Unary function provides a network.StreamHandler wrapped with message handling for unary request type APIs.
UpStream function provides a network.StreamHandler wrapped with message handling for streaming request type APIs.

# Structs

Mux provides a multiplexer per service and version.

# Interfaces

BidirStreamRequest is used to call a bidirectional RPC registered on the server.
DownStreamRequest is used to call a down-stream RPC registered on the server.
Header interface provides functionality to add headers to the requests.
Libp2pHost is the interface required from libp2p.Host.
Streamer interface provides functionality to open a new stream.
UnaryRequest is used to call a unary RPC registered on the server.
UpStreamRequest is used to call a up-stream RPC registered on the server.

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author