-
Notifications
You must be signed in to change notification settings - Fork 401
/
readjson.py
executable file
·32 lines (28 loc) · 1008 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
32
#! /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 ConfStreamNetwork=="kcp" :
if ConfStreamKcpSettings.has_key('header'):
ConfStreamHeader=ConfStreamKcpSettings[u"header"][u'type']
else:
ConfStreamHeader="none"