stone-rhino/wge
GitHub: stone-rhino/wge
WGE是一款基于C++的高性能Web应用防火墙库,用于提升网络安全防护能力。
Stars: 100 | Forks: 6
# WGE
```
* 在现有项目中链接WGE
```
# 系统路径中安装的 WGE
target_link_libraries(your_target_name PRIVATE wge)
# 指定路径中安装的 WGE
target_link_libraries(your_target_name PRIVATE /specified/path/lib/libwge.a)
```
* 在现有项目中使用WGE
1. 在主线程中构建一个WGE引擎
```
Wge::Engine engine(spdlog::level::off);
```
2. 在主线程中加载规则
```
std::expected result = engine.loadFromFile(rule_file);
if (!result.has_value()) {
// Handle the error
std::cout << "Load rules error: " << result.error() << std::endl;
}
```
3. 在主线程中初始化引擎
```
engine.init();
```
4. 在工作线程中创建每个请求的事务
```
// Each request has its own transaction
Wge::TransactionPtr t = engine.makeTransaction();
```
5. 在工作线程中处理请求
```
// Process each transaction is following the flowing steps
// 1. Process the connection
t->processConnection(/*params*/);
// 2. Process the URI
t->processUri(/*params*/);
// 3. Process the request headers
t->processRequestHeaders(/*params*/);
// 4. Process the request body
t->processRequestBody(/*params*/);
// 5. Process the response headers
t->processResponseHeaders(/*params*/);
// 6. Process the response body
t->processResponseBody(/*params*/);
```
有关使用示例,请参阅[wge_benchmark](benchmarks/wge/main.cc)。
## 许可证
版权所有 (c) 2024-2026 Stone Rhino及贡献者。
WGE遵循MIT许可证分发。请参阅附带的[LICENSE](LICENSE)文件以获取详细信息。
## 文档
- 文档网站:[https://stone-rhino.github.io/wge](https://stone-rhino.github.io/wge/) 我们正在为WGE编写文档。在此期间,请参考`WGE-Connectors`项目中的源代码和示例,了解如何使用该库。
- [WGE-Connectors](https://github.com/stone-rhino/wge-connectors): 集成WGE与各种Web服务器和框架的连接器集合。
## 贡献
我们欢迎对WGE的贡献!如果您有任何想法、建议或错误报告,请打开GitHub上的问题或提交拉取请求。在贡献之前,请阅读我们的[CONTRIBUTING](CONTRIBUTING.md)指南。
## 联系
[Stone Rhino](https://www.srhino.com/)
标签:Bash脚本, C++, C++23, CRS, ModSecurity, SOC Prime, WAF, Web 应用防火墙, 开发工具, 开源, 性能优化, 性能测试, 数据擦除, 检测绕过, 系统架构, 网络安全, 软件性能, 防火墙库, 隐私保护, 集成