manager

Crates.iomanager
lib.rsmanager
version0.1.1
sourcesrc
created_at2020-07-17 02:12:05.626369
updated_at2020-07-17 02:20:10.682365
descriptionArtifice Management crate
homepage
repositoryhttps://github.com/artifice-network/manager
max_upload_size
id266102
size89,423
(artifice-network)

documentation

README

Artifice Manager

Purpose

This crate provides centralized functionalities for artifice such as permissions requesting/granting as well as configuration retrieval and upkeep. The reason for having a seperate crate for thse functionalities that may only end up being used once or twice is to provide extensibility of the artifice api by exposing dynamic secure configurability

Using the library

In order to use the tools of the artifice network the network must first be installed. In order to do this see

Example Usage

Authenticate Peer

use manager::{ArtificeDB, Manager};
use manager::database::Database;
use networking::peers::ArtificePeer;
use networking::ArtificeHost;
fn main(){
    let database = ArtificeDB::default();
    let manager = Manager::load(database, b"example password").unwrap();
    let host = ArtificeHost::from_host_data(manager.config()).unwrap();
    for netstream in host {
        let stream = netstream.unwrap();
        if manager.authenticate(stream.peer()).unwrap() {
            println!("peer authenticated");
        }
    }
}

Connect

use manager::{ArtificeDB, Manager};
use manager::database::Database;
use networking::peers::ArtificePeer;
use networking::ArtificeHost;

fn main(){
    let database = ArtificeDB::default();
    let manager = Manager::load(database, b"example_password").unwrap();
    let host = ArtificeHost::from_host_data(manager.config()).unwrap();
    let peer = manager.get_peer("global_peer_hash").unwrap();
    let host = ArtificeHost::from_host_data(manager.config()).unwrap();
    let stream = host.connect(peer).unwrap();
}
Commit count: 4

cargo fmt