diff options
Diffstat (limited to 'src/interface/mod.rs')
-rw-r--r-- | src/interface/mod.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/interface/mod.rs b/src/interface/mod.rs index c45e70f..acfb9be 100644 --- a/src/interface/mod.rs +++ b/src/interface/mod.rs @@ -66,6 +66,15 @@ impl UtunPacket { } } +impl From<UtunPacket> for Vec<u8> { + fn from(packet: UtunPacket) -> Vec<u8> { + use self::UtunPacket::*; + match packet { + Inet4(payload) | Inet6(payload) => payload, + } + } +} + impl UtunCodec for VecUtunCodec { type In = UtunPacket; type Out = Vec<u8>; |