Skip to content

Commit dbfce09

Browse files
committed
feat: scaffold native ssh support
1 parent dc42107 commit dbfce09

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

gix-transport/src/client/async_io/connect.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ pub(crate) mod function {
4040
.map_err(|e| Box::new(e) as Box<dyn std::error::Error + Send + Sync>)?,
4141
)
4242
}
43+
gix_url::Scheme::Ssh => Box::new(
44+
crate::client::async_io::ssh::connect(url, options.version, options.trace)
45+
.await
46+
.map_err(|e| Box::new(e) as Box<dyn std::error::Error + Send + Sync>)?,
47+
),
4348
scheme => return Err(Error::UnsupportedScheme(scheme)),
4449
})
4550
}

gix-transport/src/client/async_io/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ pub use traits::{SetServiceResponse, Transport, TransportV2Ext};
1111
pub mod connect;
1212
#[cfg(feature = "async-std")]
1313
pub use connect::function::connect;
14+
15+
#[cfg(feature = "russh")]
16+
pub mod ssh;
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
use async_trait::async_trait;
2+
3+
use crate::{
4+
client::{SetServiceResponse, Transport, TransportWithoutIO},
5+
Protocol, Service,
6+
};
7+
8+
pub struct NativeSsh;
9+
10+
impl TransportWithoutIO for NativeSsh {
11+
fn request(
12+
&mut self,
13+
write_mode: crate::client::WriteMode,
14+
on_into_read: crate::client::MessageKind,
15+
trace: bool,
16+
) -> Result<super::RequestWriter<'_>, crate::client::Error> {
17+
todo!()
18+
}
19+
20+
fn to_url(&self) -> std::borrow::Cow<'_, bstr::BStr> {
21+
todo!()
22+
}
23+
24+
fn connection_persists_across_multiple_requests(&self) -> bool {
25+
todo!()
26+
}
27+
28+
fn configure(
29+
&mut self,
30+
config: &dyn std::any::Any,
31+
) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
32+
todo!()
33+
}
34+
}
35+
36+
#[async_trait(?Send)]
37+
impl Transport for NativeSsh {
38+
async fn handshake<'a>(
39+
&mut self,
40+
service: Service,
41+
extra_parameters: &'a [(&'a str, Option<&'a str>)],
42+
) -> Result<SetServiceResponse<'_>, crate::client::Error> {
43+
todo!()
44+
}
45+
}
46+
47+
pub async fn connect(
48+
url: gix_url::Url,
49+
desired_version: Protocol,
50+
trace: bool,
51+
) -> Result<NativeSsh, crate::client::Error> {
52+
todo!()
53+
}

0 commit comments

Comments
 (0)