go-libp2p's VPN
Package go-libp2p-vpn
is a VPN over libp2p.
go get github.com/balena/go-libp2p-vpn
package main
import (
"github.com/libp2p/go-libp2p"
"github.com/balena/go-libp2p-vpn"
)
func main() {
// Create the libp2p host
host, err := libp2p.New()
// Then create the VPN interface
vpn, _ := libp2pvpn.New(peer)
// Now set the stream handler (p2p->if)
host.SetStreamHandler(vpn.Protocol(), vpn.Handler())
// And serve packets (if->p2p)
vpn.Serve(ctx, host)
}
Above example is overly simplified, double check the options passed to libp2p.New()
and to libp2pvpn.New()
.
Feel free to join in. All welcome. Open an issue!
This repository falls under the libp2p Code of Conduct.
MIT © 2023 Guilherme Versiani