ausimian

ausimian

Wagyu is a user-mode WireGuard library for Elixir.

It allows you to create an encrypted tunnel to another WireGuard peer and then tunnel TCP/UDP/TLS traffic over it using the :gen_tcp, :gen_udp and :ssl respectively, with only addiitional options required in the socket construction. No kernel capabilities or root privileges are required.

# Construct the wireguard interface
{:ok, interface} =
  Wagyu.start_link(
    name: :wg0,
    private_key: local_private_key,
    listen: %{address: {0, 0, 0, 0}, port: 51820},
    stack: [
      addresses: [{{10, 13, 0, 2}, 32}],
      routes: [{{0, 0, 0, 0}, 0, {10, 13, 0, 1}}],
      mtu: 1280
    ],
    peers: [
      %{
        public_key: remote_public_key,
        endpoint: %{address: {192, 0, 2, 1}, port: 51820},
        allowed_ips: [{{0, 0, 0, 0}, 0}]
      }
    ]
  )

# Grab the user-mode network stack
{:ok, stack} = Wagyu.stack(:wg0)

# Construct the socket
options = [
  {:tcp_module, SmolNet.Inet.Tcp}, # Set the backend module
  {:smolnet_stack, stack}, # Set the stack
  :inet,
  :binary,
  {:active, false}
]
{:ok, socket} = :gen_tcp.connect({10, 13, 0, 1}, 443, options, 5_000)

# Use the socket
:ok = :gen_tcp.send(socket, "hello")
{:ok, reply} = :gen_tcp.recv(socket, 0, 5_000)
:ok = :gen_tcp.close(socket)

Tbh, I mostly wrote this just to see if it could be done. The two libraries that underpin it, smolnet and decibel I had written previously for other work-related projects.

I thought it would mostly be a case of just glueing them together. Turns out, I was wrong about that, but getting to the initial release of wagyu resulted in improvements across all three, so I’m glad I tried.

Showing Posts 1 to 2

the_wildgoose

the_wildgoose

This looks really nice!

Have you considered adding a webrtc library to this to get a VPN which can self assemble and find it’s peers behind firewalls?

My only observation is that the AI writing style makes my eyes bleed. At least please run “debuzz” on all large comments/docs, ie get Gemini to rewrite the words and have your Claude/Chat-gippity check the rewrite. This produces far nicer wording which is actually readable. However, it’s unfair to critique, so please just see that as an observation intended to be helpful!

Good luck with it and thanks for Decibel, this is what I first noticed and intend to use!

ausimian

ausimian OP

Yeah, I did a pass over the public facing docs and cleaned them up somewhat. But internal commentary could do some work. I’ll take a look thx.

I mostly used opus 5.5 for the code, which goes to show they still haven’t got rid of all the prose issues in the model.

— All posts loaded —

Where Next? Top

Trending in Announcing Top

restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 12366 136
New
type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
kip
I’ll shortly be launching Text, a nascent text analysis library. Current functionality In this early version (not ready for prime time) ...
New
kip
Following on from my CLDR lbraries I started work on Unicode transforms. But like everything related to CLDR there is a lot of yak-shavin...
New

Other Trending Topics Top

budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews