mirror of
https://github.com/Ysurac/openmptcprouter-vps-admin.git
synced 2025-03-09 15:40:05 +00:00
Add V2Ray Trojan and VMESS protocols support
This commit is contained in:
parent
c4374c2859
commit
91bb8949a5
2 changed files with 19 additions and 1 deletions
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -1,3 +1,9 @@
|
||||||
|
omr-vps-admin (0.3+20230825) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Add V2Ray VMESS and TROJAN protocols support
|
||||||
|
|
||||||
|
-- OpenMPTCProuter <contact@openmptcprouter.com> Fri, 25 Aug 2023 11:14:46 +0200
|
||||||
|
|
||||||
omr-vps-admin (0.3+20230823) unstable; urgency=medium
|
omr-vps-admin (0.3+20230823) unstable; urgency=medium
|
||||||
|
|
||||||
* Fix in upload speedtest
|
* Fix in upload speedtest
|
||||||
|
|
14
omr-admin.py
14
omr-admin.py
|
@ -273,6 +273,10 @@ def v2ray_add_user(user, restart=1):
|
||||||
for inbounds in data['inbounds']:
|
for inbounds in data['inbounds']:
|
||||||
if inbounds['tag'] == 'omrin-tunnel':
|
if inbounds['tag'] == 'omrin-tunnel':
|
||||||
inbounds['settings']['clients'].append({'id': v2rayuuid, 'level': 0, 'alterId': 0, 'email': user})
|
inbounds['settings']['clients'].append({'id': v2rayuuid, 'level': 0, 'alterId': 0, 'email': user})
|
||||||
|
if inbounds['tag'] == 'omrin-vmess-tunnel':
|
||||||
|
inbounds['settings']['clients'].append({'id': v2rayuuid, 'level': 0, 'alterId': 0, 'email': user})
|
||||||
|
if inbounds['tag'] == 'omrin-trojan-tunnel':
|
||||||
|
inbounds['settings']['clients'].append({'password': v2rayuuid, 'email': user})
|
||||||
with open('/etc/v2ray/v2ray-server.json', 'w') as f:
|
with open('/etc/v2ray/v2ray-server.json', 'w') as f:
|
||||||
json.dump(data, f, indent=4)
|
json.dump(data, f, indent=4)
|
||||||
final_md5 = hashlib.md5(file_as_bytes(open('/etc/v2ray/v2ray-server.json', 'rb'))).hexdigest()
|
final_md5 = hashlib.md5(file_as_bytes(open('/etc/v2ray/v2ray-server.json', 'rb'))).hexdigest()
|
||||||
|
@ -280,7 +284,7 @@ def v2ray_add_user(user, restart=1):
|
||||||
os.system("systemctl -q restart v2ray")
|
os.system("systemctl -q restart v2ray")
|
||||||
return v2rayuuid
|
return v2rayuuid
|
||||||
|
|
||||||
def v2ray_del_user(user, restart=1):
|
def v2ray_del_user(user, restart=1, protocol="vless"):
|
||||||
v2rayuuid = str(uuid.uuid1())
|
v2rayuuid = str(uuid.uuid1())
|
||||||
initial_md5 = hashlib.md5(file_as_bytes(open('/etc/v2ray/v2ray-server.json', 'rb'))).hexdigest()
|
initial_md5 = hashlib.md5(file_as_bytes(open('/etc/v2ray/v2ray-server.json', 'rb'))).hexdigest()
|
||||||
with open('/etc/v2ray/v2ray-server.json') as f:
|
with open('/etc/v2ray/v2ray-server.json') as f:
|
||||||
|
@ -290,6 +294,14 @@ def v2ray_del_user(user, restart=1):
|
||||||
for v2rayuser in inbounds['settings']['clients']:
|
for v2rayuser in inbounds['settings']['clients']:
|
||||||
if v2rayuser['email'] == user:
|
if v2rayuser['email'] == user:
|
||||||
inbounds['settings']['clients'].remove(v2rayuser)
|
inbounds['settings']['clients'].remove(v2rayuser)
|
||||||
|
if inbounds['tag'] == 'omrin-vmess-tunnel':
|
||||||
|
for v2rayuser in inbounds['settings']['clients']:
|
||||||
|
if v2rayuser['email'] == user:
|
||||||
|
inbounds['settings']['clients'].remove(v2rayuser)
|
||||||
|
if inbounds['tag'] == 'omrin-trojan-tunnel':
|
||||||
|
for v2rayuser in inbounds['settings']['clients']:
|
||||||
|
if v2rayuser['email'] == user:
|
||||||
|
inbounds['settings']['clients'].remove(v2rayuser)
|
||||||
with open('/etc/v2ray/v2ray-server.json', 'w') as f:
|
with open('/etc/v2ray/v2ray-server.json', 'w') as f:
|
||||||
json.dump(data, f, indent=4)
|
json.dump(data, f, indent=4)
|
||||||
final_md5 = hashlib.md5(file_as_bytes(open('/etc/v2ray/v2ray-server.json', 'rb'))).hexdigest()
|
final_md5 = hashlib.md5(file_as_bytes(open('/etc/v2ray/v2ray-server.json', 'rb'))).hexdigest()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue