summaryrefslogtreecommitdiffstats
path: root/Sshuttle VPN.app/Contents/Resources/sshuttle/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'Sshuttle VPN.app/Contents/Resources/sshuttle/helpers.py')
-rw-r--r--Sshuttle VPN.app/Contents/Resources/sshuttle/helpers.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/Sshuttle VPN.app/Contents/Resources/sshuttle/helpers.py b/Sshuttle VPN.app/Contents/Resources/sshuttle/helpers.py
new file mode 100644
index 0000000..18871a2
--- /dev/null
+++ b/Sshuttle VPN.app/Contents/Resources/sshuttle/helpers.py
@@ -0,0 +1,37 @@
+import sys, os
+
+logprefix = ''
+verbose = 0
+
+def log(s):
+ try:
+ sys.stdout.flush()
+ sys.stderr.write(logprefix + s)
+ sys.stderr.flush()
+ except IOError:
+ # this could happen if stderr gets forcibly disconnected, eg. because
+ # our tty closes. That sucks, but it's no reason to abort the program.
+ pass
+
+def debug1(s):
+ if verbose >= 1:
+ log(s)
+
+def debug2(s):
+ if verbose >= 2:
+ log(s)
+
+def debug3(s):
+ if verbose >= 3:
+ log(s)
+
+
+class Fatal(Exception):
+ pass
+
+
+def list_contains_any(l, sub):
+ for i in sub:
+ if i in l:
+ return True
+ return False