bugfix
This commit is contained in:
parent
4a62c6e431
commit
cf6bfc6369
@ -11,6 +11,18 @@ except ImportError:
|
|||||||
class ForwardServer(SocketServer.ThreadingTCPServer):
|
class ForwardServer(SocketServer.ThreadingTCPServer):
|
||||||
daemon_threads = True
|
daemon_threads = True
|
||||||
allow_reuse_address = True
|
allow_reuse_address = True
|
||||||
|
server_ready = False
|
||||||
|
ready_callback = None
|
||||||
|
def service_actions(self):
|
||||||
|
super().service_actions()
|
||||||
|
if not self.server_ready:
|
||||||
|
self.server_ready = True
|
||||||
|
if self.ready_callback:
|
||||||
|
self.ready_callback()
|
||||||
|
|
||||||
|
def shutdown(self):
|
||||||
|
self.server_ready = False
|
||||||
|
super().shutdown()
|
||||||
|
|
||||||
g_verbose = True
|
g_verbose = True
|
||||||
def verbose(s):
|
def verbose(s):
|
||||||
@ -82,6 +94,11 @@ class SSHPortForward:
|
|||||||
self.ssh_user = ssh_user
|
self.ssh_user = ssh_user
|
||||||
self.ssh_password = ssh_password
|
self.ssh_password = ssh_password
|
||||||
self.running = False
|
self.running = False
|
||||||
|
self._ready = False
|
||||||
|
|
||||||
|
def service_ready(self):
|
||||||
|
print('servie ready .....')
|
||||||
|
self._ready = True
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.running:
|
if self.running:
|
||||||
@ -97,13 +114,16 @@ class SSHPortForward:
|
|||||||
self.ssh_password)
|
self.ssh_password)
|
||||||
|
|
||||||
self.transport = self.ssh.get_transport()
|
self.transport = self.ssh.get_transport()
|
||||||
|
class MyForwardServer(ForwardServer):
|
||||||
|
ready_callback = self.service_ready
|
||||||
|
|
||||||
class SubHandler(Handler):
|
class SubHandler(Handler):
|
||||||
chain_host = socket.gethostbyname(self.remote_host)
|
chain_host = socket.gethostbyname(self.remote_host)
|
||||||
chain_port = self.remote_port
|
chain_port = self.remote_port
|
||||||
local_port = self.local_port
|
local_port = self.local_port
|
||||||
ssh_transport = self.transport
|
ssh_transport = self.transport
|
||||||
|
|
||||||
self.forward_server = ForwardServer((socket.gethostbyname('localhost'), self.local_port), SubHandler)
|
self.forward_server = MyForwardServer((socket.gethostbyname('localhost'), self.local_port), SubHandler)
|
||||||
self.forward_server.serve_forever()
|
self.forward_server.serve_forever()
|
||||||
print('forward ....')
|
print('forward ....')
|
||||||
|
|
||||||
|
@ -1,12 +1 @@
|
|||||||
# initial version
|
|
||||||
# __version__ = '5.1.12'
|
|
||||||
# add country name Chinese English convert functions
|
|
||||||
# __version__ = '5.1.13'
|
|
||||||
# replace cryptography with rsa module, because ONLY using rsa modulde in cryptography and cryptography not easy to compile for ios
|
|
||||||
# __version__ = '5.1.14'
|
|
||||||
# keep 5.1.14 version's change
|
|
||||||
# __version__ = '5.1.15'
|
|
||||||
# keep 5.1.14 version's change
|
|
||||||
# __version__ = '5.1.16'
|
|
||||||
# add ssh port forward function
|
|
||||||
__version__ = '5.1.17'
|
__version__ = '5.1.17'
|
||||||
|
14
setup.py
14
setup.py
@ -6,12 +6,14 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
# usage:
|
with open('appPublic/version.py', 'r') as f:
|
||||||
# python setup.py bdist_wininst generate a window executable file
|
x = f.read()
|
||||||
# python setup.py bdist_egg generate a egg file
|
y = x[x.index("'")+1:]
|
||||||
# Release information about eway
|
z = y[:y.index("'")]
|
||||||
|
version = z
|
||||||
|
with open("README.md", "r") as fh:
|
||||||
|
long_description = fh.read()
|
||||||
|
|
||||||
version = __version__
|
|
||||||
name = "appPublic"
|
name = "appPublic"
|
||||||
description = "appPublic"
|
description = "appPublic"
|
||||||
author = "yumoqing"
|
author = "yumoqing"
|
||||||
@ -37,7 +39,7 @@ setup(
|
|||||||
keywords = [
|
keywords = [
|
||||||
],
|
],
|
||||||
url="https://github.com/yumoqing/appPublic",
|
url="https://github.com/yumoqing/appPublic",
|
||||||
long_description=description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
classifiers = [
|
classifiers = [
|
||||||
'Operating System :: OS Independent',
|
'Operating System :: OS Independent',
|
||||||
|
Loading…
Reference in New Issue
Block a user