def get_vmesslinks(self, key='all'): d, _ = Dealdata.cut_data(data(self.outbound)['vmess'], key) vmesslinks = [{ 'remarks': x['remarks'], 'link': node2vmesslink(x) } for x in d] return vmesslinks, Dealdata.praseindex(key)
def get_router(self, key, mode): if mode == 1: r = data(self.router)['direct']['ip'] d, _ = Dealdata.cut_data(r, key) return d, Dealdata.praseindex(key) elif mode == 2: r = data(self.router)['direct']['domain'] d, _ = Dealdata.cut_data(r, key) return d, Dealdata.praseindex(key) elif mode == 3: r = data(self.router)['proxy']['ip'] d, _ = Dealdata.cut_data(r, key) return d, Dealdata.praseindex(key) elif mode == 4: r = data(self.router)['proxy']['domain'] d, _ = Dealdata.cut_data(r, key) return d, Dealdata.praseindex(key) elif mode == 5: r = data(self.router)['block']['ip'] d, _ = Dealdata.cut_data(r, key) return d, Dealdata.praseindex(key) elif mode == 6: r = data(self.router)['block']['domain'] d, _ = Dealdata.cut_data(r, key) return d, Dealdata.praseindex(key)
def update_node_by_sub(self, subkey='all', proxy_port=None): sublist = self.data['sub'] selectdata, _ = Dealdata.cut_data(sublist, subkey) subids = [] newnodes = [] for sub in selectdata: vmessobjs = vmess.sublink2vmessobjs(sub['url'], proxy_port) if vmessobjs != None: subids.append(sub['id']) for obj in vmessobjs: newnodes.append(vmess.vemssobj2node(obj, sub['id'])) for node in self.data['vmess']: if node['subid'] not in subids: newnodes.append(node) self.data['vmess'] = newnodes
def get_router_proxy_ip(self, key='all'): d, _ = Dealdata.cut_data(data(self.router)['proxy']['ip'], key) return d, Dealdata.praseindex(key)
def get_dns(self, key='all'): d, _ = Dealdata.cut_data(data(self.dns), key) return d, Dealdata.praseindex(key)
def get_sub(self, key='all'): d, _ = Dealdata.cut_data(data(self.outbound)['sub'], key) return d, Dealdata.praseindex(key)
def get_node(self, key='all'): d, _ = Dealdata.cut_data(data(self.outbound)['vmess'], key) return d, Dealdata.praseindex(key)
def del_node(self, key): olddata = self.data['vmess'] _, newdata = Dealdata.cut_data(olddata, key) self.data['vmess'] = newdata return len(olddata) - len(newdata)
def del_block_ip(self, key): r = self.data['block']['ip'] _, new_data = Dealdata.cut_data(r, key) self.data['block']['ip'] = new_data return len(r) - len(new_data)
def del_direct_ip(self, key): r = self.data['direct']['ip'] _, new_data = Dealdata.cut_data(r, key) self.data['direct']['indexs'] = new_data return len(r) - len(new_data)
def del_direct_domain(self, key): r = self.data['direct']['domain'] _, new_data = Dealdata.cut_data(r, key) self.data['direct']['domain'] = new_data return len(r) - len(new_data)
def del_proxy_ip(self, key): r = self.data['proxy']['ip'] _, new_data = Dealdata.cut_data(r, key) self.data['proxy']['ip'] = new_data return len(r) - len(new_data)
def del_proxy_domain(self, key): r = self.data['proxy']['domain'] _, new_data = Dealdata.cut_data(r, key) self.data['proxy']['domain'] = new_data return new_data, len(r) - len(new_data)
def del_DNS(self, key): _, newdata = Dealdata.cut_data(self.data, key) l = len(self.data) - len(newdata) self.data = newdata return l
def del_sub(self, key): olddata = self.data['sub'] _, newdata = Dealdata.cut_data(olddata, key) self.data['sub'] = newdata return len(olddata) - len(newdata)
def get_router_direct_ip(self, key='all'): d, _ = Dealdata.cut_data(data(self.router)['direct']['ip'], key) return d, Dealdata.praseindex(key)
def get_router_block_domain(self, key='all'): d, _ = Dealdata.cut_data(data(self.router)['block']['domain'], key) return d, Dealdata.praseindex(key)
def get_router_block_ip(self, key='all'): d, _ = Dealdata.cut_data(data(self.router)['block']['ip'], key) return d, Dealdata.praseindex(key)[:len(d)]