Created
January 6, 2020 20:48
-
-
Save pnkfelix/4bdef50d0538fee8f6e0cbc4379f6074 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/main.rs b/src/main.rs | |
index 86512cd..52adfc2 100644 | |
--- a/src/main.rs | |
+++ b/src/main.rs | |
@@ -283,12 +283,13 @@ async fn run_server(addr: SocketAddr) { | |
} | |
async fn proxy(buf: &[u8]) -> Result<Vec<u8>> { | |
- let proxy = unsafe { &PROXY }; | |
+ let proxy = unsafe { PROXY.as_slice() }; | |
for addr in proxy.iter() { | |
let mut socket = UdpSocket::bind(("0.0.0.0", 0)).await?; | |
- let data: Result<Vec<u8>> = timeout(Duration::from_millis(unsafe { TIMEOUT }), async { | |
+ let timeout_val = unsafe { TIMEOUT }; | |
+ let data: Result<Vec<u8>> = timeout(Duration::from_millis(timeout_val), async { | |
socket.send_to(&buf, addr).await?; | |
let mut res = [0; 512]; | |
let len = socket.recv(&mut res).await?; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment