rapiz1 / rathole

A lightweight and high-performance reverse proxy for NAT traversal, written in Rust. An alternative to frp and ngrok.
Apache License 2.0
8.8k stars 440 forks source link

It is neccesary to add another API to the crate that allows it to be used as a library. #325

Open GitNiko opened 5 months ago

GitNiko commented 5 months ago

Feature Proposed

The current exposed interface is only pub async fn run(args: Cli, shutdown_rx: Receiver<bool>) -> Result<()>, I must specify a configuration file path to start the service. If I could directly pass a Config object, it will be more convenient to use.
By the way, this is also more friendly to the FFI scenario. I am trying to use this crate on Android through JNI, and currently I have to modify the source code to make it work.

Use Case

Maybe you can add an interface like this:

pub async fn run_with_config(config_str: String) -> Result<()>