#api #async

distant-core

Core library for distant, enabling operation on a remote computer through file and process manipulation

18 unstable releases (3 breaking)

0.16.4 Jun 7, 2022
0.16.3 May 30, 2022
0.15.1 Nov 16, 2021
0.15.0 Oct 16, 2021
0.13.1 Sep 9, 2021

#1176 in Network programming

Download history 44/week @ 2022-03-10 65/week @ 2022-03-17 21/week @ 2022-03-24 17/week @ 2022-03-31 27/week @ 2022-04-07 13/week @ 2022-04-14 12/week @ 2022-04-21 78/week @ 2022-04-28 90/week @ 2022-05-05 264/week @ 2022-05-12 99/week @ 2022-05-19 127/week @ 2022-05-26 194/week @ 2022-06-02 32/week @ 2022-06-09 38/week @ 2022-06-16 25/week @ 2022-06-23

315 downloads per month
Used in 3 crates

MIT/Apache

470KB
11K SLoC

distant core

Crates.io Docs.rs Rustc 1.51.0

Library that powers the distant binary.

🚧 (Alpha stage software) This library is in rapid development and may break or change frequently! 🚧

Details

The distant library supplies a mixture of functionality and data to run servers that operate on remote machines and clients that talk to them.

Installation

You can import the dependency by adding the following to your Cargo.toml:

[dependencies]
distant-core = "0.16"

Features

Currently, the library supports the following features:

  • structopt: generates StructOpt bindings for RequestData (used by cli to expose request actions)

By default, no features are enabled on the library.

Examples

Below is an example of connecting to a distant server over TCP:

use distant_core::{Session, SessionChannelExt, SecretKey32, XChaCha20Poly1305Codec};
use std::net::SocketAddr;

// 32-byte secret key paresd from hex, used for a specific codec
let key: SecretKey32 = "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF".parse().unwrap();
let codec = XChaCha20Poly1305Codec::from(key);

let addr: SocketAddr = "example.com:8080".parse().unwrap();
let mut session = Session::tcp_connect(addr, codec).await.unwrap();

// Append text to a file, representing request as <tenant>
// NOTE: This method comes from SessionChannelExt
session.append_file_text(
    "<tenant>", 
    "path/to/file.txt".to_string(), 
    "new contents"
).await.expect("Failed to append to file");

License

This project is licensed under either of

Apache License, Version 2.0, (LICENSE-APACHE or apache-license) MIT license (LICENSE-MIT or mit-license) at your option.

Dependencies

~7–13MB
~233K SLoC