salvo is working
This commit is contained in:
+3
-1
@@ -10,7 +10,7 @@ use mumble_protocol::voice::{VoicePacket, VoicePacketPayload};
|
|||||||
use mumble_protocol::Serverbound;
|
use mumble_protocol::Serverbound;
|
||||||
use mumble_web2_common::GuiConfig;
|
use mumble_web2_common::GuiConfig;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tracing::{debug, error, info};
|
use tracing::{debug, error, info, instrument};
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
use wasm_bindgen_futures::JsFuture;
|
use wasm_bindgen_futures::JsFuture;
|
||||||
use web_sys::js_sys::{Promise, Reflect, Uint8Array};
|
use web_sys::js_sys::{Promise, Reflect, Uint8Array};
|
||||||
@@ -324,6 +324,7 @@ async fn create_encoder_worklet(
|
|||||||
Ok(worklet_node)
|
Ok(worklet_node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument]
|
||||||
pub async fn network_connect(
|
pub async fn network_connect(
|
||||||
address: String,
|
address: String,
|
||||||
username: String,
|
username: String,
|
||||||
@@ -354,6 +355,7 @@ pub async fn network_connect(
|
|||||||
options.set_server_certificate_hashes(&array);
|
options.set_server_certificate_hashes(&array);
|
||||||
|
|
||||||
debug!("created WebTransportOptions");
|
debug!("created WebTransportOptions");
|
||||||
|
console::log_1(&options.clone().into());
|
||||||
|
|
||||||
let transport = WebTransport::new_with_options(&address, &options).ey()?;
|
let transport = WebTransport::new_with_options(&address, &options).ey()?;
|
||||||
debug!("created WebTransport connection object");
|
debug!("created WebTransport connection object");
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ http_listen_address = "127.0.0.1:8080"
|
|||||||
cert_path = "./cert.pem"
|
cert_path = "./cert.pem"
|
||||||
key_path = "./key.pem"
|
key_path = "./key.pem"
|
||||||
mumble_server_url = "voip.ohea.xyz:64738"
|
mumble_server_url = "voip.ohea.xyz:64738"
|
||||||
gui_path = "../target/dx/mumble-web2-gui/debug/web/public"
|
gui_path = "../target/dx/mumble-web2-gui/release/web/public"
|
||||||
|
|
||||||
[gui]
|
[gui]
|
||||||
force_proxy = true
|
force_proxy = true
|
||||||
proxy_url = "https://localhost:4433/proxy"
|
proxy_url = "https://127.0.0.1:4433/proxy"
|
||||||
# cert_hash = [...]
|
# cert_hash = [...]
|
||||||
|
|||||||
+14
-7
@@ -8,7 +8,7 @@ use salvo::proto::quic::BidiStream;
|
|||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::net::{SocketAddr, ToSocketAddrs};
|
use std::net::{SocketAddr, ToSocketAddrs};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::{Arc, Mutex};
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||||
use tokio::net::TcpStream;
|
use tokio::net::TcpStream;
|
||||||
@@ -24,7 +24,7 @@ use tracing::{error, instrument};
|
|||||||
use tracing_subscriber::filter::LevelFilter;
|
use tracing_subscriber::filter::LevelFilter;
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
#[derive(Clone, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct Config {
|
struct Config {
|
||||||
https_listen_address: SocketAddr,
|
https_listen_address: SocketAddr,
|
||||||
http_listen_address: Option<SocketAddr>,
|
http_listen_address: Option<SocketAddr>,
|
||||||
@@ -33,7 +33,7 @@ struct Config {
|
|||||||
mumble_server_url: String,
|
mumble_server_url: String,
|
||||||
mumble_server_address: Option<SocketAddr>,
|
mumble_server_address: Option<SocketAddr>,
|
||||||
gui_path: PathBuf,
|
gui_path: PathBuf,
|
||||||
gui: GuiConfig,
|
gui: Mutex<GuiConfig>,
|
||||||
}
|
}
|
||||||
|
|
||||||
static CONFIG: OnceCell<Config> = OnceCell::new();
|
static CONFIG: OnceCell<Config> = OnceCell::new();
|
||||||
@@ -107,6 +107,11 @@ async fn main() -> Result<()> {
|
|||||||
.push(Router::with_path("/proxy").goal(connect_proxy))
|
.push(Router::with_path("/proxy").goal(connect_proxy))
|
||||||
.push(Router::with_path("/gui").get(serve_gui_index_html))
|
.push(Router::with_path("/gui").get(serve_gui_index_html))
|
||||||
.push(Router::with_path("/gui/<*+rest>").get(StaticDir::new(config.gui_path.clone())))
|
.push(Router::with_path("/gui/<*+rest>").get(StaticDir::new(config.gui_path.clone())))
|
||||||
|
// right now dioxus assets don't properly handle base_url, so we are stuck with this
|
||||||
|
.push(
|
||||||
|
Router::with_path("/assets/<*+rest>")
|
||||||
|
.get(StaticDir::new(config.gui_path.join("assets"))),
|
||||||
|
)
|
||||||
.hoop(Logger::new());
|
.hoop(Logger::new());
|
||||||
|
|
||||||
// Read server certs
|
// Read server certs
|
||||||
@@ -193,13 +198,15 @@ async fn connect_proxy(req: &mut Request, res: &mut Response) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
let (outgoing, incoming) = bi.split();
|
let (outgoing, incoming) = bi.split();
|
||||||
tokio::spawn(async move {
|
let res = tokio::spawn(async move {
|
||||||
if let Err(error) = connect_proxy_impl(mumble_server_address, incoming, outgoing).await {
|
if let Err(error) = connect_proxy_impl(mumble_server_address, incoming, outgoing).await {
|
||||||
error!("error connecting proxy {error:?}")
|
error!("error connecting proxy {error:?}")
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.await;
|
||||||
res.render("connected");
|
if let Err(err) = res {
|
||||||
|
error!("crash in connected proxy {err:?}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(incoming, outgoing))]
|
#[instrument(skip(incoming, outgoing))]
|
||||||
|
|||||||
Reference in New Issue
Block a user