Skip to content

Commit

Permalink
Merge branch 'salvo-rs:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
shujaatak authored May 13, 2024
2 parents 1aac544 + 8494f49 commit e23eca8
Show file tree
Hide file tree
Showing 123 changed files with 1,957 additions and 917 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
run: cargo install cargo-hack

- name: check --feature-powerset
run: cargo hack check --feature-powerset --depth 1 -Z avoid-dev-deps --exclude-features server
run: cargo hack check --feature-powerset --depth 1 -Z avoid-dev-deps --exclude-features server --exclude-no-default-features

cover:
strategy:
Expand Down
49 changes: 25 additions & 24 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2"

[workspace.package]
version = "0.66.2"
version = "0.67.2"
authors = ["Chrislearn Young <[email protected]>"]
edition = "2021"
rust-version = "1.75"
Expand All @@ -19,24 +19,24 @@ license = "MIT OR Apache-2.0"
categories = ["web-programming::http-server", "web-programming::websocket", "network-programming", "asynchronous"]

[workspace.dependencies]
salvo_macros = { version = "0.66.2", path = "crates/macros", default-features = false }
salvo_core = { version = "0.66.2", path = "crates/core", default-features = false }
salvo_extra = { version = "0.66.2", path = "crates/extra", default-features = false }
salvo-compression = { version = "0.66.2", path = "crates/compression", default-features = false }
salvo-cache = { version = "0.66.2", path = "crates/cache", default-features = false }
salvo-cors = { version = "0.66.2", path = "crates/cors", default-features = false }
salvo-csrf = { version = "0.66.2", path = "crates/csrf", default-features = false }
salvo-flash = { version = "0.66.2", path = "crates/flash", default-features = false }
salvo-http3 = { version = "0.0.9", default-features = false }
salvo-jwt-auth = { version = "0.66.2", path = "crates/jwt-auth", default-features = false }
salvo-oapi = { version = "0.66.2", path = "./crates/oapi", default-features = false }
salvo-oapi-macros = { version = "0.66.2", path = "crates/oapi-macros", default-features = false }
salvo-otel = { version = "0.66.2", path = "crates/otel", default-features = false }
salvo-proxy = { version = "0.66.2", path = "crates/proxy", default-features = false }
salvo-rate-limiter = { version = "0.66.2", path = "crates/rate-limiter", default-features = false }
salvo-serde-util = { version = "0.66.2", path = "crates/serde-util", default-features = true }
salvo-serve-static = { version = "0.66.2", path = "crates/serve-static", default-features = false }
salvo-session = { version = "0.66.2", path = "crates/session", default-features = false }
salvo_macros = { version = "0.67.2", path = "crates/macros", default-features = false }
salvo_core = { version = "0.67.2", path = "crates/core", default-features = false }
salvo_extra = { version = "0.67.2", path = "crates/extra", default-features = false }
salvo-compression = { version = "0.67.2", path = "crates/compression", default-features = false }
salvo-cache = { version = "0.67.2", path = "crates/cache", default-features = false }
salvo-cors = { version = "0.67.2", path = "crates/cors", default-features = false }
salvo-csrf = { version = "0.67.2", path = "crates/csrf", default-features = false }
salvo-flash = { version = "0.67.2", path = "crates/flash", default-features = false }
salvo-http3 = { version = "0.1.0", default-features = false }
salvo-jwt-auth = { version = "0.67.2", path = "crates/jwt-auth", default-features = false }
salvo-oapi = { version = "0.67.2", path = "./crates/oapi", default-features = false }
salvo-oapi-macros = { version = "0.67.2", path = "crates/oapi-macros", default-features = false }
salvo-otel = { version = "0.67.2", path = "crates/otel", default-features = false }
salvo-proxy = { version = "0.67.2", path = "crates/proxy", default-features = false }
salvo-rate-limiter = { version = "0.67.2", path = "crates/rate-limiter", default-features = false }
salvo-serde-util = { version = "0.67.2", path = "crates/serde-util", default-features = true }
salvo-serve-static = { version = "0.67.2", path = "crates/serve-static", default-features = false }
salvo-session = { version = "0.67.2", path = "crates/session", default-features = false }

