aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Twisted/py2/twisted/tap/portforward.py
diff options
context:
space:
mode:
authorshmel1k <shmel1k@ydb.tech>2023-11-26 18:16:14 +0300
committershmel1k <shmel1k@ydb.tech>2023-11-26 18:43:30 +0300
commitb8cf9e88f4c5c64d9406af533d8948deb050d695 (patch)
tree218eb61fb3c3b96ec08b4d8cdfef383104a87d63 /contrib/python/Twisted/py2/twisted/tap/portforward.py
parent523f645a83a0ec97a0332dbc3863bb354c92a328 (diff)
downloadydb-b8cf9e88f4c5c64d9406af533d8948deb050d695.tar.gz
add kikimr_configure
Diffstat (limited to 'contrib/python/Twisted/py2/twisted/tap/portforward.py')
-rw-r--r--contrib/python/Twisted/py2/twisted/tap/portforward.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/contrib/python/Twisted/py2/twisted/tap/portforward.py b/contrib/python/Twisted/py2/twisted/tap/portforward.py
new file mode 100644
index 0000000000..2ad3f3612f
--- /dev/null
+++ b/contrib/python/Twisted/py2/twisted/tap/portforward.py
@@ -0,0 +1,27 @@
+
+# Copyright (c) Twisted Matrix Laboratories.
+# See LICENSE for details.
+
+"""
+Support module for making a port forwarder with twistd.
+"""
+from twisted.protocols import portforward
+from twisted.python import usage
+from twisted.application import strports
+
+class Options(usage.Options):
+ synopsis = "[options]"
+ longdesc = 'Port Forwarder.'
+ optParameters = [
+ ["port", "p", "6666","Set the port number."],
+ ["host", "h", "localhost","Set the host."],
+ ["dest_port", "d", 6665,"Set the destination port."],
+ ]
+
+ compData = usage.Completions(
+ optActions={"host": usage.CompleteHostnames()}
+ )
+
+def makeService(config):
+ f = portforward.ProxyFactory(config['host'], int(config['dest_port']))
+ return strports.service(config['port'], f)