TUN/TAP adapter for D-based applications http://deavmi.assigned.network/projects/libtun
Go to file
Tristan B. Velloza Kildaire 8fab9b2217 Added some API notes 2021-10-25 15:09:28 +02:00
source/libtun Set adapter type 2021-10-24 19:41:21 +02:00
.gitignore Updated .gitignore 2021-07-21 22:11:01 +02:00
README.md Added some API notes 2021-10-25 15:09:28 +02:00
dub.json Changed license name to fit dub registry semantics 2021-10-24 19:11:28 +02:00
dub.selections.json Lost my commits 2021-07-18 18:46:08 +02:00
notes.md Added updated notes 2021-07-21 19:06:57 +02:00

README.md

libtun

TUN/TAP adapter for D-based applications

Usage

First add it to your dub-based project via:

dub add libtun

TUNAdapter

The TUNAdapter class provides you with all you need to get started. One can construct a new adapter as follows:

import libtun.adapter;

void main()
{
    try
    {
        TUNAdapter tun = new TUNAdapter("interface0", AdapterType.TUN);
    }
    catch(TUNException)
    {

    }
}

Reading and writing is easy:

byte[] data;

try
{
    tun.receive(data);
    tun.write([65,66,66,65]);
}
catch(TUNException)
{

}

There are two types of adapters:

  1. AdapterType.TUN
    • This is for creating a TUN device
  2. AdapterType.TAP
    • This is for creating a TAP device

License

LGPLv3