當前位置: 首頁>>代碼示例>>Python>>正文


Python shell.check_python方法代碼示例

本文整理匯總了Python中shadowsocks.shell.check_python方法的典型用法代碼示例。如果您正苦於以下問題:Python shell.check_python方法的具體用法?Python shell.check_python怎麽用?Python shell.check_python使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在shadowsocks.shell的用法示例。


在下文中一共展示了shell.check_python方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from shadowsocks import shell [as 別名]
# 或者: from shadowsocks.shell import check_python [as 別名]
def main():
	shell.check_python()
	if False:
		db_transfer.DbTransfer.thread_db()
	else:
		if get_config().API_INTERFACE == 'mudbjson':
			thread = MainThread(db_transfer.MuJsonTransfer)
		elif get_config().API_INTERFACE == 'sspanelv2':
			thread = MainThread(db_transfer.DbTransfer)
		else:
			thread = MainThread(db_transfer.Dbv3Transfer)
		thread.start()
		try:
			while thread.is_alive():
				thread.join(10.0)
		except (KeyboardInterrupt, IOError, OSError) as e:
			import traceback
			traceback.print_exc()
			thread.stop() 
開發者ID:hao35954514,項目名稱:shadowsocksR-b,代碼行數:21,代碼來源:server.py

示例2: __init__

# 需要導入模塊: from shadowsocks import shell [as 別名]
# 或者: from shadowsocks.shell import check_python [as 別名]
def __init__(self):
		shell.check_python()
		self.config = shell.get_config(False)
		self.dns_resolver = asyncdns.DNSResolver()
		if not self.config.get('dns_ipv6', False):
			asyncdns.IPV6_CONNECTION_SUPPORT = False

		self.mgr = None #asyncmgr.ServerMgr()

		self.tcp_servers_pool = {}
		self.tcp_ipv6_servers_pool = {}
		self.udp_servers_pool = {}
		self.udp_ipv6_servers_pool = {}
		self.stat_counter = {}

		self.loop = eventloop.EventLoop()
		self.thread = MainThread( (self.loop, self.dns_resolver, self.mgr) )
		self.thread.start() 
開發者ID:hao35954514,項目名稱:shadowsocksR-b,代碼行數:20,代碼來源:server_pool.py

示例3: main

# 需要導入模塊: from shadowsocks import shell [as 別名]
# 或者: from shadowsocks.shell import check_python [as 別名]
def main():
	shell.check_python()
	if False:
		db_transfer.DbTransfer.thread_db()
	else:
		if get_config().API_INTERFACE == 'mudbjson':
			thread = MainThread(db_transfer.MuJsonTransfer)
		elif get_config().API_INTERFACE == 'sspanelv2':
			thread = MainThread(db_transfer.DbTransfer)
		else:
			thread = MainThread(db_transfer.Dbv3Transfer)
		thread.start()
		try:
			while thread.is_alive():
				time.sleep(10)
		except (KeyboardInterrupt, IOError, OSError) as e:
			import traceback
			traceback.print_exc()
			thread.stop() 
開發者ID:AlphaBrock,項目名稱:ssr-ml,代碼行數:21,代碼來源:server.py

示例4: __init__

# 需要導入模塊: from shadowsocks import shell [as 別名]
# 或者: from shadowsocks.shell import check_python [as 別名]
def __init__(self):
		shell.check_python()
		self.config = shell.get_config(False)
		shell.print_shadowsocks()
		self.dns_resolver = asyncdns.DNSResolver()
		if not self.config.get('dns_ipv6', False):
			asyncdns.IPV6_CONNECTION_SUPPORT = False

		self.mgr = None #asyncmgr.ServerMgr()

		self.tcp_servers_pool = {}
		self.tcp_ipv6_servers_pool = {}
		self.udp_servers_pool = {}
		self.udp_ipv6_servers_pool = {}
		self.stat_counter = {}

		self.loop = eventloop.EventLoop()
		self.thread = MainThread( (self.loop, self.dns_resolver, self.mgr) )
		self.thread.start() 
