xmr-btc-swap/tokio-tar
rishflab 51c16f23d8
Download and run monero wallet rpc on swap cli startup
If the monero wallet rpc has not already been downloaded we download the monero cli package and extract the wallet rpc. The unneeded files are cleaned up. The monero wallet rpc is started on a random port which is provided to the swap cli.

We added a fork of tokio-tar via a git subtree because we needed a tokio-tar version that was compatible with tokio 1.0. Remove this subtree in favor of a regular cargo dependency when this PR merges: https://github.com/vorot93/tokio-tar/pull/3.
2021-02-25 11:21:41 +11:00
..
.github/workflows Merge commit 'fec26926a83de45ff0ec6870608b9828d20fdc8d' as 'tokio-tar' 2021-02-25 11:20:47 +11:00
examples Merge commit 'fec26926a83de45ff0ec6870608b9828d20fdc8d' as 'tokio-tar' 2021-02-25 11:20:47 +11:00
src Download and run monero wallet rpc on swap cli startup 2021-02-25 11:21:41 +11:00
tests Download and run monero wallet rpc on swap cli startup 2021-02-25 11:21:41 +11:00
.gitignore Merge commit 'fec26926a83de45ff0ec6870608b9828d20fdc8d' as 'tokio-tar' 2021-02-25 11:20:47 +11:00
Cargo.toml Merge commit 'fec26926a83de45ff0ec6870608b9828d20fdc8d' as 'tokio-tar' 2021-02-25 11:20:47 +11:00
LICENSE-APACHE Merge commit 'fec26926a83de45ff0ec6870608b9828d20fdc8d' as 'tokio-tar' 2021-02-25 11:20:47 +11:00
LICENSE-MIT Merge commit 'fec26926a83de45ff0ec6870608b9828d20fdc8d' as 'tokio-tar' 2021-02-25 11:20:47 +11:00
README.md Merge commit 'fec26926a83de45ff0ec6870608b9828d20fdc8d' as 'tokio-tar' 2021-02-25 11:20:47 +11:00

tokio-tar

A tar archive reading/writing library for async Rust.


Based on the great tar-rs.

Reading an archive

use tokio::io::stdin;
use tokio::prelude::*;

use tokio_tar::Archive;

fn main() {
    tokio::runtime::Runtime::new().unwrap().block_on(async {
        let mut ar = Archive::new(stdin());
        let mut entries = ar.entries().unwrap();
        while let Some(file) = entries.next().await {
            let f = file.unwrap();
            println!("{}", f.path().unwrap().display());
        }
    });
}

Writing an archive

use tokio::fs::File;
use tokio_tar::Builder;

fn main() {
    tokio::runtime::Runtime::new().unwrap().block_on(async {
        let file = File::create("foo.tar").await.unwrap();
        let mut a = Builder::new(file);

        a.append_path("README.md").await.unwrap();
        a.append_file("lib.rs", &mut File::open("src/lib.rs").await.unwrap())
            .await
            .unwrap();
    });
}

License

This project is licensed under either of

at your option.

Contribution

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