mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-02-06 21:50:25 +01:00
Merge remote-tracking branch 'upstream/master' into ref/replace-deprecated-imp
This commit is contained in:
commit
04f2135a1c
@ -1,6 +1,6 @@
|
|||||||
-r requirements.txt
|
-r requirements.txt
|
||||||
attrs==19.3.0
|
attrs==19.3.0
|
||||||
pytest==5.4.2
|
pytest==5.4.3
|
||||||
pytest-cov==2.9.0
|
pytest-cov==2.9.0
|
||||||
mock==2.0.0
|
mock==2.0.0
|
||||||
flake8==3.8.2
|
flake8==3.8.2
|
||||||
|
@ -228,11 +228,6 @@ class FirewallClient:
|
|||||||
pass
|
pass
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
s1.close()
|
s1.close()
|
||||||
if sys.version_info < (3, 0):
|
|
||||||
# python 2.7
|
|
||||||
self.pfile = s2.makefile('wb+')
|
|
||||||
else:
|
|
||||||
# python 3.5
|
|
||||||
self.pfile = s2.makefile('rwb')
|
self.pfile = s2.makefile('rwb')
|
||||||
if e:
|
if e:
|
||||||
log('Spawning firewall manager: %r\n' % self.argv)
|
log('Spawning firewall manager: %r\n' % self.argv)
|
||||||
|
@ -5,16 +5,9 @@ import errno
|
|||||||
logprefix = ''
|
logprefix = ''
|
||||||
verbose = 0
|
verbose = 0
|
||||||
|
|
||||||
if sys.version_info[0] == 3:
|
|
||||||
binary_type = bytes
|
|
||||||
|
|
||||||
def b(s):
|
def b(s):
|
||||||
return s.encode("ASCII")
|
return s.encode("ASCII")
|
||||||
else:
|
|
||||||
binary_type = str
|
|
||||||
|
|
||||||
def b(s):
|
|
||||||
return s
|
|
||||||
|
|
||||||
|
|
||||||
def log(s):
|
def log(s):
|
||||||
|
@ -6,6 +6,7 @@ import time
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
from shutil import which
|
||||||
|
|
||||||
import sshuttle.ssnet as ssnet
|
import sshuttle.ssnet as ssnet
|
||||||
import sshuttle.helpers as helpers
|
import sshuttle.helpers as helpers
|
||||||
@ -15,11 +16,6 @@ from sshuttle.ssnet import Handler, Proxy, Mux, MuxWrapper
|
|||||||
from sshuttle.helpers import b, log, debug1, debug2, debug3, Fatal, \
|
from sshuttle.helpers import b, log, debug1, debug2, debug3, Fatal, \
|
||||||
resolvconf_random_nameserver
|
resolvconf_random_nameserver
|
||||||
|
|
||||||
try:
|
|
||||||
from shutil import which
|
|
||||||
except ImportError:
|
|
||||||
from distutils.spawn import find_executable as which
|
|
||||||
|
|
||||||
|
|
||||||
def _ipmatch(ipstr):
|
def _ipmatch(ipstr):
|
||||||
# FIXME: IPv4 only
|
# FIXME: IPv4 only
|
||||||
|
@ -6,24 +6,13 @@ import zlib
|
|||||||
import imp
|
import imp
|
||||||
import subprocess as ssubprocess
|
import subprocess as ssubprocess
|
||||||
import shlex
|
import shlex
|
||||||
|
from shlex import quote
|
||||||
import ipaddress
|
import ipaddress
|
||||||
|
from urllib.parse import urlparse
|
||||||
# ensure backwards compatiblity with python2.7
|
|
||||||
try:
|
|
||||||
from urllib.parse import urlparse
|
|
||||||
except ImportError:
|
|
||||||
from urlparse import urlparse
|
|
||||||
|
|
||||||
import sshuttle.helpers as helpers
|
import sshuttle.helpers as helpers
|
||||||
from sshuttle.helpers import debug2
|
from sshuttle.helpers import debug2
|
||||||
|
|
||||||
try:
|
|
||||||
# Python >= 3.5
|
|
||||||
from shlex import quote
|
|
||||||
except ImportError:
|
|
||||||
# Python 2.x
|
|
||||||
from pipes import quote
|
|
||||||
|
|
||||||
|
|
||||||
def readfile(name):
|
def readfile(name):
|
||||||
tokens = name.split(".")
|
tokens = name.split(".")
|
||||||
|
@ -5,7 +5,7 @@ import errno
|
|||||||
import select
|
import select
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from sshuttle.helpers import b, binary_type, log, debug1, debug2, debug3, Fatal
|
from sshuttle.helpers import b, log, debug1, debug2, debug3, Fatal
|
||||||
|
|
||||||
MAX_CHANNEL = 65535
|
MAX_CHANNEL = 65535
|
||||||
LATENCY_BUFFER_SIZE = 32768
|
LATENCY_BUFFER_SIZE = 32768
|
||||||
@ -382,7 +382,7 @@ class Mux(Handler):
|
|||||||
# log('outbuf: %d %r\n' % (self.amount_queued(), ob))
|
# log('outbuf: %d %r\n' % (self.amount_queued(), ob))
|
||||||
|
|
||||||
def send(self, channel, cmd, data):
|
def send(self, channel, cmd, data):
|
||||||
assert isinstance(data, binary_type)
|
assert isinstance(data, bytes)
|
||||||
assert len(data) <= 65535
|
assert len(data) <= 65535
|
||||||
p = struct.pack('!ccHHH', b('S'), b('S'), channel, cmd, len(data)) \
|
p = struct.pack('!ccHHH', b('S'), b('S'), channel, cmd, len(data)) \
|
||||||
+ data
|
+ data
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import sys
|
|
||||||
import io
|
import io
|
||||||
import socket
|
import socket
|
||||||
from socket import AF_INET, AF_INET6
|
from socket import AF_INET, AF_INET6
|
||||||
@ -193,9 +192,5 @@ def test_family_ip_tuple():
|
|||||||
def test_family_to_string():
|
def test_family_to_string():
|
||||||
assert sshuttle.helpers.family_to_string(AF_INET) == "AF_INET"
|
assert sshuttle.helpers.family_to_string(AF_INET) == "AF_INET"
|
||||||
assert sshuttle.helpers.family_to_string(AF_INET6) == "AF_INET6"
|
assert sshuttle.helpers.family_to_string(AF_INET6) == "AF_INET6"
|
||||||
if sys.version_info < (3, 0):
|
|
||||||
expected = "1"
|
|
||||||
assert sshuttle.helpers.family_to_string(socket.AF_UNIX) == "1"
|
|
||||||
else:
|
|
||||||
expected = 'AddressFamily.AF_UNIX'
|
expected = 'AddressFamily.AF_UNIX'
|
||||||
assert sshuttle.helpers.family_to_string(socket.AF_UNIX) == expected
|
assert sshuttle.helpers.family_to_string(socket.AF_UNIX) == expected
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
import sys
|
|
||||||
|
|
||||||
if sys.version_info >= (3, 0):
|
|
||||||
good_python = sys.version_info >= (3, 5)
|
|
||||||
else:
|
|
||||||
good_python = sys.version_info >= (2, 7)
|
|
||||||
|
|
||||||
collect_ignore = []
|
|
||||||
if not good_python:
|
|
||||||
collect_ignore.append("client")
|
|
Loading…
Reference in New Issue
Block a user