nkconnor / ngrok

A minimal ngrok library for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NOTE: This crate name was taken over by the fine folks at ngrok. The docs below only apply to versions <=0.6. You can see their repository here: https://github.com/ngrok/ngrok-rs.

I am still continuing to use this repository and may add updates from time to time based on my own needs.

ngrok   Build Crate Docs

A minimal and concise ngrok wrapper for Rust. The library has many use cases, for example:

  • open public HTTP tunnels to your development server(s) for integrations tests
  • simplified networking and development on devices like a Raspberry Pi

TCP support, while not available, should be trivial to support.

This has been tested with Linux and we assume that it does not work on Windows (contributions welcome!).

Getting Started

[dependencies]
ngrok = "0.6.0"

Usage

use ngrok;

fn main() -> std::io::Result<()> {
    let tunnel = ngrok::builder()
        .https()
        .port(3030)
        .run()?;

    let public_url: url::Url = tunnel.public_url()?;

    println!("Tunnel is open at {:?}", public_url);

    Ok(())
}

This assumes that ngrok is on your path. To change this, use the .executable() method in the builder when creating your tunnel.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in ngrok by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

A minimal ngrok library for Rust


Languages

Language:Rust 100.0%