開發者ID:AlphaBrock,項目名稱:ssr-ml,代碼行數:21,代碼來源:server_pool.py

示例5: __init__

# 需要導入模塊: from shadowsocks import shell [as 別名]
# 或者: from shadowsocks.shell import check_python [as 別名]
def __init__(self):
        shell.check_python()
        self.config = shell.get_config(False)
        self.dns_resolver = asyncdns.DNSResolver()
        if not self.config.get('dns_ipv6', False):
            asyncdns.IPV6_CONNECTION_SUPPORT = False

        self.mgr = None  # asyncmgr.ServerMgr()

        self.eventloop_pool = {}
        self.dns_resolver_pool = {}

        self.dns_resolver = asyncdns.DNSResolver()

        self.loop = eventloop.EventLoop()
        self.thread = MainThread((self.loop, self.dns_resolver, self.mgr))
        self.thread.start()

        self.tcp_servers_pool = {}
        self.tcp_ipv6_servers_pool = {}
        self.udp_servers_pool = {}
        self.udp_ipv6_servers_pool = {}
        self.stat_counter = {}

        self.uid_port_table = {} 
開發者ID:PaperDashboard,項目名稱:shadowsocks,代碼行數:27,代碼來源:server_pool.py

示例6: main

# 需要導入模塊: from shadowsocks import shell [as 別名]
# 或者: from shadowsocks.shell import check_python [as 別名]
def main():
    shell.check_python()

    # fix py2exe
    if hasattr(sys, "frozen") and sys.frozen in \
            ("windows_exe", "console_exe"):
        p = os.path.dirname(os.path.abspath(sys.executable))
        os.chdir(p)

    config = shell.get_config(True)

    daemon.daemon_exec(config)

    try:
        logging.info("starting local at %s:%d" %
                     (config['local_address'], config['local_port']))

        dns_resolver = asyncdns.DNSResolver()
        tcp_server = tcprelay.TCPRelay(config, dns_resolver, True)
        udp_server = udprelay.UDPRelay(config, dns_resolver, True)
        loop = eventloop.EventLoop()
        dns_resolver.add_to_loop(loop)
        tcp_server.add_to_loop(loop)
        udp_server.add_to_loop(loop)

        def handler(signum, _):
            logging.warn('received SIGQUIT, doing graceful shutting down..')
            tcp_server.close(next_tick=True)
            udp_server.close(next_tick=True)
        signal.signal(getattr(signal, 'SIGQUIT', signal.SIGTERM), handler)

        def int_handler(signum, _):
            sys.exit(1)
        signal.signal(signal.SIGINT, int_handler)

        daemon.set_user(config.get('user', None))
        loop.run()
    except Exception as e:
        shell.print_exception(e)
        sys.exit(1) 
開發者ID:ntfreedom,項目名稱:neverendshadowsocks,代碼行數:42,代碼來源:local.py

示例7: main

# 需要導入模塊: from shadowsocks import shell [as 別名]
# 或者: from shadowsocks.shell import check_python [as 別名]
def main():
    logging.basicConfig(level=logging.INFO,
                        format='%(levelname)-s: %(message)s')

    shell.check_python()

    if get_config().API_INTERFACE == 'modwebapi':
        threadMain = MainThread(web_transfer.WebTransfer)
    else:
        threadMain = MainThread(db_transfer.DbTransfer)
    threadMain.start()

    threadSpeedtest = MainThread(speedtest_thread.Speedtest)
    threadSpeedtest.start()

    threadAutoexec = MainThread(auto_thread.AutoExec)
    threadAutoexec.start()

    threadAutoblock = MainThread(auto_block.AutoBlock)
    threadAutoblock.start()

    try:
        while threadMain.is_alive():
            threadMain.join(10.0)
    except (KeyboardInterrupt, IOError, OSError) as e:
        import traceback
        traceback.print_exc()
        threadMain.stop()
        if threadSpeedtest.is_alive():
            threadSpeedtest.stop()
        if threadAutoexec.is_alive():
            threadAutoexec.stop()
        if threadAutoblock.is_alive():
            threadAutoblock.stop() 
