forked from bigbigbigboss/v2ray.fun-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
readjson.py
executable file
·37 lines (32 loc) · 1.15 KB
/
readjson.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import json
#打开配置文件
jsonfile = file("/etc/v2ray/config.json")
config = json.load(jsonfile)
#读取配置文件大框架
ConfInbound=config[u"inbound"]
ConfOutbound=config[u"outbound"]
ConfInboundDetour=config[u"inboundDetour"]
ConfOutboundDetour=config[u"outboundDetour"]
ConfDns=config[u"dns"]
ConfRouting=config[u"routing"]
#读取传入配置细节部分
ConfPort=ConfInbound[u"port"]
ConfUUID=ConfInbound[u"settings"][u"clients"][0][u"id"]
ConfSecurity=ConfInbound[u"settings"][u"clients"][0][u"security"]
ConfAlterId=ConfInbound[u"settings"][u"clients"][0][u"alterId"]
ConfStream=ConfInbound[u"streamSettings"]
ConfStreamKcpSettings=ConfStream[u'kcpSettings']
ConfStreamNetwork=ConfStream[u"network"]
ConfStreamSecurity=ConfStream[u"security"]
if config[u"inboundDetour"] and "port" in config[u"inboundDetour"][0]:
ConfigDynPortRange=config[u"inboundDetour"][0][u"port"]
else:
ConfigDynPortRange=""
if ConfStreamNetwork=="kcp" :
if ConfStreamKcpSettings.has_key('header'):
ConfStreamHeader=ConfStreamKcpSettings[u"header"][u'type']
else:
ConfStreamHeader="none"