18 lines
461 B
C++
18 lines
461 B
C++
|
#include <cstdio>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
#include "TunDevice.hpp"
|
||
|
|
||
|
int main(void) {
|
||
|
try {
|
||
|
TunDevice tun_dev("cvpn%d");
|
||
|
printf("Tunnel device opened: <%s>, fd <%d>.\nSleeping 10 seconds.\n",
|
||
|
tun_dev.get_dev_name().c_str(), tun_dev.get_fd());
|
||
|
sleep(10);
|
||
|
printf("Shutting down.\n");
|
||
|
} catch(const TunDevice::InitializationError& exn) {
|
||
|
fprintf(stderr, "ERROR: %s\n", exn.what());
|
||
|
}
|
||
|
return 0;
|
||
|
}
|