aead = "0.5"
aes-gcm = "0.10"
Expand Down Expand Up @@ -67,7 +67,7 @@ hmac = "0.12"
hex = "0.4"
hostname-validator = "1"
hyper = { version = "1", features = ["full"] }
hyper-rustls = "0.26"
hyper-rustls = { version = "0.27", default-features = false }
hyper-util = { version = "0.1.2", default-features = true }
indexmap = "2"
inventory = "0.3"
Expand All @@ -92,11 +92,12 @@ pin-project = "1"
proc-macro-crate = {version = ">= 2, <= 4"}
proc-macro-error = "1"
proc-macro2 = "1"
quinn = { version = "0.10", default-features = false }
quinn = { version = "0.11", default-features = false }
quote = "1"
rand = "0.8"
rcgen = "0.12"
rcgen = "0.13"
regex = "1"
reqwest = "0.12.1"
ring = "0.17"
rust_decimal = "1"
rustls = "0.23"
Expand All @@ -116,7 +117,7 @@ thiserror = "1"
time = "0.3"
tokio = "1"
tokio-native-tls = "0.3"
tokio-rustls = "0.25"
tokio-rustls = {version = "0.26", default-features = false }
tokio-openssl = "0.6"
tokio-stream = { version = "0.1", default-features = false }
tokio-tungstenite = { version = "0.21", default-features = false }
Expand All @@ -131,7 +132,7 @@ uuid = "1"
x509-parser = "0.16"

# Compress
brotli = { version = "3.3", default-features = false }
brotli = { version = "6.0", default-features = false }
flate2 = { version = "1.0", default-features = false }
zstd = { version = "0.13", default-features = false }

Expand Down
11 changes: 10 additions & 1 deletion ECOSYSTEM.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ If your project isn't listed here and you would like it to be, please feel free

