Skip to content

A pluggable library for TDN, include permissioned & permissionless group algorithm.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

CympleTech/tdn_permission

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TDN-Permission

Multiple permissioned / permissionless libraries for TDN.

Use is simple

use tdn::prelude::start;
use tdn_permission::PermissionlessGroup;
use tdn_types::message::{GroupReceiveMessage, ReceiveMessage};

fn main() {
    smol::block_on(async {
        let mut group = PermissionlessGroup::default();
        let (_peer_addr, send, recv) = start().await.unwrap();

        while let Ok(message) = recv.recv().await {
            match message {
                ReceiveMessage::Group(GroupReceiveMessage::PeerJoin(peer, addr, data)) => {
                    group.join(peer, addr, data, send.clone()).await;
                }
                ReceiveMessage::Group(GroupReceiveMessage::PeerJoinResult(peer, is_ok, result)) => {
                    group.join_result(peer, is_ok, result);
                }
                ReceiveMessage::Group(GroupReceiveMessage::PeerLeave(peer)) => {
                    group.leave(&peer);
                }
                _ => {
                    println!("recv: {:?}", message);
                }
            }
        }
    });
}

Test Examples

  • Test Public: cargo run --example permissionless

  • Test CA permissioned: cargo run --example ca_permissioned

  • Test Vote Permissioned: cargo run --example vote_permissioned

Features

  • Permissionless (Public)
  • CA Permissioned (Trusted CA)
  • Vote Permissioned (Voting)

License

This project is licensed under either of

at your option.

About

A pluggable library for TDN, include permissioned & permissionless group algorithm.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages