You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use async_ftp::FtpStream;use std::convert::TryFrom;use tokio_rustls::rustls::{ClientConfig,RootCertStore,ServerName};#[tokio::main]asyncfnmain(){let ftp_stream = FtpStream::connect("lettir.orangewebsite.com:21").await.unwrap();letmut root_store = RootCertStore::empty();// root_store.add_pem_file(...);let conf = ClientConfig::builder().with_safe_defaults().with_root_certificates(root_store).with_no_client_auth();let domain = ServerName::try_from("lettir.orangewebsite.com").expect("invalid DNS name");// Switch to the secure modeletmut ftp_stream = ftp_stream.into_secure(conf, domain).await.unwrap();
ftp_stream.login("anonymous","anonymous").await.unwrap();// Do other secret stuff// Switch back to the insecure mode (if required)letmut ftp_stream = ftp_stream.into_insecure().await.unwrap();// Do all public stufflet _ = ftp_stream.quit().await;}
gives:
error[E0308]: arguments to this function are incorrect
--> src/main.rs:20:37
|
20 | let mut ftp_stream = ftp_stream.into_secure(conf, domain).await.unwrap();
| ^^^^^^^^^^^ ---- ------ expected enum `rustls::client::client_conn::ServerName`, found enum `tokio_rustls::rustls::ServerName`
| |
| expected struct `rustls::client::client_conn::ClientConfig`, found struct `ClientConfig`
|
= note: perhaps two different versions of crate `rustls` are being used?
= note: perhaps two different versions of crate `rustls` are being used?
note: associated function defined here
--> /home/mgh/.cargo/registry/src/github.com-1ecc6299db9ec823/async_ftp-6.0.0/src/ftp.rs:87:18
|
87 | pub async fn into_secure(mut self, config: ClientConfig, domain: ServerName) -> Result<FtpStream> {
| ^^^^^^^^^^^
The text was updated successfully, but these errors were encountered:
Example:
gives:
The text was updated successfully, but these errors were encountered: