Ejemplo n.º 1
0
	(r"/pac", pacHandler),
	(r"/", helpHandler),
	(r"/admin/get_real_ip_p.php", testPac),
	(r"/admin", adminHandler),
	(r"/status", statusPage),
	(r"/static/(.+)", tornado.web.StaticFileHandler, {"path": "./static"}),
], **settings)

if __name__ == '__main__':
	remoteServerIp = None if len(sys.argv) < 2 else sys.argv[1];
	DDDProxyConfig.remoteServerAuth = None if len(sys.argv) < 3 else sys.argv[2];
	if not remoteServerIp or not DDDProxyConfig.remoteServerAuth:
		exit("please use \"python localServer.py [remoteServerHost] [passWord]\"")
	
	if remoteServerIp:
		if remoteServerIp.find(':') > 0:
			DDDProxyConfig.remoteServerHost,DDDProxyConfig.remoteServerListenPort = remoteServerIp.split(':')
		else:
			DDDProxyConfig.remoteServerHost = remoteServerIp
	try:
		localProxyServer = baseServer(DDDProxyConfig.localServerListenIp, DDDProxyConfig.localServerProxyListenPort, proxyServerHandler)
		localProxyServer.start(True)
	except:
		logging.error(sys.exc_info())
	
	domainConfig.domainAnalysis.startAnalysis()
	
	logging.warn("pac server start on %s:%d!" % (DDDProxyConfig.localServerListenIp, DDDProxyConfig.localServerAdminListenPort));
	application.listen(DDDProxyConfig.localServerAdminListenPort, DDDProxyConfig.localServerListenIp)
	tornado.ioloop.IOLoop.instance().start()
Ejemplo n.º 2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2015年1月11日

@author: dx.wang
'''
from DDDProxy.server import baseServer
import DDDProxyConfig
from DDDProxy.remoteServerHandler import remoteServerHandler
import sys

if __name__ == '__main__':
	DDDProxyConfig.remoteServerAuth = None if len(sys.argv) < 2 else sys.argv[1];
	if not DDDProxyConfig.remoteServerAuth:
		exit("please set remote server password, use \"python remoteServer.py [passWord]\"")
	
	remoteServerIp = None if len(sys.argv) < 3 else sys.argv[2];
	if remoteServerIp:
		if remoteServerIp.find(':') > 0:
			DDDProxyConfig.remoteServerListenIp,DDDProxyConfig.remoteServerListenPort = remoteServerIp.split(':')
		else:
			DDDProxyConfig.remoteServerListenPort = remoteServerIp
	
	server = baseServer(DDDProxyConfig.remoteServerListenIp, DDDProxyConfig.remoteServerListenPort, remoteServerHandler)
	server.start()