diff --git a/tunmgr/tunmgr.py b/tunmgr/tunmgr.py index 3d98f1746022238f3e6ae565a8d4cd5db1f0dfa1..d57da21381415aeaad3bf148c7efec78e5e990e0 100755 --- a/tunmgr/tunmgr.py +++ b/tunmgr/tunmgr.py @@ -4,6 +4,7 @@ from pytun import TunTapDevice import selectors import socket import sys +import base64 tun = TunTapDevice() @@ -11,7 +12,7 @@ tun = TunTapDevice() tun.addr = '10.8.0.1' tun.dstaddr = '10.8.0.2' tun.netmask = '255.255.255.0' -tun.mtu = 400 +tun.mtu = 100 tun.up() @@ -30,10 +31,10 @@ while 1: for key, events in sel.select(): if key.data=="tun": print("tun") - s.sendto(tun.read(tun.mtu), (PEER, PORT)) + s.sendto(base64.b64encode(tun.read(tun.mtu)), (PEER, PORT)) elif key.data == "sms": print("sms") - tun.write(s.recv(tun.mtu)) + tun.write(base64.b64decode(s.recv(tun.mtu*4)))