Peer-to-peer stack, in Go

Hand in hand, peer-to-peer, nobody in the middle.

Go libraries for building peer-to-peer apps. Peers find each other, connect directly and keep a signed log, with no server in between.

v0.1 beta · Go 1.26+ · built on RFC 9162 and RFC 8032

a3f97c21e08d5b4anobodyin the middle
The stack

Small libraries, in three layers.

Each one does one job and has its own docs. Use one, or use them all.

Data

Keys, encoding, a signed log, and the pieces that store, read and copy it.

Network

Finding peers by topic, inviting them into a group, talking to them over an encrypted channel, and sending live tracks of data or media.

Servers you run

The bootstrap node of a network of your own, and a pinning peer that keeps encrypted logs available. On your machines, not ours. By default the examples use the public entry nodes that Ciranda runs.

See all libraries
Why Kolo

Four things we will not trade away.

The usual way
serveroffserver

Every message goes through one machine that someone runs, pays for and can switch off.

With Kolo
nothing hereleft

Peers talk to each other directly. If one leaves, the others keep going.

  • Instead of a backend in the path

    No server in the middle

    Peers find each other and connect directly. No machine of ours carries your data, and with your own bootstrap node none of ours has to stay alive.

  • Instead of trusting whoever stores it

    Every entry is signed

    A log entry carries the signature of whoever wrote it. Anyone can check it, and nobody can change it quietly.

  • Instead of a log that never forgets

    Deleting means something

    A delete marker tells replicas to drop the data. It is best effort, and the docs say so plainly.

  • Instead of a relay that is always on

    A relay only if you ask

    When two peers cannot reach each other, a relay can help. It is off unless you turn it on.

How it works

No server in the path.

  1. Find

    Peers announce a topic and look it up in a distributed table. No directory server.

    kolo-dht · kolo-swarm

  2. Connect

    They open a direct, encrypted channel. A relay steps in only when there is no other way.

    kolo-transport · kolo-secure

  3. Share

    They keep a signed log and copy it to each other. Every entry can be checked.

    kolo-log · kolo-sync · kolo-kv

How it works, in depth
Use cases

What you can build with it.

Six things the libraries do today, each with the pieces it needs and what to watch for.

All use cases
Open source

Read it, run it, change it.

Every library is open source under the MIT or Apache-2.0 license (your choice) and builds on open standards. Nothing ties your app to us.

More about the license
Get started

Join a topic in a few lines.

One function starts a swarm, bootstraps it from the nodes you pass in and joins a topic. Then it prints the start of the public key of every peer that connects.

  • Line 04Start a swarm with your identity.
  • Line 09Bootstrap from nodes you choose.
  • Line 15Announce the topic and look up its peers.
  • Line 19Read each new connection as an event.
  • Go
main.go
func join(
    ctx context.Context, id *koloid.Identity, nodes []netip.AddrPort,
) error {
    sw, err := koloswarm.New(ctx, "127.0.0.1:0", id, nil)
    if err != nil {
        return err
    }
    defer sw.Close()
    if err := sw.Bootstrap(ctx, nodes); err != nil {
        return err
    }

    topic := koloswarm.Topic(sha256.Sum256([]byte("my first topic")))
    opts := &koloswarm.JoinOptions{Announce: true, Lookup: true}
    if err := sw.Join(ctx, topic, opts); err != nil {
        return err
    }
    for {
        ev, err := sw.Next(ctx)
        if err != nil {
            return err
        }
        if ev.Kind == koloswarm.Connected {
            fmt.Printf("connected to %x\n", ev.Peer.PublicKey()[:8])
        }
    }
}
go get github.com/ciranda-dev/kolo-swarmGo 1.26+ · 27 lines
Where we are

Version 0.1, beta and experimental. Honest about it.

The API can still change before 1.0. Every limit is written in the docs, and deleting is best effort, because a peer that already has your data keeps what it has.

The security model is documented. Read it before you rely on it.