mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 22:10:01 -04:00
add udp sockets
This commit is contained in:
parent
75c48ccded
commit
5a24f53454
9 changed files with 146 additions and 10 deletions
|
@ -2,10 +2,12 @@
|
|||
#[macro_use]
|
||||
mod utils;
|
||||
mod tls_stream;
|
||||
mod udp_stream;
|
||||
mod websocket;
|
||||
mod wrappers;
|
||||
|
||||
use tls_stream::EpxTlsStream;
|
||||
use udp_stream::EpxUdpStream;
|
||||
use utils::{Boolinator, ReplaceErr, UriExt};
|
||||
use websocket::EpxWebSocket;
|
||||
use wrappers::{IncomingBody, TlsWispService, WebSocketWrapper};
|
||||
|
@ -247,6 +249,17 @@ impl EpoxyClient {
|
|||
EpxTlsStream::connect(self, onopen, onclose, onerror, onmessage, url).await
|
||||
}
|
||||
|
||||
pub async fn connect_udp(
|
||||
&self,
|
||||
onopen: Function,
|
||||
onclose: Function,
|
||||
onerror: Function,
|
||||
onmessage: Function,
|
||||
url: String,
|
||||
) -> Result<EpxUdpStream, JsError> {
|
||||
EpxUdpStream::connect(self, onopen, onclose, onerror, onmessage, url).await
|
||||
}
|
||||
|
||||
pub async fn fetch(&self, url: String, options: Object) -> Result<web_sys::Response, JsError> {
|
||||
let uri = url.parse::<uri::Uri>().replace_err("Failed to parse URL")?;
|
||||
let uri_scheme = uri.scheme().replace_err("URL must have a scheme")?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue