|
@ -2,7 +2,7 @@ |
|
|
# -*- coding: UTF-8 -*- |
|
|
# -*- coding: UTF-8 -*- |
|
|
|
|
|
|
|
|
import traceback |
|
|
import traceback |
|
|
from shadowsocks import shell |
|
|
from shadowsocks import shell, common |
|
|
from configloader import load_config, get_config |
|
|
from configloader import load_config, get_config |
|
|
import random |
|
|
import random |
|
|
import getopt |
|
|
import getopt |
|
@ -21,8 +21,9 @@ class MuJsonLoader(object): |
|
|
def save(self, path): |
|
|
def save(self, path): |
|
|
if self.json: |
|
|
if self.json: |
|
|
output = json.dumps(self.json, sort_keys=True, indent=4, separators=(',', ': ')) |
|
|
output = json.dumps(self.json, sort_keys=True, indent=4, separators=(',', ': ')) |
|
|
with open(path, 'w') as f: |
|
|
with open(path, 'r+') as f: |
|
|
f.write(output) |
|
|
f.write(output) |
|
|
|
|
|
f.truncate() |
|
|
|
|
|
|
|
|
class MuMgr(object): |
|
|
class MuMgr(object): |
|
|
def __init__(self): |
|
|
def __init__(self): |
|
@ -35,8 +36,8 @@ class MuMgr(object): |
|
|
obfs = user.get('obfs', '') |
|
|
obfs = user.get('obfs', '') |
|
|
protocol = protocol.replace("_compatible", "") |
|
|
protocol = protocol.replace("_compatible", "") |
|
|
obfs = obfs.replace("_compatible", "") |
|
|
obfs = obfs.replace("_compatible", "") |
|
|
link = "%s:%s:%s:%s:%s:%s" % (self.server_addr, user['port'], protocol, user['method'], obfs, base64.urlsafe_b64encode(user['passwd'])) |
|
|
link = "%s:%s:%s:%s:%s:%s" % (self.server_addr, user['port'], protocol, user['method'], obfs, common.to_str(base64.urlsafe_b64encode(common.to_bytes(user['passwd'])))) |
|
|
return "ssr://" + base64.urlsafe_b64encode(link) |
|
|
return "ssr://" + common.to_str(base64.urlsafe_b64encode(common.to_bytes(link))) |
|
|
|
|
|
|
|
|
def userinfo(self, user): |
|
|
def userinfo(self, user): |
|
|
ret = "" |
|
|
ret = "" |
|
|