Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use the open() function instead of the class. More Pythonic...

  • Loading branch information...
commit 808e87b907ce36c935fd63dac2af3b0516859a0a 1 parent fbd4d53
@Gawen authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 tests.py
View
6 tests.py
@@ -44,11 +44,13 @@ def displayable_char(c):
print " " * (15 - (i % 16)) + "\t" + "".join(raws)
def main():
+ # Configure pytun's logger
pytun.logger.setLevel(logging.DEBUG)
logging.basicConfig()
+ # Open the tunnel
try:
- tun = pytun.TunTunnel()
+ tun = pytun.open()
except pytun.Tunnel.NotPermitted:
print
@@ -84,6 +86,7 @@ def main():
print "*" * 80
try:
+ # Receive loop
while True:
buf = tun.recv()
@@ -95,6 +98,7 @@ def main():
print "Keyboard interrupt. Closing."
finally:
+ # Close the tunnel
tun.close()
Please sign in to comment.
Something went wrong with that request. Please try again.