Exemple #1
0
def save_login_info(VMess, class_):
    """
    VMess入库
    class_: ssr or v2ray
    """

    # redis loaded
    # RedisClient().add(key_name=REDIS_KEY_NAME_BASE.format(class_), value_of_link_attr=VMess)
    threading.Thread(target=RedisClient().add,
                     args=(REDIS_KEY_NAME_BASE.format(class_), VMess)).start()

    # static data loaded
    now = str(datetime.now()).split('.')[0]
    with open(path_, 'a', encoding='utf-8', newline='') as f:
        writer = csv.writer(f)
        # 入库时间,Vmess,初始化状态:0
        writer.writerow(['{}'.format(now), '{}'.format(VMess), class_, '0'])
Exemple #2
0
def save_login_info(subscribe, class_, life_cycle: str):
    """
    :param life_cycle:
    :param subscribe:
    :param class_:v2ray, ssr, trojan
    """
    # Redis loaded
    # RedisClient().add(key_name=REDIS_KEY_NAME_BASE.format(class_), subscribe=subscribe)
    threading.Thread(target=RedisClient().add, args=(REDIS_KEY_NAME_BASE.format(class_), subscribe, life_cycle)).start()

    # Static data loaded
    with open(SYS_AIRPORT_INFO_PATH, 'a', encoding='utf-8', newline='') as f:
        writer = csv.writer(f)
        # 入库时间,Vmess,初始化状态:0
        writer.writerow(['{}'.format(life_cycle), '{}'.format(subscribe), class_, '0'])

    # Depolyment mode --> nginx
    if 'linux' in sys.platform:
        try:
            with open(NGINX_SUBSCRIBE_PATH.format(class_), 'w', encoding='utf-8') as f:
                f.write(subscribe)
        except FileNotFoundError as e:
            print(e)
Exemple #3
0
        logging.info(debug_msg)
        return magic_msg(debug_msg, 'g')
    elif 'ERR' in tag_info.upper():
        logging.error(debug_msg)
        return magic_msg(debug_msg, 'r')
    elif 'RUN' in tag_info.upper():
        return magic_msg(debug_msg, 'c')
    elif tag_info == '-OVER-':
        return magic_msg(debug_msg, 'm')
    elif 'WARN' in tag_info.upper():
        return magic_msg(debug_msg, 'y')
    else:
        return debug_msg


rc = RedisClient()
rc_len = {
    'ssr': 1,
    'v2ray': 1,
    'trojan': 1,
}


def do_spider_cluster(task_name: str):
    if isinstance(task_name, str):
        if task_name == 'ssr':
            xjcloud.Action_XjCloud().run()
        elif task_name == 'v2ray':
            thessr.Action_TheSSR().run()
            ufocloud.Action_UfoCloud().run()
        elif task_name == 'trojan':