forked from q158073378252010/v2ray.fun
-
Notifications
You must be signed in to change notification settings - Fork 25
/
readjson.py
executable file
·31 lines (27 loc) · 944 Bytes
/
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
#! /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"]
ConfStream=ConfInbound[u"streamSettings"]
ConfStreamKcpSettings=ConfStream[u'kcpSettings']
ConfStreamNetwork=ConfStream[u"network"]
ConfStreamSecurity=ConfStream[u"security"]
if ConfStreamNetwork=="kcp" :
if ConfStreamKcpSettings.has_key('header'):
ConfStreamHeader=ConfStreamKcpSettings[u"header"][u'type']
else:
ConfStreamHeader="none"