def link(self, ip, port, tls): if tls == "tls": return ColorStr.red("HTTPS的Socks5不支持tg的分享连接. 请自行配合设置BifrostV等软件使用") else: return ColorStr.green( "tg://socks?server={0}&port={1}&user={2}&pass={3}".format( ip, port, self.user_info, self.password))
def select_group(self): print(self.profile) choice = input("请输入要{}的节点Group字母: ".format(self.action)) group_list = [x for x in self.group_list if x.tag == choice] if len(group_list) == 0: print(ColorStr.red('输入有误,请检查 {} Group是否存在'.format(choice))) self.group = None else: self.group = group_list[0]
def __init__(self, action): super(GroupSelector, self).__init__(action) if "删除" in action and len(self.group_list) == 1: print(ColorStr.red("仅剩最后一个端口无法删除!!!")) self.group = None elif len(self.group_list) > 1: self.select_group() else: self.group = self.group_list[0]
def __init__(self, action): super(ClientSelector, self).__init__(action) self.list_size = self.group_list[-1].node_list[-1].user_number if "删除" in action and self.list_size == 1: print(ColorStr.red("仅剩最后一个节点无法删除!!!")) self.group = None elif self.list_size > 1: self.select_client() else: self.group = self.group_list[0] self.client_index = 0
def select_client(self): print(self.profile) self.group = None choice = input("请输入要{}的节点序号数字: ".format(self.action)) if not choice.isnumeric(): print(ColorStr.red('输入错误,请检查是否为数字')) return choice = int(choice) if choice < 1 or choice > self.list_size: print(ColorStr.red('输入错误,请检查是否符合范围中')) else: find = False for group in self.group_list: if find: break for index, node in enumerate(group.node_list): if node.user_number == choice: self.client_index = index self.group = group find = True break
loader = Loader() profile = loader.profile group_list = profile.group_list while True: print("Iptables 端口流量统计") print("") print("1.查看流量统计\n") print("2.重置流量统计\n") print("tip: v2ray功能端口默认自动开启iptables的流量统计\n") choice = input("请输入数字选择功能:") if choice == "1": print("") for group in group_list: print(calcul_iptables_traffic(group.port)) print("") elif choice == "2": port = input("请输入要重置流量的端口:") if port and port.isnumeric(): os.system( "bash /usr/local/multi-v2ray/global_setting/clean_traffic.sh {}" .format(str(port))) else: print(ColorStr.red("输入有误!")) else: break