Libraryize test.cc
This commit is contained in:
18
tools/dump_tun.cc
Normal file
18
tools/dump_tun.cc
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "lib/tun_tap_device.h"
|
||||
|
||||
#include "glog/logging.h"
|
||||
|
||||
using funstraw::TunTapDevice;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
|
||||
TunTapDevice dev("", TunTapDevice::kIfFormatTun | TunTapDevice::kIfNoPacketInfo, TunTapDevice::kFdReadOnly);
|
||||
|
||||
LOG(INFO) << "Device: " << dev.Name();
|
||||
while (true) {
|
||||
char buf[2048];
|
||||
auto bytes = dev.Read(buf);
|
||||
LOG(INFO) << bytes << " byte packet";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user