Skip to content

Commit

Permalink
feat: dynamically add/delete peers via HTTP rest call (#54)
Browse files Browse the repository at this point in the history
* feat: added initial support for dynamically managing peer list through HTTPD

* fix: wrong configuration in local nodes ipn test fixed.

* test: fixed typo in ext peer management tests and added testcase for ipn

* added ext. peer management tests to CI/CD
  • Loading branch information
gh0st42 authored Jan 4, 2024
1 parent 929bc4a commit 2351533
Show file tree
Hide file tree
Showing 14 changed files with 463 additions and 70 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/rust-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ jobs:

- name: Run local dtntrigger test
run: ./tests/local_trigger_test.sh

- name: Run external peer management (dtn) test
run: ./tests/ext_peer_management.sh

- name: Run external peer management (ipn) test
run: ./tests/ext_peer_management_ipn.sh

strategy:
matrix:
Expand Down
56 changes: 28 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 21 additions & 11 deletions core/dtn7/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "dtn7"
version = "0.19.0" # managed by release.sh
version = "0.19.0" # managed by release.sh
authors = ["Lars Baumgaertner <[email protected]>"]
description = "Rust delay-tolerant-networking daemon and CLI tools implementing Bundle Protocol Version 7 (RFC9171)"
edition = "2018"
license = "MIT OR Apache-2.0"
categories = ["command-line-utilities", "network-programming"]
repository = "https://github.com/dtn7/dtn7-rs"
repository = "https://github.com/dtn7/dtn7-rs"
keywords = ["peer2peer", "dtn"]
exclude = [".vscode/", ".travis.yml"]
readme = "README.md"
Expand All @@ -15,20 +15,30 @@ readme = "README.md"

default = []
tracing = ["console-subscriber"]
deadlock_detection = [ "parking_lot/deadlock_detection" ]
deadlock_detection = ["parking_lot/deadlock_detection"]

[dependencies]
bp7 = {version = "0.10.5", default-features = false }
dtn7-plus = {version = "0.7.0", default-features = false, features = ["client"] }
bp7 = { version = "0.10.6", default-features = false }
dtn7-plus = { version = "0.7.0", default-features = false, features = [
"client",
] }
d7sneakers = { version = "0.3.1", default-features = false }
serde = { version = "1.0", features = ["derive"] }
serde_cbor = "0.11"
serde_json = "1.0"
serde_bytes = "0.11"
url = "2.2.2"
rand = "0.8.3"
tokio = { version = "1.18.2", features = ["net", "rt-multi-thread", "macros", "time", "tracing"]}
console-subscriber = { version = "0.1.6", features = ["parking_lot"], optional = true }
tokio = { version = "1.18.2", features = [
"net",
"rt-multi-thread",
"macros",
"time",
"tracing",
] }
console-subscriber = { version = "0.1.6", features = [
"parking_lot",
], optional = true }
tokio-util = { version = "0.7.2", features = ["codec"] }
tokio-tungstenite = "0.17.2"
tokio-serde = { version = "0.8", features = ["json"] }
Expand All @@ -40,7 +50,7 @@ log = "0.4"
socket2 = "0.4.1"
bytes = "1.1.0"
clap = { version = "4.0.27", features = ["cargo", "derive"] }
config = {version = "0.13.0", default-features = false, features = ["toml"] }
config = { version = "0.13.0", default-features = false, features = ["toml"] }
lazy_static = "1.4.0"
anyhow = "1.0.70"
parking_lot = "0.12.0"
Expand All @@ -56,16 +66,16 @@ derive_more = "0.99.17"
axum = { version = "0.5.13", features = ["ws"] }
http = "0.2.7"
#tower = "0.4.8"
hyper = {version ="0.14.18", features = ["client"]}
hyper = { version = "0.14.18", features = ["client"] }
tungstenite = "0.17.3"
#measure_time = "0.7.0"
bitflags = "2.0.2"
num-derive = "0.3.3"
num-traits = "0.2.15"
thiserror = "1.0.31"
dtn7-codegen = { path = "../codegen", version = "0.1.0"}
dtn7-codegen = { path = "../codegen", version = "0.1.0" }
byteorder = "1.4.3"
reqwest = { version="0.11.13", default-features = false, features = ["json"] }
reqwest = { version = "0.11.13", default-features = false, features = ["json"] }
sha1 = "0.10.5"

[lib]
Expand Down
3 changes: 2 additions & 1 deletion core/dtn7/src/bin/dtnd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ Tag 255 takes 5 arguments and is interpreted as address. Usage: -S 255:'Samplest
.expect("Encountered an error while checking for the existence of discovery addresses");
if let Some(statics) = matches.get_many::<String>("staticpeer") {
for s in statics {
cfg.statics.push(dtn7::core::helpers::parse_peer_url(s));
cfg.statics
.push(dtn7::core::helpers::parse_peer_url(s).expect("Invalid static peer url"));
}
}

Expand Down
Loading

0 comments on commit 2351533

Please sign in to comment.