本文整理汇总了Python中cert_util.CertUtil.init_ca方法的典型用法代码示例。如果您正苦于以下问题:Python CertUtil.init_ca方法的具体用法?Python CertUtil.init_ca怎么用?Python CertUtil.init_ca使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cert_util.CertUtil
的用法示例。
在下文中一共展示了CertUtil.init_ca方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from cert_util import CertUtil [as 别名]
# 或者: from cert_util.CertUtil import init_ca [as 别名]
def main():
pre_start()
connect_control.keep_running = True
connect_manager.https_manager.load_config()
xlog.debug("## GAEProxy set keep_running: %s", connect_control.keep_running)
CertUtil.init_ca()
proxy_daemon = simple_http_server.HTTPServer((config.LISTEN_IP, config.LISTEN_PORT), proxy_handler.GAEProxyHandler)
proxy_thread = threading.Thread(target=proxy_daemon.serve_forever)
proxy_thread.setDaemon(True)
proxy_thread.start()
if config.PAC_ENABLE:
pac_daemon = simple_http_server.HTTPServer((config.PAC_IP, config.PAC_PORT), PACServerHandler)
pac_thread = threading.Thread(target=pac_daemon.serve_forever)
pac_thread.setDaemon(True)
pac_thread.start()
try:
urllib2.urlopen('http://127.0.0.1:%d/%s' % (config.PAC_PORT, config.PAC_FILE))
except:
pass
while connect_control.keep_running:
time.sleep(1)
proxy_daemon.shutdown()
proxy_daemon.server_close()
proxy_thread.join()
if config.PAC_ENABLE:
pac_daemon.shutdown()
pac_daemon.server_close()
pac_thread.join()
示例2: main
# 需要导入模块: from cert_util import CertUtil [as 别名]
# 或者: from cert_util.CertUtil import init_ca [as 别名]
def main(args):
global ready, proxy_server
check_create_data_path()
log_info()
CertUtil.init_ca()
allow_remote = args.get("allow_remote", 0)
listen_ips = front.config.listen_ip
if isinstance(listen_ips, basestring):
listen_ips = [listen_ips]
else:
listen_ips = list(listen_ips)
if allow_remote and ("0.0.0.0" not in listen_ips or "::" not in listen_ips):
listen_ips.append("0.0.0.0")
addresses = [(listen_ip, front.config.listen_port) for listen_ip in listen_ips]
front.start()
direct_front.start()
proxy_server = simple_http_server.HTTPServer(
addresses, proxy_handler.GAEProxyHandler, logger=xlog)
ready = True # checked by launcher.module_init
proxy_server.serve_forever()
示例3: main
# 需要导入模块: from cert_util import CertUtil [as 别名]
# 或者: from cert_util.CertUtil import init_ca [as 别名]
def main():
global ready
connect_control.keep_running = True
config.load()
connect_manager.https_manager.load_config()
xlog.debug("## GAEProxy set keep_running: %s", connect_control.keep_running)
# to profile gae_proxy, run proxy.py, visit some web by proxy, then visit http://127.0.0.1:8084/quit to quit and print result.
do_profile = config.do_profile
if do_profile:
import cProfile, pstats
pr = cProfile.Profile()
pr.enable()
global __file__
__file__ = os.path.abspath(__file__)
if os.path.islink(__file__):
__file__ = getattr(os, 'readlink', lambda x: x)(__file__)
os.chdir(os.path.dirname(os.path.abspath(__file__)))
#xlog.basicConfig(level=xlog.DEBUG if config.LISTEN_DEBUGINFO else xlog.INFO, format='%(levelname)s - %(asctime)s %(message)s', datefmt='[%b %d %H:%M:%S]')
pre_start()
log_info()
CertUtil.init_ca()
proxy_daemon = simple_http_server.HTTPServer((config.LISTEN_IP, config.LISTEN_PORT), proxy_handler.GAEProxyHandler)
proxy_thread = threading.Thread(target=proxy_daemon.serve_forever)
proxy_thread.setDaemon(True)
proxy_thread.start()
if config.PAC_ENABLE:
pac_daemon = simple_http_server.HTTPServer((config.PAC_IP, config.PAC_PORT), pac_server.PACServerHandler)
pac_thread = threading.Thread(target=pac_daemon.serve_forever)
pac_thread.setDaemon(True)
pac_thread.start()
ready = True # checked by launcher.module_init
while connect_control.keep_running:
time.sleep(1)
xlog.info("Exiting gae_proxy module...")
proxy_daemon.shutdown()
proxy_daemon.server_close()
proxy_thread.join()
if config.PAC_ENABLE:
pac_daemon.shutdown()
pac_daemon.server_close()
pac_thread.join()
ready = False # checked by launcher.module_init
xlog.debug("## GAEProxy set keep_running: %s", connect_control.keep_running)
if do_profile:
pr.disable()
pr.print_stats()