Comments (7)
这个问题我之前有仔细想过,前几天加的那些 struct
真的是让人头晕眼花……
Qt有自带的JSON库,这个不是问题,我个人比较喜欢使用强类型的struct
+ template,你说的 "access": null
确实也很不好看
这个修改提议待定
ADDED: 可能会加到TODO里面
from qv2ray.
{
"log": {
"access": "",
"error": "",
"loglevel": ""
},
"api": {
"tag": "",
"services": []
},
"dns": {
"hosts": {},
"servers": []
},
"routing": {
"domainStrategy": "",
"rules": [],
"balancers": []
},
"inbounds": [
{
"port": 0,
"listen": "",
"protocol": "",
"settings": {
"timeout": 0,
"accounts": [],
"allowTransparent": false,
"userLevel": 0
},
"tag": ""
}
],
"outbounds": [
{
"sendThrough": "",
"protocol": "",
"settings": {
"vnext": [],
"clients": [],
"disableInsecureEncryption": false
},
"tag": "",
"streamSettings": {
"network": "",
"security": "",
"sockopt": {
"mark": 0,
"tcpFastOpen": false,
"tproxy": ""
},
"tcpSettings": {
"header": {
"type": "",
"request": {
"version": "",
"method": "",
"path": [],
"headers": {}
},
"response": {
"version": "",
"status": "",
"reason": "",
"headers": {}
}
}
},
"tlsSettings": {
"serverName": "",
"allowInsecure": false,
"alpn": [],
"certificates": [],
"disableSystemRoot": false
},
"kcpSettings": {
"mtu": 0,
"tti": 0,
"uplinkCapacity": 0,
"downlinkCapacity": 0,
"congestion": false,
"readBufferSize": 0,
"writeBufferSize": 0,
"header": {
"type": ""
}
},
"wsSettings": {
"path": "",
"headers": {}
},
"httpSettings": {
"host": [],
"path": ""
},
"dsSettings": {
"path": ""
},
"quicSettings": {
"security": "",
"key": "",
"header": {
"type": ""
}
}
},
"proxySettings": {
"tag": ""
},
"mux": {
"enabled": false,
"concurrency": 0
}
}
],
"transport": {
"tcpSettings": {
"header": {
"type": "",
"request": {
"version": "",
"method": "",
"path": [],
"headers": {}
},
"response": {
"version": "",
"status": "",
"reason": "",
"headers": {}
}
}
},
"kcpSettings": {
"mtu": 0,
"tti": 0,
"uplinkCapacity": 0,
"downlinkCapacity": 0,
"congestion": false,
"readBufferSize": 0,
"writeBufferSize": 0,
"header": {
"type": ""
}
},
"wsSettings": {
"path": "",
"headers": {}
},
"httpSettings": {
"host": [],
"path": ""
},
"dsSettings": {
"path": ""
},
"quicSettings": {
"security": "",
"key": "",
"header": {
"type": ""
}
}
},
"stats": {
"_": false
},
"reverse": {
"bridges": [],
"portals": []
},
"policy": {
"level": {},
"system": []
}
}
目前来讲这个 HTTP 进 VMess 出 的默认空配置 struct
JSON 序列化后得到的是以上结果,
如果使用你说的JSON库而不是struct进行操作的话,会出现大量
jsonRootObject["inbounds"][0]["settings"]["vnext"]["uid"] = myUid;
jsonRootObject["inbounds"][0]["settings"]["vnext"]["alterid"] = myAlterid;
......
类似弱类型代码出现,比较不友好
from qv2ray.
另外,削减掉目前没有实现的 RootObject::TransportSettings 后,整个JSON只有 不到 150 行,不存在很难看的 null 现象
v2ray-core的config.json是动态变化的
- AFAIK,大多数JSON是一次性配置,不会更改很多次
from qv2ray.
Added: 相比于 ‘struct template’ json 确实会方便一些
@ZLplLQc
from qv2ray.
只是个建议。
from qv2ray.
现已决定使用 JSON 库实现配置文件读写
谢谢
from qv2ray.
#18 部分对于类型要求很高的仍然使用了 struct,但主体使用的是 QJsonObject
from qv2ray.
Related Issues (20)
- 能否支持一下 新协议vless reality HOT 11
- Bug Report:
- Bug Report: HOT 3
- 除了降级v2ray到5.1,还有别的办法吗? HOT 1
- Bug Report:
- Bug Report:
- 编译失败 HOT 4
- Bug Report: Error while loading shared libraries: libgrpc++.so.1.53 HOT 1
- how can I run it as an application in my mac HOT 1
- Bug Report: ADD TAP ADAPTER SUPPORT PLEASE HOT 2
- Application on Window dont go through proxy
- Bug Report: 新电脑w11,旧电脑w10使用正常,把旧电脑的包弄到新电脑来就显示核心意外终止,让看核心日志,不知道怎么弄 HOT 8
- 是否支持ios客户端
- 想自己开发编译有什么指南么? HOT 9
- Bug Report: /usr/bin/gsettings: /tmp/.mount_Qv2rayCQfIcM/usr/lib/libselinux.so.1: no version information available (required by /lib/x86_64-linux-gnu/libgio-2.0.so.0)
- Exec format error: Unable to run appimage files on ubutu 16.04 and lubuntu 18Bug Report: HOT 1
- Bug Report: QvPlugin-SSR插件导致崩溃
- Bug Report: qv2ray用lto编译崩溃
- @RichardPeng0624 杀一下残留进程即可:怎么杀呀 HOT 1
- Bug Report: open telegram but no ping in terminal for api.telegram.com HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qv2ray.