add proxy

This commit is contained in:
aozhiwei 2018-12-14 17:01:58 +08:00
parent b9efbfcfb9
commit 087d40be0b
4 changed files with 46 additions and 0 deletions

2
.gitignore vendored
View File

@ -6,4 +6,6 @@
\.\#*
~*.*
\#*.*
__pycache__
*.pyc
gitlab/repository

10
scripts/proxy/cliside.py Normal file
View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
class ClientSide:
def __init__(self, local_ip, remote_ip):
self._local_ip = local_ip
self._remote_ip = remote_ip
def run(self):
pass

24
scripts/proxy/proxy.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from optparse import OptionParser
import srvside
import cliside
parser = OptionParser(usage="%prog [options]")
parser.add_option("-l",
"--listen",
dest = "port",
help = "listen local remote port")
parser.add_option("-f",
"--forward",
dest = "forward",
help = "forward local remote ip")
(options, args) = parser.parse_args()
if options.forward:
srvside.ServerSide(options.forward, args[0]).run()
else:
cliside.ClientSide(options.port, args[0]).run()

10
scripts/proxy/srvside.py Normal file
View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
class ServerSide:
def __init__(self, local_port, remote_port):
self._local_port = local_port
self._remote_port = remote_port
def run(self):
pass