Currently, communication between manager-node and skywire-node is done via a rpc.Client to rpc.Server relationship. However, in the future, skywire-node will need to initiate communication with manager-node (e.g. for notifications, logging and Skywire App to Manager communication).
Description
The netutil module is to be a shared library to aid communication between Skywire services. Communication can be either via Transport (or higher level interfaces), or noise.Conn.
The first structure to be implemented is netutil.RPCDuplex. This structure implements an RPC Duplex connection via a single net.Conn implementation. In other words, both ends of the connection has a rpc.Server and a rpc.Client.
type RPCDuplex struct {
net.Conn
*rpc.Client
*rpc.Server
}
func NewRPCDuplex(conn net.Conn) *RPCDuplex { /* ... */ }
// Serve serves the rpc.Server via net.Conn.
func (d *RPCDuplex) Serve() { /* ... */ }
// All the other members needed should be made available from the embedded structures.
Background
Currently, communication between
manager-node
andskywire-node
is done via arpc.Client
torpc.Server
relationship. However, in the future,skywire-node
will need to initiate communication withmanager-node
(e.g. for notifications, logging and Skywire App to Manager communication).Description
The
netutil
module is to be a shared library to aid communication between Skywire services. Communication can be either viaTransport
(or higher level interfaces), ornoise.Conn
.The first structure to be implemented is
netutil.RPCDuplex
. This structure implements an RPC Duplex connection via a singlenet.Conn
implementation. In other words, both ends of the connection has arpc.Server
and arpc.Client
.Resources
Tasks
RPCDuplex
(as specified above).net.Pipe()
and having twoRPCDuplex
instances communicate with one another.