Encrypted networking between any two devices on earth.
Bifrost is an open-source peer-to-peer network router. Transport-agnostic, NAT-traversing, and cryptographically authenticated.
Transport-agnostic
UDP, TCP, WebSocket, WebRTC, Bluetooth. Bifrost abstracts the transport layer so your application code works over any medium.
NAT traversal
Automatic hole punching, relay fallback, and signaling. Devices behind home routers, corporate firewalls, and cellular NAT connect without configuration.
Multiplexed streams
Thousands of concurrent streams over a single connection. Yamux multiplexing with flow control and backpressure.
Ed25519 identity
Every peer has a cryptographic identity. Connections are authenticated and encrypted. No CA infrastructure required.
Pub-sub messaging
Publish messages to topics and subscribe to them across the network. Built-in support for group communication patterns.
End-to-end encrypted
All traffic is encrypted between peers. Even relay nodes cannot read the data passing through them.
Get started in Go
import (
"github.com/s4wave/spacewave/net/peer"
"github.com/s4wave/spacewave/net/transport/udp"
)
// Generate a peer identity.
privKey, _, err := peer.GenerateEd25519Key()
if err != nil {
return err
}
// Create a UDP transport.
tpt, err := udp.NewTransport(ctx, &udp.Config{
ListenAddr: ":9001",
}, privKey)
if err != nil {
return err
}
// Open an encrypted stream to a remote peer.
stream, err := tpt.OpenStream(ctx, remotePeerID)
if err != nil {
return err
}
defer stream.Close()
// stream implements io.ReadWriteCloser.
stream.Write([]byte("hello, bifrost"))Used in Spacewave
Bifrost powers every peer-to-peer connection in Spacewave. When your devices sync files, send messages, or share a terminal session, Bifrost handles the encrypted transport.
Spacewave's device linking, NAT traversal, and relay fallback are all built on Bifrost primitives. The same library is available for your own networked applications.