- [Socketioxide](https://github.com/Totodore/socketioxide): A socket.io server implementation in Rust that integrates with the Tower ecosystem and the Tokio stack.
- [Websocket](https://gitee.com/hubert22/salvo-websocket): This crate is websocket tool for salvo.
- [SalvoRsTool](https://github.com/mdddj/SalvoRsTool): salvo Idea RustRover插件 快速生成dto router service模板代码

## Project showcase

- [AI00 RWKV Server](https://github.com/Ai00-X/ai00_server): AI00 RWKV Server is an inference API server based on the RWKV model..
- [Salvo Admin](https://github.com/lyqgit/salvo-admin): 基于salvo和Ruoyi-Vue3的rust快速开发框架.
- [Salvo Admin](https://github.com/feihua/salvo-admin): 基于salvo和rbatis的rbac权限管理系统.
- [Geospatial Web](https://gitlab.com/geospatialweb/rust-mvt-postgis): Rust REST API - Martin MVT Tile Server - PostGIS.
Expand All @@ -18,6 +20,13 @@ If your project isn't listed here and you would like it to be, please feel free
- [Pure Rust Instant Message(PRIM)](https://github.com/SuanCaiYv/prim): 使用纯Rust实现的即时通讯系统.
- [rblog](https://github.com/prabirshrestha/rblog): Blog engine written in rust.
- [myblog](https://github.com/driftluo/myblog): This is my personal blog.
- [opensound](https://github.com/opensound-org/opensound): Pro-Audio system engine, using `salvo` as the default HTTP server backend(专业音频系统引擎,使用`salvo`作为默认HTTP服务器后端).
- [static-api](https://github.com/josejachuf/static-api-rs): This is a simple application emulating a basic REST API.

## Tutorials
- [Rust Salvo零基础教程](https://www.bilibili.com/video/BV1FS421N71D/): Rust Salvo零基础入门教程.
- [Rust Salvo零基础教程](https://www.bilibili.com/video/BV1FS421N71D/): Rust Salvo零基础入门教程.
- [使用Tera和Salvo构建单词本](https://www.bilibili.com/video/BV1Kg411b75s): 使用Tera和Salvo构建一个简单的单词本Web应用.
- [is salvo really the simplest rust web framework?](https://www.youtube.com/watch?v=tf9x97eTcpk)
- [Salvo.rs - Un Framework sencillo de Backend creado en Rust](https://www.youtube.com/watch?v=HlVf4mE8V9s)
- [rust + dioxus maybe | rust, salvo, dioxus live view, sqlx](https://www.youtube.com/watch?v=_j9tNhWbp8g)
- [rust + dockerfile + fly | rust, salvo, dioxus live view, sqlx, docker, fly.io](https://www.youtube.com/watch?v=IuyQxpbxjb8)
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,14 @@ Salvo is an extremely simple and powerful Rust web backend framework. Only basic
- Support WebSocket, WebTransport;
- Support OpenAPI, generate OpenAPI data automatic;
- Support Acme, automatically get TLS certificate from [let's encrypt](https://letsencrypt.org/);
- Support Tower service and layer;
- Support Tower Service and Layer;

## ⚡️ Quick Start
You can view samples [here](https://github.com/salvo-rs/salvo/tree/main/examples), or view [official website](https://salvo.rs).

### 🛠️ Salvo CLI
Salvo CLI is a command-line tool that simplifies the creation of new Salvo projects, supporting templates for web APIs, websites, databases (including SQLite, PostgreSQL, and MySQL via SQLx, SeaORM, Diesel, Rbatis), and basic middleware.
You can use [salvo-cli](https://github.com/salvo-rs/salvo-cli) to create a new Salvo project:
#### install
```bash
cargo install salvo-cli
```
#### create a new salvo project
```bash
salvo new project_name
```
___

### Hello World with ACME and HTTP3

Easily implement a server that supports ACME to automatically obtain certificates and supports HTTP3.
**It only takes a few lines of code to implement a server that supports ACME to automatically obtain certificates and supports HTTP1, HTTP2, and HTTP3 protocols.**

```rust
use salvo::prelude::*;
Expand All @@ -80,8 +67,7 @@ async fn main() {
let mut router = Router::new().get(hello);
let listener = TcpListener::new("0.0.0.0:443")
.acme()
.cache_path("temp/letsencrypt")
.add_domain("test.salvo.rs")
.add_domain("test.salvo.rs") // Replace this domain name with your own.
.http01_challege(&mut router).quinn("0.0.0.0:443");
let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await;
Server::new(acceptor).serve(router).await;
Expand Down Expand Up @@ -278,6 +264,19 @@ async fn main() {
}
```

### 🛠️ Salvo CLI
Salvo CLI is a command-line tool that simplifies the creation of new Salvo projects, supporting templates for web APIs, websites, databases (including SQLite, PostgreSQL, and MySQL via SQLx, SeaORM, Diesel, Rbatis), and basic middleware.
You can use [salvo-cli](https://github.com/salvo-rs/salvo-cli) to create a new Salvo project:
#### install
```bash
cargo install salvo-cli
```
#### create a new salvo project
```bash
salvo new project_name
```
___

### More Examples

Your can find more examples in [examples](./examples/) folder. You can run these examples with the following command:
Expand Down
35 changes: 17 additions & 18 deletions README.osc.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,15 @@ Salvo(赛风) 是一个极其简单且功能强大的 Rust Web 后端框架. 仅
- 支持 WebSocket, WebTransport;
- 支持 OpenAPI;
- 支持 Acme, 自动从 [let's encrypt](https://letsencrypt.org/) 获取 TLS 证书.
- 支持 Tower serivcelayer.
- 支持 Tower SerivceLayer.

## ⚡️ 快速开始

你可以查看[实例代码](https://github.com/salvo-rs/salvo/tree/main/examples), 或者访问[官网](https://salvo.rs).

### 🛠️ Salvo CLI
Salvo CLI是一个命令行工具,可以简化创建新的Salvo项目的过程,支持Web API、网站、数据库(包括通过SQLx、SeaORM、Diesel、Rbatis支持的SQLite、PostgreSQL、MySQL)和基本的中间件的模板。
你可以使用 [salvo-cli](https://github.com/salvo-rs/salvo-cli) 来创建一个新的 Salvo 项目:
#### 安装
```bash
cargo install salvo-cli
```
#### 创建一个salvo项目
```bash
salvo new project_name
```
___

### Hello World with ACME and HTTP3
### 支持 ACME 自动获取证书和 HTTP3 的 Hello World

轻轻松松实现一个支持 ACME 自动获取证书的,支持 HTTP3 的服务器.
**只需要几行代码就可以实现一个同时支持 ACME 自动获取证书以及支持 HTTP1,HTTP2, HTTP3 协议的服务器.**

```rust
use salvo::prelude::*;
Expand All @@ -83,8 +70,7 @@ async fn main() {
let mut router = Router::new().get(hello);
let listener = TcpListener::new("0.0.0.0:443")
.acme()
.cache_path("temp/letsencrypt")
.add_domain("test.salvo.rs")
.add_domain("test.salvo.rs") // 用你自己的域名替换此域名.
.http01_challege(&mut router).quinn("0.0.0.0:443");
let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await;
Server::new(acceptor).serve(router).await;
Expand Down Expand Up @@ -285,6 +271,19 @@ async fn main() {
}
```

### 🛠️ Salvo CLI
Salvo CLI是一个命令行工具,可以简化创建新的Salvo项目的过程,支持Web API、网站、数据库(包括通过SQLx、SeaORM、Diesel、Rbatis支持的SQLite、PostgreSQL、MySQL)和基本的中间件的模板。
你可以使用 [salvo-cli](https://github.com/salvo-rs/salvo-cli) 来创建一个新的 Salvo 项目:
#### 安装
```bash
cargo install salvo-cli
```
#### 创建一个salvo项目
```bash
salvo new project_name
```
___

### 更多示例

您可以从 [examples](./examples/) 文件夹下查看更多示例代码, 您可以通过以下命令运行这些示例:
Expand Down
36 changes: 18 additions & 18 deletions README.zh-hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,15 @@ Salvo(赛风) 是一个极其简单且功能强大的 Rust Web 后端框架. 仅
- 支持 WebSocket, WebTransport;
- 支持 OpenAPI;
- 支持 Acme, 自动从 [let's encrypt](https://letsencrypt.org/) 获取 TLS 证书.
- 支持 Tower serivcelayer.
- 支持 Tower SerivceLayer.

## ⚡️ 快速开始

你可以查看[实例代码](https://github.com/salvo-rs/salvo/tree/main/examples), 或者访问[官网](https://salvo.rs).

### 🛠️ Salvo CLI
Salvo CLI是一个命令行工具,可以简化创建新的Salvo项目的过程,支持Web API、网站、数据库(包括通过SQLx、SeaORM、Diesel、Rbatis支持的SQLite、PostgreSQL、MySQL)和基本的中间件的模板。
你可以使用 [salvo-cli](https://github.com/salvo-rs/salvo-cli) 来创建一个新的 Salvo 项目:
#### 安装
```bash
cargo install salvo-cli
```
#### 创建一个salvo项目
```bash
salvo new project_name
```
___

### Hello World with ACME and HTTP3
### 支持 ACME 自动获取证书和 HTTP3 的 Hello World

轻轻松松实现一个支持 ACME 自动获取证书的,支持 HTTP3 的服务器.
**只需要几行代码就可以实现一个同时支持 ACME 自动获取证书以及支持 HTTP1,HTTP2, HTTP3 协议的服务器.**

```rust
use salvo::prelude::*;
Expand All @@ -83,8 +70,7 @@ async fn main() {
let mut router = Router::new().get(hello);
let listener = TcpListener::new("0.0.0.0:443")
.acme()
.cache_path("temp/letsencrypt")
.add_domain("test.salvo.rs")
.add_domain("test.salvo.rs") // 用你自己的域名替换此域名.
.http01_challege(&mut router).quinn("0.0.0.0:443");
let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await;
Server::new(acceptor).serve(router).await;
Expand Down Expand Up @@ -285,6 +271,20 @@ async fn main() {
}
```

### 🛠️ Salvo CLI
Salvo CLI是一个命令行工具,可以简化创建新的Salvo项目的过程,支持Web API、网站、数据库(包括通过SQLx、SeaORM、Diesel、Rbatis支持的SQLite、PostgreSQL、MySQL)和基本的中间件的模板。
你可以使用 [salvo-cli](https://github.com/salvo-rs/salvo-cli) 来创建一个新的 Salvo 项目:
#### 安装
```bash
cargo install salvo-cli
```
#### 创建一个salvo项目
```bash
salvo new project_name
```
___


### 更多示例

您可以从 [examples](./examples/) 文件夹下查看更多示例代码, 您可以通过以下命令运行这些示例:
Expand Down
35 changes: 18 additions & 17 deletions README.zh-hant.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,15 @@ Salvo(賽風) 是一個極其簡單且功能強大的 Rust Web 後端框架. 僅
- 支持 WebSocket, WebTransport;
- 支持 OpenAPI;
- 支持 Acme, 自動從 [let's encrypt](https://letsencrypt.org/) 獲取 TLS 證書.
- 支持 Tower serivcelayer.
- 支持 Tower SerivceLayer.

## ⚡️ 快速開始

你可以查看[實例代碼](https://github.com/salvo-rs/salvo/tree/main/examples), 或者訪問[官網](https://salvo.rs).
### 🛠️ Salvo CLI
Salvo CLI是一個命令行工具,可以簡化創建新的Salvo項目的過程,支援Web API、網站、資料庫(包括透過SQLx、SeaORM、Diesel、Rbatis支援的SQLite、PostgreSQL、MySQL)和基本的中介軟體的模板。
你可以使用 [salvo-cli](https://github.com/salvo-rs/salvo-cli) 来來創建一個新的 Salvo 項目:
#### 安裝
```bash
cargo install salvo-cli
```

#### 創建一個新的salvo項目
```bash
salvo new project_name
```
___
### Hello World with ACME and HTTP3
### 支持 ACME 自動獲取證書和 HTTP3 的 Hello World

輕輕鬆鬆實現一個支持 ACME 自動獲取證書的,支持 HTTP3 的服務器.
**隻需要幾行代碼就可以實現一個同時支持 ACME 自動獲取證書以及支持 HTTP1,HTTP2, HTTP3 協議的伺服器.**

```rust
use salvo::prelude::*;
Expand All @@ -82,8 +70,7 @@ async fn main() {
let mut router = Router::new().get(hello);
let listener = TcpListener::new("0.0.0.0:443")
.acme()
.cache_path("temp/letsencrypt")
.add_domain("test.salvo.rs")
.add_domain("test.salvo.rs") // 用你自己的域名替换此域名.
.http01_challege(&mut router).quinn("0.0.0.0:443");
let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await;
Server::new(acceptor).serve(router).await;
Expand Down Expand Up @@ -283,6 +270,20 @@ async fn main() {
}
```

### 🛠️ Salvo CLI
Salvo CLI是一個命令行工具,可以簡化創建新的Salvo項目的過程,支援Web API、網站、資料庫(包括透過SQLx、SeaORM、Diesel、Rbatis支援的SQLite、PostgreSQL、MySQL)和基本的中介軟體的模板。
你可以使用 [salvo-cli](https://github.com/salvo-rs/salvo-cli) 来來創建一個新的 Salvo 項目:
#### 安裝
```bash
cargo install salvo-cli
```

#### 創建一個新的salvo項目
```bash
salvo new project_name
```
___

### 更多示例

您可以從 [examples](./examples/) 文件夾下查看更多示例代碼, 您可以通過以下命令運行這些示例:
Expand Down
1 change: 1 addition & 0 deletions crates/compression/src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ pub(super) enum Encoder {
}

impl Encoder {
#[allow(unused_variables)]
pub(super) fn new(algo: CompressionAlgo, level: CompressionLevel) -> Self {
match algo {
#[cfg(feature = "brotli")]
Expand Down
Loading

0 comments on commit e23eca8

Please sign in to comment.