from DDDProxy.domainAnalysis import domainAnalysis from DDDProxy.localProxyServerHandler import localConnectHandler from DDDProxy import localToRemoteConnectManger if __name__ == "__main__": parser = OptionParser() parser.add_option("-p", "--port",help="proxy server bind port" , default="-1") parser.add_option("-l", "--loglevel",help="log level" , default=2) parser.add_option("-c", "--RemoteConnectLimit",help="one remote address connect limit" , default=2) parser.add_option("-m", "--remoteConnectMaxTime",help="set remote connect idle more connect max time" , default=1800) parser.add_option("-u", "--update",help="auto update on start" , default=True) startUpArgs = parser.parse_args()[0] log.debuglevel = int(startUpArgs.loglevel) localToRemoteConnectManger.maxConnectByOnServer = max(1,int(startUpArgs.RemoteConnectLimit)) localToRemoteConnectManger.remoteConnectMaxTime = int(startUpArgs.remoteConnectMaxTime) server = baseServer.baseServer() domainAnalysis.startAnalysis(server) localToRemoteConnectManger.localToRemoteConnectManger.install(server) server.addListen(handler=localConnectHandler,port=int("8080" if startUpArgs.port == "-1" else startUpArgs.port)) server.start()
if __name__ == "__main__": parser = OptionParser() parser.add_option("-p", "--port",help="proxy server bind port" , default=8080) parser.add_option("-l", "--loglevel",help="log level" , default=2) parser.add_option("-c", "--RemoteConnectLimit",help="one remote address connect limit" , default=2) parser.add_option("-m", "--remoteConnectMaxTime",help="set remote connect idle more connect max time" , default=0) parser.add_option("-u", "--update",help="auto update on start" , default=True) startUpArgs = parser.parse_args()[0] baseServer.debuglevel = int(startUpArgs.loglevel) localToRemoteConnectManger.maxConnectByOnServer = max(1,int(startUpArgs.RemoteConnectLimit)) localToRemoteConnectManger.remoteConnectMaxTime = int(startUpArgs.remoteConnectMaxTime) server = baseServer.baseServer(handler=localConnectHandler) domainAnalysis.startAnalysis(server) localToRemoteConnectManger.localToRemoteConnectManger.install(server) if startUpArgs.update: server.addDelay(10, version.update,server) server.addListen(port=int(startUpArgs.port)) server.start()
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on 2015年1月11日 @author: dx.wang ''' from DDDProxy.baseServer import baseServer from DDDProxy import remoteServerHandler, log import socket from optparse import OptionParser if __name__ == "__main__": parser = OptionParser(usage="%prog -a [password]") parser.add_option("-a", "--auth",help="server password *") parser.add_option("-p", "--port",help="bind port" , default=8082) parser.add_option("-l", "--loglevel",help="log level" , default=2) startUpArgs = parser.parse_args()[0] remoteServerHandler.remoteAuth = startUpArgs.auth if not remoteServerHandler.remoteAuth: print parser.get_usage() exit() log.debuglevel = int(startUpArgs.loglevel) server = baseServer(handler=remoteServerHandler.remoteServerHandler) server.addListen(port=int(startUpArgs.port)) server.start()
from DDDProxy.localProxyServerHandler import localProxyServerConnectHandler from optparse import OptionParser from DDDProxy import baseServer, remoteConnectManger from DDDProxy.domainAnalysis import domainAnalysis if __name__ == "__main__": parser = OptionParser() parser.add_option("-p", "--port",help="proxy server bind port" , default=8080) parser.add_option("-l", "--loglevel",help="log level" , default=2) parser.add_option("-c", "--RemoteConnectLimit",help="one remote address connect limit" , default=2) startUpArgs = parser.parse_args()[0] baseServer.debuglevel = int(startUpArgs.loglevel) remoteConnectManger.maxConnectByOnServer = max(1,int(startUpArgs.RemoteConnectLimit)) server = baseServer.baseServer(handler=localProxyServerConnectHandler) domainAnalysis.startAnalysis(server) remoteConnectManger.remoteConnectManger.install(server) server.addListen(port=int(startUpArgs.port)) server.start()