Next: , Previous: , Up: Netlayers   [Contents][Index]


7.5.3 libp2p

The libp2p netlayer communicates over the libp2p networking stack, which is designed to provide secure peer-to-peer connections over a variety of networking protocols. Goblins relies upon an external server, the Go libp2p daemon, to access the libp2p network. Refer to the daemon’s documentation for setup instructions.

Constructor: ^libp2p-netlayer [private-key] [our-location]

[#:control-path] [#:path]

Spawning this constructor will produce a new instance of the libp2p netlayer.

The private-key of type string and our-location of type OCapN node can be used to specify an existing private key and location to be used by the netlayer. If these are not specified, they are generated by the netlayer. The netlayer is persistence aware so these do not normally need to be specified manually.

control-path when specified the path to the unix socket where the libp2p daemon is running. If not specified it will default to /tmp/libp2p-control.sock

path is the path to a directory where Goblins can create new sockets. These sockets are used for new connections for Goblins and the libp2p daemon to communicate over. It defaults to /tmp/goblins-libp2p

Procedure: ocapn-node->libp2p-multiaddr node

When provided an OCapN node, it will convert this to a multiaddr string used by libp2p.

Procedure: libp2p-multiaddress->ocapn-node multiaddrs

When given a string of multiaddrs, it will convert it into an OCapN node.

Persistence Environment: libp2p-netlayer-env