Skip to content

Commit 527c73c

Browse files
committed
Move stuff around and minimize dependencies
1 parent f992752 commit 527c73c

File tree

19 files changed

+423
-272
lines changed

19 files changed

+423
-272
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
target/
22
*iroh-data
3-
*/.sendme*
3+
*/.sendme*
4+
5+
# Added by cargo
6+
7+
/target

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "iroh-examples"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]

iroh-mainline-content-discovery/Cargo.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,25 @@
1-
[package]
2-
name = "iroh-mainline-content-discovery"
3-
version = "0.3.0"
4-
edition = "2021"
5-
description = "Content discovery for iroh, using the bittorrent mainline DHT"
6-
license = "MIT OR Apache-2.0"
1+
[workspace]
2+
members = [
3+
"iroh-mainline-content-discovery",
4+
"iroh-mainline-tracker",
5+
]
6+
resolver = "2"
77

8-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8+
[profile.release]
9+
debug = true
910

10-
[dependencies]
11-
anyhow = { version = "1", features = ["backtrace"] }
12-
bao-tree = { version = "0.9.1", features = ["tokio_fsm"], default-features = false, optional = true }
13-
bytes = "1"
14-
clap = { version = "4", features = ["derive"], optional = true }
15-
derive_more = { version = "1.0.0-beta.1", features = ["debug", "display", "from", "try_into"] }
16-
dirs-next = "2"
17-
ed25519-dalek = "2.1.0"
18-
futures = "0.3.25"
19-
hex = "0.4.3"
20-
humantime = "2.1.0"
21-
iroh-net = "0.12.0"
22-
iroh-bytes = "0.12.0"
23-
iroh-pkarr-node-discovery = { path = "../iroh-pkarr-node-discovery" }
24-
mainline = "1.0.0"
25-
pkarr = { version = "1.0.1", features = ["async"] }
26-
postcard = { version = "1", default-features = false, features = ["alloc", "use-std", "experimental-derive"] }
27-
quinn = "0.10"
28-
rand = "0.8"
29-
rcgen = "0.12.0"
30-
redb = "1.5.0"
31-
rustls = "0.21"
32-
serde = { version = "1", features = ["derive"] }
33-
serde_json = "1.0.107"
34-
simple-mdns = { version = "0.5.0", features = ["async-tokio"] }
35-
tempfile = "3.4"
36-
tokio = { version = "1", features = ["io-util", "rt"] }
37-
tokio-util = { version = "0.7", features = ["io-util", "io", "rt"] }
38-
toml = "0.7.3"
39-
tracing = "0.1"
40-
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
41-
ttl_cache = "0.5.1"
42-
url = "2.5.0"
43-
flume = "0.11.0"
44-
genawaiter = { version = "0.99.1", features = ["futures03"] }
11+
[profile.optimized-release]
12+
inherits = 'release'
13+
debug = false
14+
lto = true
15+
debug-assertions = false
16+
opt-level = 3
17+
panic = 'abort'
18+
incremental = false
4519

46-
[features]
47-
cli = ["clap", "tracker"]
48-
tracker = ["bao-tree"]
49-
default = ["cli"]
5020

51-
[[bin]]
52-
name = "iroh-mainline-content-discovery"
53-
required-features = ["cli"]
21+
[workspace.lints.rust]
22+
missing_debug_implementations = "warn"
23+
24+
[workspace.lints.clippy]
25+
unused-async = "warn"

iroh-mainline-content-discovery/README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
# Iroh content tracker
1+
# Iroh content discovery
22

3-
This is an example how to write a simple service using mostly iroh-net.
4-
The purpose of this service is to track providers of iroh content.
5-
6-
You can *announce* to a tracker that you believe some host has some content.
7-
The tracker will then periodically *verify* that the content is present.
8-
Finally, you can *query* a tracker for hosts for a content.
3+
This library provides global content discovery for iroh.
94

105
## Building from source
116

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[package]
2+
name = "iroh-mainline-content-discovery"
3+
version = "0.3.0"
4+
edition = "2021"
5+
description = "Content discovery for iroh, using the bittorrent mainline DHT"
6+
license = "MIT OR Apache-2.0"
7+
8+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
9+
10+
[dependencies]
11+
# Required features for the protocol types
12+
iroh-net = "0.12.0"
13+
iroh-bytes = "0.12.0"
14+
serde = { version = "1", features = ["derive"] }
15+
16+
# Optional features for the client
17+
tracing = { version = "0.1", optional = true }
18+
quinn = { version = "0.10", optional = true }
19+
iroh-pkarr-node-discovery = { path = "../../iroh-pkarr-node-discovery", optional = true }
20+
mainline = { version = "1.0.0", optional = true }
21+
pkarr = { version = "1.0.1", features = ["async"], optional = true }
22+
anyhow = { version = "1", features = ["backtrace"], optional = true }
23+
postcard = { version = "1", default-features = false, features = ["alloc", "use-std"], optional = true }
24+
ed25519-dalek = { version = "2.1.0", optional = true }
25+
futures = { version = "0.3.25", optional = true }
26+
rcgen = { version = "0.12.0", optional = true }
27+
rustls = { version = "0.21", optional = true }
28+
genawaiter = { version = "0.99.1", features = ["futures03"], optional = true }
29+
30+
# Optional features for the cli
31+
clap = { version = "4", features = ["derive"], optional = true }
32+
tempfile = { version = "3.4", optional = true }
33+
derive_more = { version = "1.0.0-beta.1", features = ["debug", "display", "from", "try_into"], optional = true }
34+
tracing-subscriber = { version = "0.3", features = ["env-filter"], optional = true }
35+
tokio = { version = "1", features = ["io-util", "rt"], optional = true }
36+
37+
[features]
38+
client = ["iroh-pkarr-node-discovery", "mainline", "pkarr", "quinn", "tracing", "anyhow", "rcgen", "genawaiter", "rustls", "futures", "postcard"]
39+
cli = ["client", "clap", "tempfile", "derive_more", "tracing-subscriber", "tokio"]
40+
default = []
41+
42+
[[bin]]
43+
name = "iroh-mainline-content-discovery"
44+
required-features = ["cli"]

iroh-mainline-content-discovery/src/args.rs renamed to iroh-mainline-content-discovery/iroh-mainline-content-discovery/src/args.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,10 @@ pub struct Args {
1313

1414
#[derive(Subcommand, Debug)]
1515
pub enum Commands {
16-
Server(ServerArgs),
1716
Announce(AnnounceArgs),
1817
Query(QueryArgs),
1918
}
2019

21-
#[derive(Parser, Debug)]
22-
pub struct ServerArgs {
23-
/// The port to listen on.
24-
#[clap(long, default_value_t = 0xacacu16)]
25-
pub magic_port: u16,
26-
27-
/// The quinn port to listen on.
28-
#[clap(long, default_value_t = 0xbcbcu16)]
29-
pub quinn_port: u16,
30-
31-
#[clap(long)]
32-
pub quiet: bool,
33-
}
34-
3520
/// Various ways to specify content.
3621
#[derive(Debug, Clone, derive_more::From)]
3722
pub enum ContentArg {

0 commit comments

Comments
 (0)