Beispiel #1
0
    def __init__(self):
        self.running = True
        self.last_host = "center.xx-net.net"

        self.logger = logger
        config_path = os.path.join(module_data_path, "cloudfront_front.json")
        self.config = Config(config_path)

        sni_fn = os.path.join(current_path, "sni_list.txt")
        self.host_manager = host_manager.HostManager(fn=sni_fn, max_size=120)

        ca_certs = os.path.join(current_path, "cacert.pem")
        openssl_context = SSLContext(logger, ca_certs=ca_certs, support_http2=True)
        self.connect_creator = ConnectCreator(logger, self.config, openssl_context, self.host_manager)
        self.ip_checker = CheckIp(xlog.null, self.config, self.connect_creator)

        ip_source = Ipv4RangeSource(
            logger, self.config,
            os.path.join(current_path, "ip_range.txt"),
            os.path.join(module_data_path, "cloudfront_ip_range.txt")
        )
        self.ip_manager = IpManager(
            logger, self.config, ip_source, check_local_network,
            self.check_ip,
            os.path.join(current_path, "good_ip.txt"),
            os.path.join(module_data_path, "cloudfront_ip_list.txt"),
            scan_ip_log=None)

        self.connect_manager = ConnectManager(
            logger, self.config, self.connect_creator, self.ip_manager, check_local_network)

        self.dispatchs = {}
Beispiel #2
0
    def __init__(self):
        self.running = True
        self.last_host = "center.xx-net.net"

        self.logger = logger
        config_path = os.path.join(module_data_path, "cloudflare_front.json")
        self.config = Config(config_path)

        ca_certs = os.path.join(current_path, "cacert.pem")
        default_domain_fn = os.path.join(current_path, "front_domains.json")
        domain_fn = os.path.join(module_data_path, "cloudflare_domains.json")
        self.host_manager = host_manager.HostManager(self.config, logger,
                                                     default_domain_fn,
                                                     domain_fn, self)

        openssl_context = SSLContext(logger, ca_certs=ca_certs)
        self.connect_creator = ConnectCreator(logger, self.config,
                                              openssl_context,
                                              self.host_manager)
        self.check_ip = CheckIp(xlog.null, self.config, self.connect_creator)

        ip_source = Ipv4RangeSource(
            logger, self.config, os.path.join(current_path, "ip_range.txt"),
            os.path.join(module_data_path, "cloudflare_ip_range.txt"))
        self.ip_manager = IpManager(logger,
                                    self.config,
                                    ip_source,
                                    check_local_network,
                                    self.check_ip.check_ip,
                                    os.path.join(current_path, "good_ip.txt"),
                                    os.path.join(module_data_path,
                                                 "cloudflare_ip_list.txt"),
                                    scan_ip_log=None)

        self.connect_manager = ConnectManager(logger, self.config,
                                              self.connect_creator,
                                              self.ip_manager,
                                              check_local_network)

        self.dispatchs = {}

        self.success_num = 0
        self.fail_num = 0
        self.continue_fail_num = 0
        self.last_fail_time = 0

        self.rtts = collections.deque([(0, time.time())])
        self.rtts_lock = threading.Lock()
        self.traffics = collections.deque()
        self.traffics_lock = threading.Lock()
        self.recent_sent = 0
        self.recent_received = 0
        self.total_sent = 0
        self.total_received = 0

        threading.Thread(target=self.debug_data_clearup_thread).start()
Beispiel #3
0
    def __init__(self):
        self.running = True

        self.logger = logger
        self.config = config

        self.host_manager = host_manager.HostManager(self.config, logger)

        ca_certs = os.path.join(current_path, "cacert.pem")
        self.openssl_context = SSLContext(
            logger,
            ca_certs=ca_certs,
            support_http2=config.support_http2,
            cipher_suites=[
                'ALL', "!RC4-SHA", "!ECDHE-RSA-RC4-SHA",
                "!ECDHE-RSA-AES128-GCM-SHA256", "!AES128-GCM-SHA256",
                "!ECDHE-RSA-AES128-SHA", "!AES128-SHA"
            ])
        self.connect_creator = ConnectCreator(logger, self.config,
                                              self.openssl_context,
                                              self.host_manager)

        self.appid_manager = AppidManager(self.config, logger)

        self.host_manager.appid_manager = self.appid_manager

        self.check_ip = CheckIp(xlog.null, self.config, self.connect_creator)

        self.ipv4_source = Ipv4RangeSource(
            logger, self.config, os.path.join(current_path, "ip_range.txt"),
            os.path.join(module_data_path, "ip_range.txt"))
        self.ipv6_source = Ipv6PoolSource(
            logger, self.config, os.path.join(current_path, "ipv6_list.txt"))
        self.ip_source = IpCombineSource(logger, self.config, self.ipv4_source,
                                         self.ipv6_source)
        self.ip_manager = IpManager(logger,
                                    self.config,
                                    self.ip_source,
                                    check_local_network,
                                    self.check_ip.check_ip,
                                    None,
                                    os.path.join(module_data_path,
                                                 "good_ip.txt"),
                                    scan_ip_log=None)

        self.appid_manager.check_api = self.check_ip.check_ip
        self.appid_manager.ip_manager = self.ip_manager

        self.connect_manager = ConnectManager(logger, self.config,
                                              self.connect_creator,
                                              self.ip_manager,
                                              check_local_network)

        self.http_dispatcher = HttpsDispatcher(logger, self.config,
                                               self.ip_manager,
                                               self.connect_manager)
Beispiel #4
0
    def __init__(self):
        self.running = True
        self.last_host = "center.xx-net.org"

        self.logger = logger
        config_path = os.path.join(module_data_path, "cloudflare_front.json")
        self.config = Config(config_path)

        self.light_config = Config(config_path)
        self.light_config.dispather_min_workers = 1
        self.light_config.max_good_ip_num = 10

        ca_certs = os.path.join(current_path, "cacert.pem")
        default_domain_fn = os.path.join(current_path, "front_domains.json")
        domain_fn = os.path.join(module_data_path, "cloudflare_domains.json")
        self.host_manager = host_manager.HostManager(self.config, logger,
                                                     default_domain_fn,
                                                     domain_fn, self)

        openssl_context = SSLContext(logger, ca_certs=ca_certs)
        self.connect_creator = ConnectCreator(logger, self.config,
                                              openssl_context,
                                              self.host_manager)
        self.check_ip = CheckIp(xlog.null, self.config, self.connect_creator)

        ip_source = Ipv4RangeSource(
            logger, self.config, os.path.join(current_path, "ip_range.txt"),
            os.path.join(module_data_path, "cloudflare_ip_range.txt"))
        self.ip_manager = IpManager(logger,
                                    self.config,
                                    ip_source,
                                    check_local_network,
                                    self.check_ip.check_ip,
                                    os.path.join(current_path, "good_ip.txt"),
                                    os.path.join(module_data_path,
                                                 "cloudflare_ip_list.txt"),
                                    scan_ip_log=None)

        self.connect_manager = ConnectManager(logger, self.config,
                                              self.connect_creator,
                                              self.ip_manager,
                                              check_local_network)

        self.dispatchs = {}