Skip to content

Commit 8ab19fe

Browse files
authored
Merge pull request #15 from n0-computer/import-exapmles
examples: import examples from main repo
2 parents cdcb863 + 3b1029f commit 8ab19fe

9 files changed

+1534
-116
lines changed

Cargo.lock

+368-38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+55-8
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,22 @@ rust-version = "1.76"
1515
[dependencies]
1616
anyhow = { version = "1" }
1717
async-channel = "2.3.1"
18-
bao-tree = { version = "0.13", features = ["tokio_fsm", "validate"], default-features = false }
18+
bao-tree = { version = "0.13", features = [
19+
"tokio_fsm",
20+
"validate",
21+
], default-features = false }
1922
bytes = { version = "1.7", features = ["serde"] }
2023
chrono = "0.4.31"
2124
clap = { version = "4.5.20", features = ["derive"], optional = true }
22-
console = { version = "0.15.8", optional = true }
23-
derive_more = { version = "1.0.0", features = ["debug", "display", "deref", "deref_mut", "from", "try_into", "into"] }
25+
derive_more = { version = "1.0.0", features = [
26+
"debug",
27+
"display",
28+
"deref",
29+
"deref_mut",
30+
"from",
31+
"try_into",
32+
"into",
33+
] }
2434
futures-buffered = "0.2.4"
2535
futures-lite = "2.3"
2636
futures-util = { version = "0.3.30", optional = true }
@@ -38,14 +48,18 @@ num_cpus = "1.15.0"
3848
oneshot = "0.1.8"
3949
parking_lot = { version = "0.12.1", optional = true }
4050
portable-atomic = { version = "1", optional = true }
41-
postcard = { version = "1", default-features = false, features = ["alloc", "use-std", "experimental-derive"] }
51+
postcard = { version = "1", default-features = false, features = [
52+
"alloc",
53+
"use-std",
54+
"experimental-derive",
55+
] }
4256
quic-rpc = { version = "0.15.1", optional = true }
4357
quic-rpc-derive = { version = "0.15.0", optional = true }
4458
quinn = { package = "iroh-quinn", version = "0.12", features = ["ring"] }
4559
rand = "0.8"
4660
range-collections = "0.4.0"
4761
redb = { version = "2.2.0", optional = true }
48-
redb_v1 = { package = "redb", version = "1.5.1", optional = true }
62+
redb_v1 = { package = "redb", version = "1.5.1", optional = true }
4963
ref-cast = { version = "1.0.23", optional = true }
5064
reflink-copy = { version = "0.1.8", optional = true }
5165
self_cell = "1.0.1"
@@ -61,9 +75,14 @@ tracing = "0.1"
6175
tracing-futures = "0.2.5"
6276
walkdir = { version = "2.5.0", optional = true }
6377

78+
# Examples
79+
iroh = { version = "0.28", optional = true }
80+
console = { version = "0.15.8", optional = true }
81+
6482
[dev-dependencies]
6583
http-body = "1.0"
6684
iroh-test = { version = "0.28" }
85+
iroh-net = { version = "0.28", features = ["test-utils"] }
6786
futures-buffered = "0.2.4"
6887
proptest = "1.0.0"
6988
serde_json = "1.0.107"
@@ -78,14 +97,26 @@ futures-util = "0.3.30"
7897
testdir = "0.9.1"
7998

8099
[features]
81-
default = ["fs-store", "rpc", "net_protocol"]
100+
default = ["fs-store", "rpc", "net_protocol", "example-iroh"]
82101
downloader = ["dep:parking_lot", "tokio-util/time", "dep:hashlink"]
83102
net_protocol = ["downloader"]
84103
fs-store = ["dep:reflink-copy", "redb", "dep:redb_v1", "dep:tempfile"]
85104
metrics = ["iroh-metrics/metrics"]
86105
redb = ["dep:redb"]
87106
cli = ["rpc", "dep:clap", "dep:indicatif", "dep:console"]
88-
rpc = ["dep:quic-rpc", "dep:quic-rpc-derive", "dep:nested_enum_utils", "dep:strum", "dep:futures-util", "dep:ref-cast", "dep:portable-atomic", "dep:walkdir", "downloader"]
107+
rpc = [
108+
"dep:quic-rpc",
109+
"dep:quic-rpc-derive",
110+
"dep:nested_enum_utils",
111+
"dep:strum",
112+
"dep:futures-util",
113+
"dep:ref-cast",
114+
"dep:portable-atomic",
115+
"dep:walkdir",
116+
"downloader",
117+
]
118+
119+
example-iroh = ["dep:iroh", "dep:clap", "dep:indicatif", "dep:console"]
89120

90121
[package.metadata.docs.rs]
91122
all-features = true
@@ -100,6 +131,22 @@ name = "fetch-fsm"
100131
[[example]]
101132
name = "fetch-stream"
102133

134+
[[example]]
135+
name = "hello-world-fetch"
136+
required-features = ["example-iroh"]
137+
138+
[[example]]
139+
name = "hello-world-provide"
140+
required-features = ["example-iroh"]
141+
142+
[[example]]
143+
name = "local-swarm-discovery"
144+
required-features = ["example-iroh"]
145+
146+
[[example]]
147+
name = "custom-protocol"
148+
required-features = ["example-iroh"]
149+
103150
[lints.rust]
104151
missing_debug_implementations = "warn"
105152

@@ -134,4 +181,4 @@ iroh-router = { git = "https://github.com/n0-computer/iroh", branch = "main" }
134181
iroh-net = { git = "https://github.com/n0-computer/iroh", branch = "main" }
135182
iroh-metrics = { git = "https://github.com/n0-computer/iroh", branch = "main" }
136183
iroh-base = { git = "https://github.com/n0-computer/iroh", branch = "main" }
137-
184+
iroh = { git = "https://github.com/n0-computer/iroh", branch = "main" }

0 commit comments

Comments
 (0)