開發者ID:PaperDashboard,項目名稱:shadowsocks,代碼行數:36,代碼來源:server.py

示例8: main

# 需要導入模塊: from shadowsocks import shell [as 別名]
# 或者: from shadowsocks.shell import check_python [as 別名]
def main():
    shell.check_python()

    # fix py2exe
    if hasattr(sys, "frozen") and sys.frozen in \
            ("windows_exe", "console_exe"):
        p = os.path.dirname(os.path.abspath(sys.executable))
        os.chdir(p)

    config = shell.get_config(True)

    if not config.get('dns_ipv6', False):
        asyncdns.IPV6_CONNECTION_SUPPORT = False

    daemon.daemon_exec(config)

    try:
        logging.info("starting local at %s:%d" %
                     (config['local_address'], config['local_port']))

        dns_resolver = asyncdns.DNSResolver()
        tcp_server = tcprelay.TCPRelay(config, dns_resolver, True)
        udp_server = udprelay.UDPRelay(config, dns_resolver, True)
        loop = eventloop.EventLoop()
        dns_resolver.add_to_loop(loop)
        tcp_server.add_to_loop(loop)
        udp_server.add_to_loop(loop)

        def handler(signum, _):
            logging.warn('received SIGQUIT, doing graceful shutting down..')
            tcp_server.close(next_tick=True)
            udp_server.close(next_tick=True)
        signal.signal(getattr(signal, 'SIGQUIT', signal.SIGTERM), handler)

        def int_handler(signum, _):
            sys.exit(1)
        signal.signal(signal.SIGINT, int_handler)

        daemon.set_user(config.get('user', None))
        loop.run()
    except Exception as e:
        shell.print_exception(e)
        sys.exit(1) 
開發者ID:shadowsocksr-backup,項目名稱:shadowsocksr,代碼行數:45,代碼來源:local.py

示例9: main

# 需要導入模塊: from shadowsocks import shell [as 別名]
# 或者: from shadowsocks.shell import check_python [as 別名]
def main():
    shell.check_python()

    # fix py2exe
    if hasattr(sys, "frozen") and sys.frozen in \
            ("windows_exe", "console_exe"):
        p = os.path.dirname(os.path.abspath(sys.executable))
        os.chdir(p)

    config = shell.get_config(True)

    if not config.get('dns_ipv6', False):
        asyncdns.IPV6_CONNECTION_SUPPORT = False

    daemon.daemon_exec(config)
    logging.info("local start with protocol[%s] password [%s] method [%s] obfs [%s] obfs_param [%s]" %
            (config['protocol'], config['password'], config['method'], config['obfs'], config['obfs_param']))

    try:
        logging.info("starting local at %s:%d" %
                     (config['local_address'], config['local_port']))

        dns_resolver = asyncdns.DNSResolver()
        tcp_server = tcprelay.TCPRelay(config, dns_resolver, True)
        udp_server = udprelay.UDPRelay(config, dns_resolver, True)
        loop = eventloop.EventLoop()
        dns_resolver.add_to_loop(loop)
        tcp_server.add_to_loop(loop)
        udp_server.add_to_loop(loop)

        def handler(signum, _):
            logging.warn('received SIGQUIT, doing graceful shutting down..')
            tcp_server.close(next_tick=True)
            udp_server.close(next_tick=True)
        signal.signal(getattr(signal, 'SIGQUIT', signal.SIGTERM), handler)

        def int_handler(signum, _):
            sys.exit(1)
        signal.signal(signal.SIGINT, int_handler)

        daemon.set_user(config.get('user', None))
        loop.run()
    except Exception as e:
        shell.print_exception(e)
        sys.exit(1) 
