Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Mo Balaa <buddybalaa@gmail.com>
To: Ryan Whelan <rcwhelan@gmail.com>
Cc: Andrew Roth <andrew@andrewjroth.com>,
	 WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: Python Wrapper for wireguard-tools
Date: Mon, 24 Aug 2020 14:38:52 -0500	[thread overview]
Message-ID: <CAKmhVko5aED=b6Gx2yU5QVcEGyWbc3zWt2yAjUtAbaFNLr6nTQ@mail.gmail.com> (raw)
In-Reply-To: <CAKmhVko10JYo__SfNGujkeVV_YCPVLtBkLzcXoMfo7X3qjD5pA@mail.gmail.com>

We also wrap wg command and provide a high level config interface via
Python for our personal networking framework, Noteworthy.

See https://github.com/decentralabs/noteworthy/blob/master/plugins/wireguard/noteworthy/wireguard/wg.py

On Mon, Aug 24, 2020 at 2:35 PM Mo Balaa <buddybalaa@gmail.com> wrote:
>
> We also wrap wg command and provide a high level config interface via Python for our personal networking framework Noteworthy.
>
> https://github.com/decentralabs/noteworthy/blob/master/plugins/wireguard/noteworthy/wireguard/wg.py
>
>
> On Mon, Aug 24, 2020 at 14:00 Ryan Whelan <rcwhelan@gmail.com> wrote:
>>
>> At this point, it's very old and not in use, but I once worked on a
>>
>> project that would wrap the `wg` command in python.
>>
>>
>>
>> If helpful, I posted it here:
>>
>> https://gist.github.com/rwhelan/f46d1f6f07df71f1bd1786eda447b97f
>>
>>
>>
>> I don't think its feature complete as it was only used internally for
>>
>> a project that took another direction. But in case it's helpful...
>>
>>
>>
>>
>>
>> On Sat, Aug 22, 2020 at 3:03 PM Andrew Roth <andrew@andrewjroth.com> wrote:
>>
>> >
>>
>> > Hello,
>>
>> >
>>
>> > Recently joined the list, but reviewed the archives as best I could.
>>
>> > I figured before I get too far in writing this, I should ask here.
>>
>> >
>>
>> > I'm looking for a way to create and configure WireGaurd interfaces
>>
>> > programmatically using Python.  Has anyone created a Python wrapper
>>
>> > for the wireguard-tools?  If not, could I try my hand at it?
>>
>> >
>>
>> > In my research, I was not able to find any true libraries supporting
>>
>> > configuring a WireGuard implementation.  Since wireguard-tools [1] is
>>
>> > cross-platform, and Python is cross-platform, I wanted a
>>
>> > cross-platform library to configure WireGuard interfaces.  This would
>>
>> > help application programmers or tool developers who want to utilize
>>
>> > WireGuard as part of the application or tool written in Python,
>>
>> > potentially cross-platform.
>>
>> >
>>
>> > I did see wgnlpy [2], but don't think it is a fit since it relies on
>>
>> > Netlink (Linux kernel interface), so it's not cross-platform.  I also
>>
>> > found a few other packages on Pypi, but none of them seemed to
>>
>> > interface with the WireGuard module interfaces.
>>
>> >
>>
>> > In the wireguard-tools repository, I noticed the embeddable-wg-library
>>
>> > [3] with C source and header.  Python (using CFFI) supports creating
>>
>> > an extension module that is compiled from C sources to directly invoke
>>
>> > the target C function [4].  It claims to be fast, simple, and
>>
>> > platform-agnostic (by that, I mean it can be compiled for any
>>
>> > platform).  I am planning on writing a python module to expose the C
>>
>> > functions from the embeddable-wg-library using CFFI.
>>
>> >
>>
>> > Does this make sense?  Any comments, gotchas, or limitations?
>>
>> >
>>
>> > Thanks for your time,
>>
>> > Andrew
>>
>> >
>>
>> > [1]:  https://git.zx2c4.com/wireguard-tools/about/
>>
>> > [2]:  https://github.com/ArgosyLabs/wgnlpy
>>
>> > [3]:  https://git.zx2c4.com/wireguard-tools/tree/contrib/embeddable-wg-library
>>
>> > [4]:  https://cffi.readthedocs.io/en/latest/overview.html#api-mode-calling-c-sources-instead-of-a-compiled-library
>>
>> >
>>
>> > --
>>
>> >
>>
>> > ~Andrew Roth
>>
>> > http://www.andrewjroth.com
>>
>> >
>>
>> > "Our greatest glory is not in never falling, but in getting up every
>>
>> > time we do." -Confucius
>>

  parent reply	other threads:[~2020-08-27  8:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 14:04 Andrew Roth
2020-08-22 19:05 ` Jason A. Donenfeld
2020-08-22 21:14   ` Derrick Lyndon Pallas
2020-08-31 20:40   ` Matt Layher
2020-08-24 14:37 ` Arti Zirk
2020-08-24 18:57 ` Ryan Whelan
     [not found]   ` <CAKmhVko10JYo__SfNGujkeVV_YCPVLtBkLzcXoMfo7X3qjD5pA@mail.gmail.com>
2020-08-24 19:38     ` Mo Balaa [this message]
2020-08-27  8:34       ` Jason A. Donenfeld
2020-08-27  8:59         ` Mo Balaa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKmhVko5aED=b6Gx2yU5QVcEGyWbc3zWt2yAjUtAbaFNLr6nTQ@mail.gmail.com' \
    --to=buddybalaa@gmail.com \
    --cc=andrew@andrewjroth.com \
    --cc=rcwhelan@gmail.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).