1
0
Fork 0

Initial code

This commit is contained in:
Alex Kotov 2020-04-17 18:30:31 +05:00
parent 1119b64a7f
commit 7ccd4c43f7
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 22 additions and 0 deletions

22
main.py Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
import pytun
def main():
tun_iface = pytun.TunTapDevice()
print(tun_iface.name)
tun_iface.addr = '10.0.0.1'
tun_iface.dstaddr = '10.0.0.2'
tun_iface.netmask = '255.255.255.0'
tun_iface.mtu = 1500
tun_iface.up()
while True:
buf = tun_iface.read(tun_iface.mtu)
print(buf)
if __name__ == '__main__':
main()