開發者ID:hao35954514,項目名稱:shadowsocksR-b,代碼行數:47,代碼來源:local.py

示例10: main

# 需要導入模塊: from shadowsocks import shell [as 別名]
# 或者: from shadowsocks.shell import check_python [as 別名]
def main():
    shell.check_python()

    # fix py2exe
    if hasattr(sys, "frozen") and sys.frozen in \
            ("windows_exe", "console_exe"):
        p = os.path.dirname(os.path.abspath(sys.executable))
        os.chdir(p)

    config = shell.get_config(True)

    if not config.get('dns_ipv6', False):
        asyncdns.IPV6_CONNECTION_SUPPORT = False

    daemon.daemon_exec(config)
    logging.info(
        "local start with protocol[%s] password [%s] method [%s] obfs [%s] obfs_param [%s]" %
        (config['protocol'],
         config['password'],
         config['method'],
         config['obfs'],
         config['obfs_param']))

    try:
        logging.info("starting local at %s:%d" %
                     (config['local_address'], config['local_port']))

        dns_resolver = asyncdns.DNSResolver()
        tcp_server = tcprelay.TCPRelay(config, dns_resolver, True)
        udp_server = udprelay.UDPRelay(config, dns_resolver, True)
        loop = eventloop.EventLoop()
        dns_resolver.add_to_loop(loop)
        tcp_server.add_to_loop(loop)
        udp_server.add_to_loop(loop)

        def handler(signum, _):
            logging.warn('received SIGQUIT, doing graceful shutting down..')
            tcp_server.close(next_tick=True)
            udp_server.close(next_tick=True)
        signal.signal(getattr(signal, 'SIGQUIT', signal.SIGTERM), handler)

        def int_handler(signum, _):
            sys.exit(1)
        signal.signal(signal.SIGINT, int_handler)

        daemon.set_user(config.get('user', None))
        loop.run()
    except Exception as e:
        shell.print_exception(e)
        sys.exit(1) 
開發者ID:PaperDashboard,項目名稱:shadowsocks,代碼行數:52,代碼來源:local.py

示例11: main

# 需要導入模塊: from shadowsocks import shell [as 別名]
# 或者: from shadowsocks.shell import check_python [as 別名]
def main():
    # 檢查Python版本是否符合要求
    shell.check_python()

    # fix py2exe
    if hasattr(sys, "frozen") and sys.frozen in \
            ("windows_exe", "console_exe"):
        p = os.path.dirname(os.path.abspath(sys.executable))
        os.chdir(p)

    config = shell.get_config(True)

    daemon.daemon_exec(config)

    try:
        logging.info("starting local at %s:%d" %
                     (config['local_address'], config['local_port']))

        dns_resolver = asyncdns.DNSResolver()
        tcp_server = tcprelay.TCPRelay(config, dns_resolver, True)
        udp_server = udprelay.UDPRelay(config, dns_resolver, True)
        loop = eventloop.EventLoop()
        dns_resolver.add_to_loop(loop)
        tcp_server.add_to_loop(loop)
        udp_server.add_to_loop(loop)

        def handler(signum, _):
            logging.warn('received SIGQUIT, doing graceful shutting down..')
            tcp_server.close(next_tick=True)
            udp_server.close(next_tick=True)

        # 注冊信號事件,用於結束 local 程序
        signal.signal(getattr(signal, 'SIGQUIT', signal.SIGTERM), handler)

        def int_handler(signum, _):
            sys.exit(1)

        # SIGINT external interrupt, usually initiated by the user
        signal.signal(signal.SIGINT, int_handler)

        daemon.set_user(config.get('user', None))
        loop.run()
    except Exception as e:
        shell.print_exception(e)
        sys.exit(1) 
開發者ID:youkochan,項目名稱:shadowsocks-analysis,代碼行數:47,代碼來源:local.py


注:本文中的shadowsocks.shell.check_python方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。