From 3f4cdef2481c0af207d88fe80bc5df6a4ce8eae7 Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Sun, 3 Apr 2022 19:58:51 -0400 Subject: [PATCH] Initial commit --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++++++++++++++++++++ .gitignore | 2 ++ Cargo.toml | 14 +++++++++++ README.md | 32 +++++++++++++++++++++++++ src/lib.rs | 8 +++++++ src/main.rs | 3 +++ 6 files changed, 109 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 README.md create mode 100644 src/lib.rs create mode 100644 src/main.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1d13049 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,50 @@ +name: CI + +on: + push: + branches: + - main + +jobs: + rust: + name: Build and Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + + - run: cargo build --all-features + + - run: cargo test + + rustfmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + components: rustfmt + + - run: cargo fmt -- --check + + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + components: clippy + + - run: cargo clippy diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96ef6c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..0457d0f --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "bore-cli" +version = "0.1.0" +edition = "2021" + +[[bin]] +name = "bore" +path = "src/main.rs" + +[dependencies] +clap = { version = "3.1.8", features = ["derive"] } +serde = { version = "1.0.136", features = ["derive"] } +serde_json = "1.0.79" +tokio = { version = "1.17.0", features = ["full"] } diff --git a/README.md b/README.md new file mode 100644 index 0000000..51c7ca0 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# bore + +A modern, simple TCP tunnel in Rust that exposes local ports to a self-hosted remote server, bypassing standard NAT connection firewalls. **That's all it does: no more, and no less.** + +```shell +# Step 1: Installation (requires Rust) +cargo install bore-cli + +# Step 2: On a remote server at example.com +bore proxy + +# Step 3: On your local machine +bore local 8000 --to example.com:9000 +``` + +This will expose your local port at `localhost:8000` to the public internet at `example.com:9000`. + +Inspired by [localtunnel](https://github.com/localtunnel/localtunnel) and [ngrok](https://ngrok.io/), except `bore` is intended to be a highly efficient, unopinionated tool for real production workloads that is simple to install and use, with no frills attached. + +## Detailed Usage + +TODO + +## Protocol + +There is an implicit _control port_ at `7835`, used for creating new connections on demand. This can be configured in the command-line options. + +## Acknowledgements + +Created by Eric Zhang ([@ekzhang1](https://twitter.com/ekzhang1)). Licensed under the [MIT license](LICENSE). + +The author would like to thank the contributors and maintainers of the [Tokio](https://tokio.rs/) project for making it possible to write ergonomic and efficient network services in Rust. diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..1b4a90c --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,8 @@ +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + let result = 2 + 2; + assert_eq!(result, 4); + } +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..b0c65a6 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("bore cli running"); +}