Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/azriel91/ssh_jumper
Async SSH tunnel through a jump host.
https://github.com/azriel91/ssh_jumper
Last synced: 2 months ago
JSON representation
Async SSH tunnel through a jump host.
- Host: GitHub
- URL: https://github.com/azriel91/ssh_jumper
- Owner: azriel91
- License: apache-2.0
- Created: 2021-03-07T03:34:01.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-27T04:43:39.000Z (over 1 year ago)
- Last Synced: 2024-05-01T23:24:07.048Z (8 months ago)
- Language: Rust
- Size: 67.4 KB
- Stars: 11
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# 🌐💨 SSH Jumper
[![Crates.io](https://img.shields.io/crates/v/ssh_jumper.svg)](https://crates.io/crates/ssh_jumper)
[![docs.rs](https://img.shields.io/docsrs/ssh_jumper)](https://docs.rs/ssh_jumper)
[![CI](https://github.com/azriel91/ssh_jumper/workflows/CI/badge.svg)](https://github.com/azriel91/ssh_jumper/actions/workflows/ci.yml)
[![Coverage Status](https://codecov.io/gh/azriel91/ssh_jumper/branch/main/graph/badge.svg)](https://codecov.io/gh/azriel91/ssh_jumper)Async SSH tunnel through a jump host.
```rust
use std::borrow::Cow;
use ssh_jumper::{
model::{HostAddress, HostSocketParams, JumpHostAuthParams, SshTunnelParams},
SshJumper
};// Similar to running:
// ssh -i ~/.ssh/id_rsa -L 1234:target_host:8080 [email protected]
let (local_socket_addr, ssh_forwarder_end_rx) = {
let jump_host = HostAddress::HostName(Cow::Borrowed("bastion.com"));
let jump_host_auth_params = JumpHostAuthParams::new(
Cow::Borrowed("my_user"),
Cow::Borrowed(Path::new("~/.ssh/id_rsa")),
);
let target_socket = HostSocketParams {
address: HostAddress::HostName(Cow::Borrowed("target_host")),
port: 8080,
};
let ssh_params =
SshTunnelParams::new(jump_host, jump_host_auth_params, target_socket)
// Optional: OS will allocate a port if this is left out
.with_local_port(1234);SshJumper::open_tunnel(&ssh_params).await?
};// Now you can send traffic to `local_socket_addr`, and it will go to `target_host`.
```## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.