TUN/TAP adapter for D-based applications http://deavmi.assigned.network/projects/libtun
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Tristan B. Velloza Kildaire d5a92a315c
Re-named `TUNException` -> `AdapterException`
6 months ago
branding Added branding 1 year ago
source/libtun Re-named `TUNException` -> `AdapterException` 6 months ago
.gitignore Updated .gitignore 2 years ago
README.md Renamed `TUNAdapter` -> `Adapter` 6 months ago
dub.json Switched to using ImportC 6 months ago
dub.selections.json Lost my commits 2 years ago
notes.md Added TODO list 6 months ago

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