feat: add ratchet, streaming, SU3 reseed, and router floodfill
- Add ratchet/ with ECIES-X25519-AEAD-Ratchet (Proposal 144), Garlic cloves, and ECIES DatabaseLookup replies - Add streaming/ with Ed25519-signed I2P Streaming (SYN/ACK/NACK/CLOSE/RESET, retransmit, window) and Repliable/Raw Datagrams - Add common/su3.mbt to parse and verify reseed .su3 bundles - Add Elligator2 encoding in crypto/ and OfflineSignature support in LeaseSet2 (flags bit 0) - Router: NTCP2 peer pool, floodfill NetDB crawl, transit tunnel relay, and Garlic/Streaming bridge - cmd/router: add --peer-dir, --su3, --reseed, --floodfill, --no-clock-skew - cmd/client: add --dest for persistent destination keys - Mark Phase 6 complete in README and document the transport scope (NTCP2 only, no SSU2)
This commit is contained in:
1 parent
8eafa11b22
commit
ae72b00323
54 files changed
+9607
-704
No files matched your search
+35
-2
@@ -3,7 +3,9 @@ fn print_usage() -> Unit {
|
||||
println("moon-i2p SAMv3 client (native)")
|
||||
println("")
|
||||
println("Usage:")
|
||||
println(" moon-i2p [--sam <host:port>] <command> [args...]")
|
||||
println(
|
||||
" moon-i2p [--sam <host:port>] [--dest <priv-b64-or-file>] <command> [args...]",
|
||||
)
|
||||
println("")
|
||||
println("Commands:")
|
||||
println(
|
||||
@@ -26,6 +28,9 @@ fn print_usage() -> Unit {
|
||||
println(
|
||||
" --sam <host:port> SAMv3 bridge address (default: 127.0.0.1:7656)",
|
||||
)
|
||||
println(
|
||||
" --dest <priv-b64-or-file> Persistent private destination key (default: TRANSIENT)",
|
||||
)
|
||||
println(" -h, --help Show this help message")
|
||||
println("")
|
||||
println("Environment:")
|
||||
@@ -175,6 +180,22 @@ fn strip_prefix(s : String, prefix : String) -> String? {
|
||||
Some(buf.to_string())
|
||||
}
|
||||
|
||||
///|
|
||||
fn resolve_destination_arg(
|
||||
arg : String,
|
||||
) -> String raise @sam_client.SamClientError {
|
||||
if arg == "TRANSIENT" {
|
||||
return arg
|
||||
}
|
||||
if @sam_client.file_exists(arg) {
|
||||
return @sam_client.read_trimmed_text_file(arg)
|
||||
}
|
||||
if arg.length() >= 400 {
|
||||
return arg
|
||||
}
|
||||
@sam_client.read_trimmed_text_file(arg)
|
||||
}
|
||||
|
||||
///|
|
||||
fn run_cli() -> Unit raise @sam_client.SamClientError {
|
||||
let raw_args = @env.args()
|
||||
@@ -193,10 +214,22 @@ fn run_cli() -> Unit raise @sam_client.SamClientError {
|
||||
@env.exit(2)
|
||||
}
|
||||
config = config.with_address(raw_args[i])
|
||||
} else if arg == "--dest" {
|
||||
i += 1
|
||||
if i >= raw_args.length() {
|
||||
println("Error: missing value after --dest")
|
||||
@env.exit(2)
|
||||
}
|
||||
config = config.with_destination(resolve_destination_arg(raw_args[i]))
|
||||
} else {
|
||||
match strip_prefix(arg, "--sam=") {
|
||||
Some(addr) => config = config.with_address(addr)
|
||||
None => positional.push(arg)
|
||||
None =>
|
||||
match strip_prefix(arg, "--dest=") {
|
||||
Some(d) =>
|
||||
config = config.with_destination(resolve_destination_arg(d))
|
||||
None => positional.push(arg)
|
||||
}
|
||||
}
|
||||
}
|
||||
i += 1
|
||||
|
||||
+66
-6
@@ -44,7 +44,12 @@ fn main {
|
||||
let mut sam_port = 7656
|
||||
let mut ntcp2_host = "127.0.0.1"
|
||||
let mut ntcp2_port = 0
|
||||
let mut floodfill = false
|
||||
let mut check_clock_skew = true
|
||||
let peer_files : Array[String] = []
|
||||
let peer_dirs : Array[String] = []
|
||||
let su3_files : Array[String] = []
|
||||
let reseed_urls : Array[String] = []
|
||||
|
||||
let mut i = 1
|
||||
while i < args.length() {
|
||||
@@ -86,16 +91,44 @@ fn main {
|
||||
} else {
|
||||
i += 1
|
||||
}
|
||||
"--peer-dir" =>
|
||||
if i + 1 < args.length() {
|
||||
peer_dirs.push(args[i + 1])
|
||||
i += 2
|
||||
} else {
|
||||
i += 1
|
||||
}
|
||||
"--su3" =>
|
||||
if i + 1 < args.length() {
|
||||
su3_files.push(args[i + 1])
|
||||
i += 2
|
||||
} else {
|
||||
i += 1
|
||||
}
|
||||
"--reseed" =>
|
||||
if i + 1 < args.length() {
|
||||
reseed_urls.push(args[i + 1])
|
||||
i += 2
|
||||
} else {
|
||||
i += 1
|
||||
}
|
||||
"--floodfill" => {
|
||||
floodfill = true
|
||||
i += 1
|
||||
}
|
||||
"--no-clock-skew" => {
|
||||
check_clock_skew = false
|
||||
i += 1
|
||||
}
|
||||
_ => i += 1
|
||||
}
|
||||
}
|
||||
|
||||
let r = @i2p_router.Router::start({
|
||||
sam_host,
|
||||
sam_port,
|
||||
ntcp2_host,
|
||||
ntcp2_port,
|
||||
}) catch {
|
||||
let r = @i2p_router.Router::start(
|
||||
{ sam_host, sam_port, ntcp2_host, ntcp2_port, },
|
||||
floodfill~,
|
||||
check_clock_skew~,
|
||||
) catch {
|
||||
_ => {
|
||||
println("error: failed to start moon-i2p router")
|
||||
return
|
||||
@@ -109,6 +142,33 @@ fn main {
|
||||
}
|
||||
}
|
||||
}
|
||||
for pd in peer_dirs {
|
||||
let n = r.load_peer_dir(pd) catch {
|
||||
_ => {
|
||||
println("warning: failed to load peer dir \{pd}")
|
||||
continue
|
||||
}
|
||||
}
|
||||
println(" Loaded \{n} peer(s) from \{pd}")
|
||||
}
|
||||
for sf in su3_files {
|
||||
let n = r.load_reseed_su3_file(sf) catch {
|
||||
_ => {
|
||||
println("warning: failed to load reseed .su3 from \{sf}")
|
||||
continue
|
||||
}
|
||||
}
|
||||
println(" Imported \{n} peer(s) from \{sf}")
|
||||
}
|
||||
for url in reseed_urls {
|
||||
let n = r.reseed_from_url(url) catch {
|
||||
_ => {
|
||||
println("warning: reseed fetch failed for \{url}")
|
||||
continue
|
||||
}
|
||||
}
|
||||
println(" Reseeded \{n} peer(s) from \{url}")
|
||||
}
|
||||
println("moon-i2p router started (transient identity)")
|
||||
println(" Router Hash: \{r.router_hash().to_base64()}")
|
||||
println(" Router B32: \{r.router_hash().to_b32_address()}")
|
||||
|
||||
Reference in new issue
Block a user