Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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
Пример #4
0
 def get_router_proxy_ip(self, key='all'):
     d, _ = Dealdata.cut_data(data(self.router)['proxy']['ip'], key)
     return d, Dealdata.praseindex(key)
Пример #5
0
 def get_dns(self, key='all'):
     d, _ = Dealdata.cut_data(data(self.dns), key)
     return d, Dealdata.praseindex(key)
Пример #6
0
 def get_sub(self, key='all'):
     d, _ = Dealdata.cut_data(data(self.outbound)['sub'], key)
     return d, Dealdata.praseindex(key)
Пример #7
0
 def get_node(self, key='all'):
     d, _ = Dealdata.cut_data(data(self.outbound)['vmess'], key)
     return d, Dealdata.praseindex(key)
Пример #8
0
 def del_node(self, key):
     olddata = self.data['vmess']
     _, newdata = Dealdata.cut_data(olddata, key)
     self.data['vmess'] = newdata
     return len(olddata) - len(newdata)
Пример #9
0
 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)
Пример #10
0
 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)
Пример #11
0
 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)
Пример #12
0
 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)
Пример #13
0
 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)
Пример #14
0
 def del_DNS(self, key):
     _, newdata = Dealdata.cut_data(self.data, key)
     l = len(self.data) - len(newdata)
     self.data = newdata
     return l
Пример #15
0
 def del_sub(self, key):
     olddata = self.data['sub']
     _, newdata = Dealdata.cut_data(olddata, key)
     self.data['sub'] = newdata
     return len(olddata) - len(newdata)
Пример #16
0
 def get_router_direct_ip(self, key='all'):
     d, _ = Dealdata.cut_data(data(self.router)['direct']['ip'], key)
     return d, Dealdata.praseindex(key)
Пример #17
0
 def get_router_block_domain(self, key='all'):
     d, _ = Dealdata.cut_data(data(self.router)['block']['domain'], key)
     return d, Dealdata.praseindex(key)
Пример #18
0
 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)]