This commit is contained in:
yumoqing 2022-08-11 01:57:12 -04:00
parent 4a62c6e431
commit cf6bfc6369
3 changed files with 29 additions and 18 deletions

View File

@ -11,6 +11,18 @@ except ImportError:
class ForwardServer(SocketServer.ThreadingTCPServer):
daemon_threads = 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
def verbose(s):
@ -82,6 +94,11 @@ class SSHPortForward:
self.ssh_user = ssh_user
self.ssh_password = ssh_password
self.running = False
self._ready = False
def service_ready(self):
print('servie ready .....')
self._ready = True
def run(self):
if self.running:
@ -97,13 +114,16 @@ class SSHPortForward:
self.ssh_password)
self.transport = self.ssh.get_transport()
class MyForwardServer(ForwardServer):
ready_callback = self.service_ready
class SubHandler(Handler):
chain_host = socket.gethostbyname(self.remote_host)
chain_port = self.remote_port
local_port = self.local_port
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()
print('forward ....')

View File

@ -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'

View File

@ -6,12 +6,14 @@ try:
except ImportError:
from distutils.core import setup
# usage:
# python setup.py bdist_wininst generate a window executable file
# python setup.py bdist_egg generate a egg file
# Release information about eway
with open('appPublic/version.py', 'r') as f:
x = f.read()
y = x[x.index("'")+1:]
z = y[:y.index("'")]
version = z
with open("README.md", "r") as fh:
long_description = fh.read()
version = __version__
name = "appPublic"
description = "appPublic"
author = "yumoqing"
@ -37,7 +39,7 @@ setup(
keywords = [
],
url="https://github.com/yumoqing/appPublic",
long_description=description,
long_description=long_description,
long_description_content_type="text/markdown",
classifiers = [
'Operating System :: OS Independent',