#proxy #bare #server #websocket #tomphttp #tomp-http

bin+lib bare_server_rs

使用 Rust 编写的 TompHTTP 裸服务器 V1

1 个不稳定版本

0.1.0 2023 年 3 月 9 日

#6#bare

AGPL-3.0

23KB
528

Rust 编写的裸服务器

Rust 中实现了TompHTTP 裸服务器 V1 规范

这是一个高度正在进行中的项目,并不完全工作。简单的 HTTP 请求基本可行。基本的紫外线前端可以使用简单的 HTTP 和一些 HTTPS 网站工作。还需要进行更多调试,并开始 Web Socket API 的工作。具体来说,Google 和 duck duck go 无法工作,startpage 可以工作。

在 Actix 中程序化创建裸服务器

use actix_files as fs;
use actix_web::{web, App, HttpServer};

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(|| {
        App::new()
            .service(web::scope("/bare").configure(bare_server_rs::configure))
            .service(
                fs::Files::new("/", "./static/")
                    .prefer_utf8(true)
                    .index_file("index.html"),
            )
    })
    .bind(("0.0.0.0", 8080))?
    .run()
    .await
}

使用 CLI

bare-server-rs

这将启动一个在端口 8080 上运行的裸服务器,从 ./static/ 服务器静态文件,并在 ./bare 上运行裸服务器。

待办事项

  • 修复/调试某些网站的代理请求。
  • 实现 Web Socket 路由。

依赖关系

~26–38MB
~795K SLoC