12 releases
Uses new Rust 2024
new 0.5.3 | May 6, 2025 |
---|---|
0.5.2 | May 6, 2025 |
0.4.2 | May 6, 2025 |
0.3.0 | May 6, 2025 |
#540 in Procedural macros
81 downloads per month
7KB
138 lines
Satex
一个轻量级、高性能的HTTP网关,使用Rust语言开发,项目灵感来自于Spring Cloud Gateway
。
NOTICE(🫡): v0.3版本将以前的代码完全重构,有一些v0.2的功能暂时还未完全实现,目前也在积极开发中。
初衷
因为学习Rust有一段时间了,但是平时上主要用的是Java,刚好最近维护的公司的网关(基于Spring Cloud Gateway
)
有些性能问题,想着能不能使用Rust来开发一个和Spring Cloud Gateway
差不多的网关。
然后就开发了这个项目。所以如果熟悉Spring Cloud Gateway
,配置文件应该看着会比较熟悉。秉承能复用社区生态绝不重复造轮子,
所以项目中使用了大量开源的组件,比如actix-net
、rustls
、hyper
等。(不得不说,rust的生态真不错!😍)
特性
- 异步IO
- thread-per-core线程模型
- TLS支持
- 动态路由
- 丰富的路由组件以及灵活的路由配置
- 兼容tower和tower-http的生态,包括中间件、服务和工具等。
实现
组件 | 实现 |
---|---|
异步运行时 | tokio |
网络 | actix-net |
TLS | rustls |
HTTP协议 | hyper |
中间件 | tower tower-http |
运行
# 使用当前目录的satex.yaml文件
cargo run
# 指定配置文件路径
cargo run -- -c ./satex.yaml
# 访问静态文件
curl 127.0.0.1:3000/satex.yaml
文档
License
This project is licensed under the MIT license.
Dependencies
~195–630KB
~15K SLoC