mirror of
https://github.com/deavmi/libtun.git
synced 2024-09-11 07:03:10 +02:00
TUN/TAP adapter for D-based applications
http://deavmi.assigned.network/projects/libtun
branding | ||
source/libtun | ||
.gitignore | ||
dub.json | ||
dub.selections.json | ||
notes.md | ||
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:
AdapterType.TUN
- This is for creating a TUN device
AdapterType.TAP
- This is for creating a TAP device
License
LGPLv3