TUN/TAP adapter for D-based applications http://deavmi.assigned.network/projects/libtun
Go to file
Tristan B. Velloza Kildaire 76991d7082 Renamed `TUNAdapter` -> `Adapter` 2022-11-28 18:39:50 +02:00
branding Added branding 2022-01-12 18:17:45 +02:00
source/libtun Renamed `TUNAdapter` -> `Adapter` 2022-11-28 18:39:50 +02:00
.gitignore Updated .gitignore 2021-07-21 22:11:01 +02:00
README.md Renamed `TUNAdapter` -> `Adapter` 2022-11-28 18:39:50 +02:00
dub.json Switched to using ImportC 2022-11-28 18:27:38 +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

Adapter

The Adapter 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