1
0
Fork 0
This repository has been archived on 2023-05-11. You can view files and clone it, but cannot push or open issues or pull requests.
lesson-python_ip_tunnel/main.py

23 lines
386 B
Python
Executable File

#!/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()