Midori
Protocols
Usage
midori [OPTIONS] [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-c, --config <file> specify a config file
Quick Start
Get started with a simple TCP relay(supports zero-copy on linux).
You need to create a config file and then specify the listen and remote address.
{
"endpoints":[
{
"listen": "0.0.0.0:5000",
"remote": "1.2.3.4:8080"
},
{
"listen": "0.0.0.0:10000",
"remote": "www.example.com:443"
},
]
}
Launch these 2 endpoints:
midori -c config.json
Note: Almost all kinds of address are supported, including ipv4
, ipv6
, domain name
and unix socket path
.
Full Configuration
show example
{
"dns_mode": "ipv4_then_ipv6",
"endpoints": [
{
"listen": {
"addr": "0.0.0.0:5000",
"net": "tcp",
"trans": {
"proto": "ws",
"path": "/"
},
"tls": {
"cert": "x.crt",
"key": "x.pem",
"versions": "tlsv1.3, tlsv1.2",
"aplns": "http/1.1",
"ocsp": "x.ocsp"
}
},
"remote": {
"addr": "www.example.com:443",
"net": "tcp",
"trans": {
"proto": "h2",
"path": "/",
"server_push": false
},
"tls": {
"roots": "firefox",
"versions": "tlsv1.3, tlsv1.2",
"sni": "www.example.com",
"aplns": "h2",
"skip_verify": false,
"enable_sni": true
}
}
}
]
}
Global
Currently, the configuration file only consists of 2 fields:
{
"dns_mode": "", // and other global params
"endpoints": []
}
DNS Mode
The trust-dns
crate supports these strategies:
- ipv4_only
- ipv6_only
- ipv4_then_ipv6 (default)
- ipv6_then_ipv4
- ipv4_and_ipv6
Endpoint(s)
Each endpoint contains an associated pair of listen
and remote
.
{
"listen": "",
"remote": ""
}
Below is the options of listen
or remote
. Each field has a default value except for addr
.
Moreover, trans
and tls
also support more complicated params(e.g. path
, sni
, ocsp
..). See Protocol Docs for more details.
{
"addr": "", // must
"net": "", // tcp(deafult), uds, udp
"trans": "", // plain(default), ws, h2..
"tls": "" // none(default)
}
Note that all the protocols can be applied to both sides of listen
and remote
. You could either use net
directly or combine them with transport
.
net | tcp | uds | udp |
---|---|---|---|
tls | O | O | |
ws | O | O | |
h2 | O | O | |
grpc | O | O | |
quic | O |