Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 5
0
 def get_dns(self, key='all'):
     d, _ = Dealdata.cut_data(data(self.dns), key)
     return d, Dealdata.praseindex(key)
Exemplo n.º 6
0
 def get_sub(self, key='all'):
     d, _ = Dealdata.cut_data(data(self.outbound)['sub'], key)
     return d, Dealdata.praseindex(key)
Exemplo n.º 7
0
 def get_node(self, key='all'):
     d, _ = Dealdata.cut_data(data(self.outbound)['vmess'], key)
     return d, Dealdata.praseindex(key)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)]