diff --git a/README.md b/README.md index 5f5505f..a28ba54 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ rstun ===== -A secured UDP tunnel written in Rust. +A secure UDP tunnel written in Rust. rstun builds on [Quinn](https://github.com/quinn-rs/quinn), which is an implementation of the IETF [QUIC](https://quicwg.org/) transport protocol. rstun consists of two binaries, `rstunc` for client and `rstund` for server. `rstund` accepts connections from `rstunc`. -`rstunc` connects to the server to build a secured tunnel to allow data to be exchanged between two ends, it initiates the connection in one of two modes: +`rstunc` connects to the server to build a secure tunnel to allow data to be exchanged between two ends, it initiates the connection in one of two modes: * The `IN` mode for exposing a local port to the internet through the server. * The `OUT` mode for securing data going out from local to the internet through the server. @@ -42,7 +42,7 @@ rstunc --cert path/to/cert.der \ --addr-mapping 0.0.0.0:9900^8800 ``` - - `mode` here is `OUT` for `TunnelOut`, for securing traffic from local to the server through the tunnel. + - `mode` here is `OUT`, for securing traffic from local to the server through the tunnel. - `server-addr`, domain name or IP address of the server. - `password`, same as that for the server. - `cert`, see explanation above for `rstund`. Note this is also optional if connecting to the server with a domain name, or the server `rstund` runs with an auto-generated self-signed certificate (see the TEST example below). @@ -53,7 +53,7 @@ rstunc * Simple TEST example -The following commands run a server and a client that connects to the server in their simplest ways: +The following commands run a server, then a client that connects to the server in their simplest ways: ``` diff --git a/src/bin/rstund.rs b/src/bin/rstund.rs index 435927e..d2df8d7 100644 --- a/src/bin/rstund.rs +++ b/src/bin/rstund.rs @@ -87,7 +87,7 @@ struct RstundArgs { /// Exposed upstreams as the receiving end of the tunnel, e.g. -d [ip:]port, /// The entire local network is exposed through the tunnel if empty - #[arg(short = 'd', long, required = false)] + #[arg(short = 'u', long, required = false)] upstreams: Vec, /// Password of the tunnel server diff --git a/src/lib.rs b/src/lib.rs index e7d71ee..34959ab 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -142,7 +142,7 @@ pub struct ServerConfig { pub(crate) enum ReadResult { Succeeded, - EOF, + Eof, } impl ClientConfig { @@ -223,7 +223,7 @@ impl ClientConfig { impl ReadResult { #![allow(dead_code)] pub fn is_eof(&self) -> bool { - matches!(self, Self::EOF) + matches!(self, Self::Eof) } } diff --git a/src/tunnel.rs b/src/tunnel.rs index b576ae0..c9d5c78 100644 --- a/src/tunnel.rs +++ b/src/tunnel.rs @@ -30,7 +30,7 @@ impl Tunnel { tokio::spawn(async move { loop { let result = Self::tcp_to_quic(&mut tcp_read, &mut quic_send).await; - if let Ok(ReadResult::EOF) | Err(_) = result { + if let Ok(ReadResult::Eof) | Err(_) = result { break; } } @@ -39,7 +39,7 @@ impl Tunnel { tokio::spawn(async move { loop { let result = Self::quic_to_tcp(&mut tcp_write, &mut quic_recv).await; - if let Ok(ReadResult::EOF) | Err(_) = result { + if let Ok(ReadResult::Eof) | Err(_) = result { break; } } @@ -57,7 +57,7 @@ impl Tunnel { Ok(ReadResult::Succeeded) } else { quic_send.finish().await?; - Ok(ReadResult::EOF) + Ok(ReadResult::Eof) } } @@ -71,7 +71,7 @@ impl Tunnel { tcp_write.write_all(&buffer[..len_read]).await?; Ok(ReadResult::Succeeded) } else { - Ok(ReadResult::EOF) + Ok(ReadResult::Eof) } } }