Skip to content

Commit

Permalink
feat!: introduce iroh-router crate (#2832)
Browse files Browse the repository at this point in the history
The general goal is to have a single place to deal with custom
protocols.

## Breaking Changes

- moved
  - `iroh::node::ProtocolHandler` -> `iroh::router::ProtocolHandler`

---------

Co-authored-by: Floris Bruynooghe <[email protected]>
  • Loading branch information
dignifiedquire and flub authored Oct 25, 2024
1 parent 67df1c1 commit 8f75005
Show file tree
Hide file tree
Showing 18 changed files with 751 additions and 210 deletions.
106 changes: 93 additions & 13 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
"iroh-test",
"iroh-net/bench",
"iroh-cli",
"iroh-router",
]
resolver = "2"

Expand Down Expand Up @@ -49,3 +50,4 @@ iroh-base = { path = "./iroh-base" }
iroh-net = { path = "./iroh-net" }
iroh-metrics = { path = "./iroh-metrics" }
iroh-test = { path = "./iroh-test" }
iroh-router = { path = "./iroh-router" }
37 changes: 37 additions & 0 deletions iroh-router/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "iroh-router"
version = "0.27.0"
edition = "2021"
readme = "README.md"
description = "protocol router support for iroh"
license = "MIT OR Apache-2.0"
authors = ["dignifiedquire <[email protected]>", "n0 team"]
repository = "https://github.com/n0-computer/iroh"
keywords = ["quic", "networking", "holepunching", "p2p"]


[dependencies]
anyhow = "1.0.91"
futures-buffered = "0.2.9"
futures-lite = "2.3.0"
futures-util = "0.3.31"
iroh-net = { version = "0.27.0", path = "../iroh-net" }
tokio = "1.41.0"
tokio-util = "0.7.12"
tracing = "0.1.40"

# Examples
clap = { version = "4", features = ["derive"], optional = true }
tracing-subscriber = { version = "0.3", features = ["env-filter"], optional = true }

[lints]
workspace = true


[features]
default = []
examples = ["dep:clap", "dep:tracing-subscriber"]

[[example]]
name = "custom-protocol"
required-features = ["examples"]
20 changes: 20 additions & 0 deletions iroh-router/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# iroh-router

This crate contains the definitions for custom protocols for `iroh`.

# License

This project is licensed under either of

* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT)

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.
Loading

0 comments on commit 8f75005

Please sign in to comment.