Giter Club home page Giter Club logo

wg_to_hostname_if's Introduction

wg_to_hostname_if

wg_to_hostname_if translates WireGuard configuration files to OpenBSD's hostname.if(5) format. Specifically, it deals with client configuration files. It also performs some validation to ensure that each option in each section is set to a reasonable value.

Example usage

There is a file named test.ini in the tests directory. Here are its contents.

$ cat tests/test.ini
[Interface]
PrivateKey = yPlLc8Frd05JcfMBzs/p+53b5tfX29WhQbwuyJkdnEs=
Address = 192.168.1.23/32,fd12:3456:789a:1::1/128

[Peer]
PublicKey = YV1sIDB+wgwYqlgxAGnvo2h80v+r7Y5BgHKLoYwt2Xg=
AllowedIPs = 0.0.0.0/0,::0/0
Endpoint = 73.60.105.217:11507

These are the contents of that file translated to hostname.if format.

$ ./wg_to_hostname_if.py tests/test.ini
wgkey yPlLc8Frd05JcfMBzs/p+53b5tfX29WhQbwuyJkdnEs=
wgpeer YV1sIDB+wgwYqlgxAGnvo2h80v+r7Y5BgHKLoYwt2Xg= \
	wgendpoint 73.60.105.217 11507 \
	wgaip 0.0.0.0/0 \
	wgaip ::/0
inet 192.168.1.23/32
inet6 fd12:3456:789a:1::1/128

Running tests

To run tests, execute this in the root of the project directory:

$ python3 -m pytest

Documentation

You can use mandoc to read the manual page provided in the docs directory.

$ mandoc -l docs/wg_to_hostname_if.1

There is also a generated Markdown file in the same directory so you can read the man page on GitHub.

wg_to_hostname_if's People

Contributors

maybebyte avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.