client/common: support new login screen
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::app::{Command, SharedState};
|
||||
use color_eyre::eyre::Error;
|
||||
use crate::app::{Command, ConnectTarget, SharedState};
|
||||
use color_eyre::eyre::{bail, Error};
|
||||
use futures_channel::mpsc::UnboundedReceiver;
|
||||
use mumble_protocol::control::ClientControlCodec;
|
||||
use std::net::ToSocketAddrs;
|
||||
@@ -70,7 +70,7 @@ impl ServerCertVerifier for NoCertificateVerification {
|
||||
|
||||
#[instrument]
|
||||
pub async fn network_connect(
|
||||
address: String,
|
||||
target: ConnectTarget,
|
||||
username: String,
|
||||
event_rx: &mut UnboundedReceiver<Command>,
|
||||
overrides: &ProxyOverrides,
|
||||
@@ -78,6 +78,13 @@ pub async fn network_connect(
|
||||
) -> Result<(), Error> {
|
||||
info!("connecting");
|
||||
|
||||
let (host, port) = match target {
|
||||
ConnectTarget::Direct { host, port } => (host, port),
|
||||
ConnectTarget::Proxy(_) => {
|
||||
bail!("desktop/mobile platform requires a direct host:port, not a proxy URL")
|
||||
}
|
||||
};
|
||||
|
||||
let config = ClientConfig::builder()
|
||||
.dangerous()
|
||||
.with_custom_certificate_verifier(Arc::new(NoCertificateVerification))
|
||||
@@ -85,15 +92,14 @@ pub async fn network_connect(
|
||||
|
||||
let connector = TlsConnector::from(Arc::new(config));
|
||||
|
||||
let addr = format!("{}:{}", address, 64738)
|
||||
let addr = (&*host, port)
|
||||
.to_socket_addrs()?
|
||||
.next()
|
||||
.unwrap();
|
||||
|
||||
let server_tcp = TcpStream::connect(addr).await?;
|
||||
let server_stream = connector
|
||||
//.connect("127.0.0.1".try_into()?, server_tcp)
|
||||
.connect(address.try_into()?, server_tcp)
|
||||
.connect(host.try_into()?, server_tcp)
|
||||
.await?;
|
||||
let (read_server, write_server) = tokio::io::split(server_stream);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user