Spork

Peer-to-peer socket magic

npm install -g @atek-cloud/spork

Github Repository Discord Server

Peer-to-peer

Encrypted

Spork magic

Spork is a command-line tool for peer-to-peer sockets from the creator of the Beaker Browser and part of the new Atek Cloud project. Self host your life!

How does it work?

Spork is all about creating forward and reverse proxies between traditional sockets and p2p sockets.

Sockets are identified by a public key and connect using a Distributed Hash Table (DHT). Connections are end-to-end encrypted using the NOISE framework.

Demo

Expose a server to the P2P network

Let's say we have a web app running at localhost:8080:

$ npx serve -p 8080

We can put this on the p2p network by calling spork bind:

$ spork bind -p 8080
====================== Spork powers ACTIVATED - Mode: Reverse proxy - Listening on whattzzuu5drxwdwi6xbijjf7yt56l5adzht7j7kjvfped7amova - Proxying all traffic to localhost:8080 ======================

As long as that spork command is running, our web app will be available at whattzzuu5drxwdwi6xbijjf7yt56l5adzht7j7kjvfped7amova.

Access a server on the P2P network

Let's say somebody has sporked their web app onto the p2p net at the pubkey whattzzuu5drxwdwi6xbijjf7yt56l5adzht7j7kjvfped7amova.

We can create a local proxy to that app using spork bind:

$ spork bind whattzzuu5drxwdwi6xbijjf7yt56l5adzht7j7kjvfped7amova -p 5555
====================== Spork powers ACTIVATED - Mode: Forward proxy - Listening on localhost:5555 - Proxying all traffic to whattzzuu5drxwdwi6xbijjf7yt56l5adzht7j7kjvfped7amova ======================

Now we can access that server localhost:5555. Note: The connection is end-to-end encrypted!

If end-to-end encryption isn't important for your use-case, you can also use the public gateway at atek.app.

Handy additional tools

spork serve

Serve a folder as a static website quickly with spork serve.

$ spork serve .
====================== Spork powers ACTIVATED - Mode: Serve folder via HTTP - Serving /Users/bob/my-website ====================== Links: http://localhost:15034/ https://ckj7w33lzx6wbxqk53n3evbgwvoykrc3xesw2kwsfwuwua4doxiq.atek.app/

spork gateway

Run an open HTTP gateway to p2p sockets with the spork gateway command.

$ spork gateway -p 6666
====================== Spork powers ACTIVATED - Mode: Gateway - Listening on localhost:6666 - Proxing by subdomain to p2p sockets ======================

Now we can access any socket at http://{pubkey}.localhost:6666.

spork beam

Create an encrypted network pipe between two devices with the spork beam command.

On device 1:

$ echo "Hello, world!" | spork beam
▶ Run the following command to connect: ▶ spork beam 5hbdbh7octaexk4o3amftc4r4xcsdr2fkiloinj7sbihm6svb2ea

On device 2:

$ spork beam 5hbdbh7octaexk4o3amftc4r4xcsdr2fkiloinj7sbihm6svb2ea
Hello, world!

Github Repository Discord Server

Spork is a part of the Atek Cloud mission to self-host our lives. We're channeling the deep magics of the Hypercore Protocol. Atek and Spork were built by the same people behind Beaker Browser.