gix_protocol/fetch/
handshake.rs

1use gix_features::progress::Progress;
2use gix_transport::{client, Service};
3use maybe_async::maybe_async;
4
5use crate::{
6    credentials,
7    handshake::{Error, Outcome},
8};
9
10/// Perform a handshake with the server on the other side of `transport`, with `authenticate` being used if authentication
11/// turns out to be required. `extra_parameters` are the parameters `(name, optional value)` to add to the handshake,
12/// each time it is performed in case authentication is required.
13/// `progress` is used to inform about what's currently happening.
14#[allow(clippy::result_large_err)]
15#[maybe_async]
16pub async fn upload_pack<AuthFn, T>(
17    transport: T,
18    authenticate: AuthFn,
19    extra_parameters: Vec<(String, Option<String>)>,
20    progress: &mut impl Progress,
21) -> Result<Outcome, Error>
22where
23    AuthFn: FnMut(credentials::helper::Action) -> credentials::protocol::Result,
24    T: client::Transport,
25{
26    crate::handshake(transport, Service::UploadPack, authenticate, extra_parameters, progress).await
27}