From 002fef91f91fd0e99318575f2dba2d7eb6eb01bf Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Sun, 24 Oct 2021 19:41:21 +0200 Subject: [PATCH] Set adapter type --- source/libtun/adapter.d | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/libtun/adapter.d b/source/libtun/adapter.d index 92dd880..85574a0 100644 --- a/source/libtun/adapter.d +++ b/source/libtun/adapter.d @@ -26,12 +26,12 @@ public class TUNAdapter this(string interfaceName, AdapterType adapterType = AdapterType.TAP) { - init(interfaceName); + init(interfaceName, adapterType); } - private void init(string interfaceName) + private void init(string interfaceName, AdapterType adapterType) { - tunFD = createTun(cast(char*)interfaceName, 4096|2); + tunFD = createTun(cast(char*)interfaceName, 4096|adapterType); if(tunFD < 0) { throw new TUNException("Error creating tun device"); @@ -128,8 +128,8 @@ public final class TUNException : Exception } } -public enum AdapterType : ushort +public enum AdapterType : byte { TUN = 1, - TAP = 0 + TAP = 2 } \ No newline at end of file