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:
@@ -60,6 +60,22 @@ pub enum ConfigError {
|
||||
IncompatibleOptions,
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum ForwardError {
|
||||
#[error("invalid forward spec: {spec}")]
|
||||
InvalidSpec { spec: String },
|
||||
#[error("bind failed")]
|
||||
BindFailed {
|
||||
#[source]
|
||||
source: io::Error,
|
||||
},
|
||||
#[error("channel open failed")]
|
||||
ChannelOpenFailed {
|
||||
#[source]
|
||||
source: Box<dyn std::error::Error + Send + Sync>,
|
||||
},
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user