Implement NAPI connect() function — single SSH channel as duplex stream

- Add WraithConnectOptions struct with napi fields: server, peer, transport,
  identity (string path or Buffer), tlsServerName, insecure, irohRelay, proxy
- Add WraithStream napi class wrapping SSH channel read/write halves via
  ChannelStream::into_stream() + tokio::io::split()
- Implement connect() async function: transport creation (tcp, tls), SSH client
  connection, authenticate, open direct_tcpip channel, return WraithStream
- Identity field accepts file path (string) or in-memory key data (Buffer)
- All Rust errors marshalled to JavaScript exceptions with descriptive messages
- Add ForwardError enum to wraith-core (required by forward.rs)
- Enable tls, iroh features on wraith-core dependency
- 7 unit tests for key source resolution and address parsing
This commit is contained in:
2026-06-02 11:10:42 +00:00
parent 992d478630
commit 243243a82f
5 changed files with 278 additions and 4 deletions

5
Cargo.lock generated
View File

@@ -2395,6 +2395,7 @@ version = "3.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1d395473824516f38dd1071a1a37bc57daa7be65b293ebba4ead5f7abb017a2"
dependencies = [
"anyhow",
"bitflags 2.11.1",
"ctor",
"futures",
@@ -2402,6 +2403,7 @@ dependencies = [
"napi-sys",
"nohash-hasher",
"rustc-hash",
"tokio",
]
[[package]]
@@ -5593,6 +5595,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"async-trait",
"futures",
"ipnetwork",
"iroh",
"rand 0.10.1",
@@ -5620,6 +5623,8 @@ version = "0.1.0"
dependencies = [
"napi",
"napi-derive",
"russh",
"tokio",
"wraith-core",
]