Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[alias]
lint = "clippy --features libssh,libssh2 -- -Dwarnings"
test-all = "test --features libssh,libssh2"
test-libssh = "test --no-default-features --features libssh"
test-libssh2 = "test --features libssh2"
31 changes: 0 additions & 31 deletions .github/workflows/linux.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: test

on: [push, pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
test:
name: Test (${{ matrix.features }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features: [libssh, libssh2]
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov

- name: Clippy
run: cargo clippy --features ${{ matrix.features }} -- -Dwarnings

- name: Run tests with coverage
run: cargo llvm-cov --no-fail-fast --features ${{ matrix.features }} --workspace --lcov --output-path lcov-${{ matrix.features }}.info

- name: Upload to Coveralls
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
file: lcov-${{ matrix.features }}.info

wait-for-coverage:
name: Wait for coverage
runs-on: ubuntu-latest
needs: test
steps:
- name: Wait for coveralls
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

- [Changelog](#changelog)
- [0.7.0](#070)
- [0.6.4](#064)
- [0.6.3](#063)
- [0.6.2](#062)
Expand All @@ -22,6 +23,19 @@

---

## 0.7.0

Released on 16/08/2025

- **BREAKING**: Support for multiple SSH backends:
- Added new feature to enable **libssh2** backend:
- Use `libssh2` feature to enable the backend
- Use `libssh2-vendored` to build the backend with vendored libssh2
- Added support for [libssh](https://www.libssh.org/) backend
- Use `libssh` feature to enable the backend
- Use `libssh-vendored` to build the backend with vendored libssh
- Removed `new`; use `libssh2` and `libssh` constructors instead.

## 0.6.4

Released on 15/08/2025
Expand Down
30 changes: 23 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,49 @@ license = "MIT"
name = "remotefs-ssh"
readme = "README.md"
repository = "https://github.com/remotefs-rs/remotefs-rs-ssh"
version = "0.6.4"
version = "0.7.0"
rust-version = "1.85.1"

[dependencies]
chrono = "^0.4"
lazy-regex = "3"
libssh-rs = { version = "0.3", optional = true }
log = "^0.4"
remotefs = "^0.3"
ssh2-config = "^0.6"
ssh2 = "^0.9"
ssh2 = { version = "^0.9", optional = true }

[dev-dependencies]
criterion = "0.7"
env_logger = "^0.11"
pretty_assertions = "^1"
rand = "^0.9"
tempfile = "^3"
testcontainers = { version = "0.25", features = ["blocking"] }

[features]
default = ["find"]
# misc
default = ["find", "libssh2"]
find = ["remotefs/find"]
libssh = ["dep:libssh-rs"]
libssh-vendored = ["libssh", "libssh-rs/vendored", "libssh-rs/vendored-openssl"]
libssh2 = ["dep:ssh2"]
libssh2-vendored = ["libssh2", "ssh2/vendored-openssl"]
no-log = ["log/max_level_off"]
ssh2-vendored = ["ssh2/vendored-openssl"]
# tests
github-actions = []

[target."cfg(target_os = \"windows\")"]
[target."cfg(target_os = \"windows\")".dependencies]
path-slash = "^0.2.1"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[[bench]]
name = "libssh2"
harness = false
required-features = ["libssh2"]

[[bench]]
name = "libssh"
harness = false
required-features = ["libssh"]
68 changes: 61 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

<p align="center">~ Remotefs SSH client ~</p>

<p align="center">Developed by <a href="https://veeso.github.io/" target="_blank">@veeso</a></p>
<p align="center">Current version: 0.6.4 (15/08/2025)</p>
<p align="center">Developed by <a href="https://veeso.me/" target="_blank">@veeso</a></p>
<p align="center">Current version: 0.7.0 (16/08/2025)</p>

<p align="center">
<a href="https://opensource.org/licenses/MIT"
Expand Down Expand Up @@ -41,9 +41,9 @@
/></a>
</p>
<p align="center">
<a href="https://github.com/remotefs-rs/remotefs-rs-ssh/actions"
<a href="https://github.com/remotefs-rs/remotefs-rs-ssh/actions/workflows/linux.yml"
><img
src="https://github.com/remotefs-rs/remotefs-rs-ssh/workflows/Linux/badge.svg"
src="https://github.com/remotefs-rs/remotefs-rs-ssh/actions/workflows/test.yml/badge.svg"
alt="Linux CI"
/></a>
<a href="https://coveralls.io/github/remotefs-rs/remotefs-rs-ssh"
Expand Down Expand Up @@ -72,14 +72,68 @@ First of all, add `remotefs-ssh` to your project dependencies:

```toml
remotefs = "0.3"
remotefs-ssh = "^0.6"
remotefs-ssh = "^0.7"
```

> ![NOTE]
> The library supports multiple ssh backends.
> Currently `libssh2` and `libssh` are supported.
>
> By default the library is using `libssh2`.

### Available backends

Each backend can be set as a feature in your `Cargo.toml`. Multiple backends can be enabled at the same time.

- `libssh`: An alternative backend, using the `libssh` library for SSH connections.
- `libssh2`: The default backend, using the `libssh2` library for SSH connections.

Each backend can be built with the vendored version, using the vendored feature instead:

- `libssh-vendored`: Build the `libssh` backend with the vendored version of the library.
- `libssh2-vendored`: Build the `libssh2` backend with the vendored version of the library.

If the vendored feature is **NOT** provided, you will need to have the corresponding system libraries installed on your machine.

> ![NOTE]
> If you need SftpFs to be `Sync` YOU MUST use libssh2.

### Other features

these features are supported:

- `find`: enable `find()` method on client (*enabled by default*)
- `no-log`: disable logging. By default, this library will log via the `log` crate.
- `ssh2-vendored`: build with static libssl

## Ssh client

Here is a basic usage example, with the `Sftp` client, which is very similiar to the `Scp` client.

Both the `SftpFs` and `ScpFs` constructors are respectively `SftpFs::libssh2` and `SftpFs::libssh` accordingly to the enabled backends.

```rust,ignore
// import remotefs trait and client
use remotefs::RemoteFs;
use remotefs_ssh::{SshConfigParseRule, SftpFs, SshOpts};
use std::path::Path;

let opts = SshOpts::new("127.0.0.1")
.port(22)
.username("test")
.password("password")
.config_file(Path::new("/home/cvisintin/.ssh/config"), ParseRule::STRICT);

let mut client = SftpFs::libssh2(opts);

// connect
assert!(client.connect().is_ok());
// get working directory
println!("Wrkdir: {}", client.pwd().ok().unwrap().display());
// change working directory
assert!(client.change_dir(Path::new("/tmp")).is_ok());
// disconnect
assert!(client.disconnect().is_ok());
```

---

Expand Down Expand Up @@ -137,7 +191,7 @@ Please follow [our contributing guidelines](CONTRIBUTING.md)

## Changelog ⏳

View remotefs' changelog [HERE](CHANGELOG.md)
View remotefs-ssh changelog [HERE](CHANGELOG.md)

---

Expand Down
Loading