Skip to content

Commit 4552e4a

Browse files
committed
new release for supporting udp tunneling
1 parent 74034c0 commit 4552e4a

File tree

4 files changed

+78
-76
lines changed

4 files changed

+78
-76
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "omnip"
3-
version = "0.5.1"
3+
version = "0.6.0"
44
edition = "2021"
55

66
[lib]

README.md

Lines changed: 66 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
omnip - {tcp / http proxy / socks proxy} over quic
1+
omnip - [tcp | udp | http proxy | socks proxy] over quic
22
--------
33

4-
An all in one proxy implementation written in Rust.
4+
An all-in-one proxy written in Rust.
55

66
Features
77
--------
@@ -16,18 +16,24 @@ Features
1616
* `omnip -a socks5://127.0.0.1:9000 --upstream http+quic://DOMAIN:3515 -lD`
1717
Note: The commands above will use auto-generated self-signed certificate for QUIC, which is for demonstration only. Domain name with certificate issued by trusted CA is recommended. For more details, see README of the [rstun](https://github.com/neevek/rstun) project, which omnip uses to implement proxy over QUIC. And remember to set a password for the server with the `-p` or `--password` option.
1818
5. Supports plain tcp connections over QUIC, which can be used to expose a port of remote server through the QUIC tunnel, for example:
19-
* Start a QUIC server that forwards all its payload to the local SSH port:
20-
* `omnip -a tcp+quic://0.0.0.0:3515 -upstream tcp://127.0.0.1:22 -lD`
19+
* Start a QUIC server that forwards all its tcp payload to the local SSH port:
20+
* `omnip -a tcp+quic://0.0.0.0:3515 --upstream tcp://127.0.0.1:22 -lD`
2121
* Connect to the tunnel server and SSH into the remote server through the QUIC tunnel:
22-
* `omnip -a tcp://0.0.0.0:3721 -upstream tcp+quic://DOMAIN:3515 -lD`
22+
* `omnip -a tcp://0.0.0.0:3721 --upstream tcp+quic://DOMAIN:3515 -lD`
2323
* `ssh -p 3721 user@127.0.0.1`
24-
6. Supports simple proxy rules, traffic will be relayed to upstream if the requested domain matches one of the proxy rules, this is for achieving *Smart Proxy* to control which domains should be forwarded through the tunnel, for example:
24+
6. Supports plain udp tunneling over QUIC, for example:
25+
* Start a QUIC server that forwards all its udp payload to `1.1.1.1:53`:
26+
* `omnip -a udp+quic://0.0.0.0:3515 --upstream udp://1.1.1.1:53 -lD`
27+
* Connect to the tunnel server and resolve DNS via the tunnel:
28+
* `omnip -a udp://0.0.0.0:5353 --upstream udp+quic://DOMAIN:3515 -lD`
29+
* `dig @127.0.0.1 -p 5353 github.com`
30+
7. Supports simple proxy rules, traffic will be relayed to upstream if the requested domain matches one of the proxy rules, this is for achieving *Smart Proxy* to control which domains should be forwarded through the tunnel, for example:
2531
* example.com
2632
* .example.com
2733
* ||example.com
2834
* ...
29-
7. Supports DoT (DNS-over-TLS) or custom name servers, for example: `--dot-server dns.google`, `--name-servers 1.1.1.1,8.8.8.8`, if both are specified, DoT server takes precedence.
30-
8. Simple Web UI can be accessed from the same port of the proxy server, DNS servers and tunnel connection can be configured through the Web UI.
35+
8. Supports DoT (DNS-over-TLS) or custom name servers, for example: `--dot-server dns.google`, `--name-servers 1.1.1.1,8.8.8.8`, if both are specified, DoT server takes precedence.
36+
9. Simple Web UI can be accessed from the same port of the proxy server, DNS servers and tunnel connection can be configured through the Web UI.
3137

3238
Examples
3339
--------
@@ -85,62 +91,58 @@ Examples
8591
![omnip](https://github.com/neevek/omnip/raw/master/omnip2.jpg)
8692
8793
```
88-
USAGE:
89-
omnip [OPTIONS] --addr <ADDR>
90-
91-
OPTIONS:
92-
-a, --addr <ADDR>
93-
Server address [<tcp|http|socks5|socks4|tcp+quic|http+quic|socks5+quic|socks4+quic>://][ip:]port for
94-
example: http://127.0.0.1:8000, http+quic://127.0.0.1:8000
95-
96-
-u, --upstream <UPSTREAM>
97-
upstream which the proxy server will relay traffic to based on proxy rules,
98-
[<tcp|http|socks5|socks4>://][ip|domain]:port for example: http://127.0.0.1:8000,
99-
http+quic://127.0.0.1:8000 [default: ]
100-
101-
-r, --proxy-rules-file <PROXY_RULES_FILE>
102-
Path to the proxy rules file [default: ]
103-
104-
-t, --threads <THREADS>
105-
Threads to run async tasks, default to number of cpu cores [default: 0]
106-
107-
--dot-server <DOT_SERVER>
108-
DoT (DNS-over-TLS) server, e.g. dns.google [default: ]
109-
110-
--name-servers <NAME_SERVERS>
111-
comma saprated domain servers (E.g. 1.1.1.1,8.8.8.8), which will be used if no
112-
dot_server is specified, or system default if empty [default: ]
113-
114-
-c, --cert <CERT>
115-
Applicable only for +quic protocols Path to the certificate file, if
116-
empty, a self-signed certificate with the domain "localhost" will be used [default: ]
117-
118-
-k, --key <KEY>
119-
Applicable only for +quic protocols Path to the key file, can be empty if
120-
no cert is provided [default: ]
121-
122-
-p, --password <PASSWORD>
123-
Applicable only for +quic protocols Password of the +quic server [default: ]
124-
125-
-e, --cipher <CIPHER>
126-
Applicable only for +quic protocols Password of the +quic server [default:
127-
chacha20-poly1305] [possible values: chacha20-poly1305, aes-256-gcm, aes-128-gcm]
128-
129-
-i, --max-idle-timeout-ms <MAX_IDLE_TIMEOUT_MS>
130-
Applicable only for quic protocol as upstream Max idle timeout for the QUIC
131-
connections [default: 120000]
132-
133-
-w, --watch-proxy-rules-change
134-
reload proxy rules if updated
135-
136-
-l, --loglevel <LOGLEVEL>
137-
[default: I] [possible values: T, D, I, W, E]
138-
139-
-h, --help
140-
Print help information
141-
142-
-V, --version
143-
Print version information
94+
Usage: omnip [OPTIONS] --addr <ADDR>
95+
96+
Options:
97+
-a, --addr <ADDR>
98+
Server address [<tcp|http|socks5|socks4|tcp+quic|http+quic|socks5+quic|socks4+quic>://][ip:]port
99+
for example: http://127.0.0.1:8000, http+quic://127.0.0.1:8000
100+
-u, --upstream <UPSTREAM>
101+
Upstream which the proxy server will relay traffic to based on proxy rules,
102+
[<http|socks5|socks4>://]ip:port for example: http://127.0.0.1:8000, http+quic://127.0.0.1:8000 [default: ]
103+
-r, --proxy-rules-file <PROXY_RULES_FILE>
104+
Path to the proxy rules file [default: ]
105+
-t, --threads <THREADS>
106+
Threads to run async tasks, default to number of cpu cores [default: 0]
107+
--dot-server <DOT_SERVER>
108+
DoT (DNS-over-TLS) server, e.g. dns.google [default: ]
109+
--name-servers <NAME_SERVERS>
110+
comma saprated domain servers (E.g. 1.1.1.1,8.8.8.8), which will be used
111+
if no dot_server is specified, or system default if empty [default: ]
112+
-c, --cert <CERT>
113+
Applicable only for +quic protocols
114+
Path to the certificate file, if empty, a self-signed certificate
115+
with the domain "localhost" will be used [default: ]
116+
-k, --key <KEY>
117+
Applicable only for +quic protocols
118+
Path to the key file, can be empty if no cert is provided [default: ]
119+
-p, --password <PASSWORD>
120+
Applicable only for +quic protocols
121+
Password of the +quic server [default: ]
122+
-e, --cipher <CIPHER>
123+
Applicable only for +quic protocols
124+
Cipher for encryption [default: chacha20-poly1305] [possible values: chacha20-poly1305, aes-256-gcm, aes-128-gcm]
125+
-i, --max-idle-timeout-ms <MAX_IDLE_TIMEOUT_MS>
126+
Applicable only for quic protocol as upstream
127+
Max idle timeout for the QUIC connections [default: 120000]
128+
-R, --retry-interval-ms <RETRY_INTERVAL_MS>
129+
Applicable only for quic protocol as upstream
130+
Max idle timeout for the QUIC connections [default: 5000]
131+
--tcp-nodelay
132+
Set TCP_NODELAY
133+
-w, --watch-proxy-rules-change
134+
Reload proxy rules if updated
135+
-l, --loglevel <LOGLEVEL>
136+
Log level [default: I] [possible values: T, D, I, W, E]
137+
-E, --encode-base64
138+
Print the args as base64 string to be used in opp:// address, will be ignored if passing in
139+
as an opp:// address, which can combine all args as a single base64 string
140+
-D, --decode-base64
141+
Decode and print the base64 encoded opp:// address
142+
-h, --help
143+
Print help
144+
-V, --version
145+
Print version
144146
```
145147
146148
License

src/bin/omnip.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ fn print_args_as_base64(args: &OmnipArgs) -> bool {
106106
struct OmnipArgs {
107107
/// Server address [<tcp|http|socks5|socks4|tcp+quic|http+quic|socks5+quic|socks4+quic>://][ip:]port
108108
/// for example: http://127.0.0.1:8000, http+quic://127.0.0.1:8000
109-
#[arg(short = 'a', long, required = true)]
109+
#[arg(short = 'a', long, verbatim_doc_comment, required = true)]
110110
addr: String,
111111

112112
/// Upstream which the proxy server will relay traffic to based on proxy rules,
113113
/// [<http|socks5|socks4>://]ip:port for example: http://127.0.0.1:8000, http+quic://127.0.0.1:8000
114-
#[arg(short = 'u', long, default_value = "")]
114+
#[arg(short = 'u', long, verbatim_doc_comment, default_value = "")]
115115
upstream: String,
116116

117117
/// Path to the proxy rules file
@@ -128,39 +128,39 @@ struct OmnipArgs {
128128

129129
/// comma saprated domain servers (E.g. 1.1.1.1,8.8.8.8), which will be used
130130
/// if no dot_server is specified, or system default if empty
131-
#[arg(long, default_value = "")]
131+
#[arg(long, verbatim_doc_comment, default_value = "")]
132132
name_servers: String,
133133

134134
/// Applicable only for +quic protocols
135135
/// Path to the certificate file, if empty, a self-signed certificate
136136
/// with the domain "localhost" will be used
137-
#[arg(short = 'c', long, default_value = "")]
137+
#[arg(short = 'c', long, verbatim_doc_comment, default_value = "")]
138138
cert: String,
139139

140140
/// Applicable only for +quic protocols
141141
/// Path to the key file, can be empty if no cert is provided
142-
#[arg(short = 'k', long, default_value = "")]
142+
#[arg(short = 'k', long, verbatim_doc_comment, default_value = "")]
143143
key: String,
144144

145145
/// Applicable only for +quic protocols
146146
/// Password of the +quic server
147-
#[arg(short = 'p', long, default_value = "")]
147+
#[arg(short = 'p', long, verbatim_doc_comment, default_value = "")]
148148
password: String,
149149

150150
/// Applicable only for +quic protocols
151151
/// Cipher for encryption
152-
#[arg(short = 'e', long, default_value_t = String::from(rstun::SUPPORTED_CIPHER_SUITE_STRS[0]),
152+
#[arg(short = 'e', long, verbatim_doc_comment, default_value_t = String::from(rstun::SUPPORTED_CIPHER_SUITE_STRS[0]),
153153
value_parser = PossibleValuesParser::new(rstun::SUPPORTED_CIPHER_SUITE_STRS).map(|v| v.to_string()))]
154154
cipher: String,
155155

156156
/// Applicable only for quic protocol as upstream
157157
/// Max idle timeout for the QUIC connections
158-
#[arg(short = 'i', long, default_value = "120000")]
158+
#[arg(short = 'i', long, verbatim_doc_comment, default_value = "120000")]
159159
max_idle_timeout_ms: u64,
160160

161161
/// Applicable only for quic protocol as upstream
162162
/// Max idle timeout for the QUIC connections
163-
#[arg(short = 'R', long, default_value = "5000")]
163+
#[arg(short = 'R', long, verbatim_doc_comment, default_value = "5000")]
164164
retry_interval_ms: u64,
165165

166166
/// Set TCP_NODELAY
@@ -185,7 +185,7 @@ struct OmnipArgs {
185185

186186
/// Print the args as base64 string to be used in opp:// address, will be ignored if passing in
187187
/// as an opp:// address, which can combine all args as a single base64 string
188-
#[arg(short = 'E', long, action)]
188+
#[arg(short = 'E', long, verbatim_doc_comment, action)]
189189
encode_base64: bool,
190190

191191
/// Decode and print the base64 encoded opp:// address

0 commit comments

Comments
 (0)