Skip to content

Commit

Permalink
add some more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
radkesvat committed May 25, 2024
1 parent 874d6ef commit e8c8b35
Show file tree
Hide file tree
Showing 15 changed files with 394 additions and 18 deletions.
85 changes: 85 additions & 0 deletions examples/trojan_server/config_trojan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"name": "trojan_server",
"nodes": [
{
"name": "tcp_inbound",
"type": "TcpListener",
"settings": {
"address": "0.0.0.0",
"port": 443,
"nodelay": true
},
"next": "ssl_server"
},
{
"name": "ssl_server",
"type": "OpenSSLServer",
"settings": {
"anti-tls-in-tls": true,
"cert-file": "fullchain.pem",
"key-file": "privkey.pem",
"alpns": [
{
"value": "http/1.1",
"next": "node->next"
},
{
"value": "h2",
"next": "node->next"
}
],
"fallback": "tls_fallback"
},
"next": "my-trojan-auth"
},
{
"name": "my-trojan-auth",
"type": "TrojanAuthServer",
"settings": {
"fallback": "trojan_fallback",
"fallback-intence-delay": 50,
"users": [
{
"name": "sample_user",
"uid": "my_awesome_password",
"enable": true
}
]
},
"next": "trojan_socks"
},
{
"name": "trojan_socks",
"type": "TrojanSocksServer",
"settings": {},
"next": "users_outbound"
},
{
"name": "users_outbound",
"type": "Connector",
"settings": {
"nodelay": true,
"address": "dest_context->address",
"port": "dest_context->port"
}
},
{
"name": "tls_fallback",
"type": "TcpConnector",
"settings": {
"nodelay": true,
"address": "demo.nginx.com",
"port": 443
}
},
{
"name": "trojan_fallback",
"type": "TcpConnector",
"settings": {
"nodelay": true,
"address": "httpforever.com",
"port": 80
}
}
]
}
24 changes: 24 additions & 0 deletions examples/tunnel/direct/tcp/multiport/config_client.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "config_tcp_multiport",
"nodes": [
{
"name": "input",
"type": "TcpListener",
"settings": {
"address": "0.0.0.0",
"port": [23,65535],
"nodelay": true
},
"next": "output"
},
{
"name": "output",
"type": "TcpConnector",
"settings": {
"nodelay": true,
"address": "1.1.1.1",
"port": "src_context->port"
}
}
]
}
13 changes: 13 additions & 0 deletions examples/tunnel/direct/tcp/multiport/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# MultiPort tcp


assumptions:

> port range: 23 - 65535
> ip foreign server : 1.1.1.1
---

forward port X to 1.1.1.1:X


Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "simple_port_to_port",
"name": "config_tcp_port_to_port",
"nodes": [
{
"name": "inbound",
Expand Down
13 changes: 13 additions & 0 deletions examples/tunnel/direct/tcp/port_to_port/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SinglePort Tcp


assumptions:

> port: 443
> ip foreign server : 1.1.1.1
---

forward port 443 to 1.1.1.1:443


Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"settings": {
"sni": "mydomain.com",
"verify": true,
"alpn": "h2"
"alpn": "http/1.1"
},
"next": "tcp_outbound"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,11 @@
"cert-file": "fullchain.pem",
"key-file": "privkey.pem",
"alpns": [
{
"value": "h2",
"next": "node->next"
},
{
"value": "http/1.1",
"next": "node->next"
}
],
"fallback-intence-delay": 0
]
},
"next": "header"
},
Expand All @@ -37,14 +32,14 @@
"settings": {
"override": "dest_context->port"
},
"next": "my-connector"
"next": "outbound"
},
{
"name": "my-connector",
"type": "Connector",
"name": "outbound",
"type": "TcpConnector",
"settings": {
"nodelay": true,
"address": "mydomain.com",
"address": "127.0.0.1",
"port": "dest_context->port"
}
}
Expand Down
23 changes: 23 additions & 0 deletions examples/tunnel/direct/tls/multiport/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# MultiPort tls + tcp


assumptions:

> port range: 23 - 65535
> foreign server address: mydomain.com
> in foreign server, the domain certificate files (fullchain.pem, privkey.pem) are present next to Waterwall
> next protocol is http/1.1 , change it if you need h2 or both
---

forward port X to mydomain.com:443 , then tls handshake, then to port X inside the foreign server (mydomain.com)

preconnect node is added to lower the handshake time


config_client.json -> run in local server (iran)

config_server.json -> run in foreign server (kharej)
42 changes: 42 additions & 0 deletions examples/tunnel/direct/tls/port_to_port/config_client.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "config_tls_tunnel_client_single_port",
"nodes": [
{
"name": "inbound",
"type": "TcpListener",
"settings": {
"address": "0.0.0.0",
"port": 443,
"nodelay": true
},
"next": "pre_client"
},
{
"name": "pre_client",
"type": "PreConnectClient",
"settings": {
"minimum-unused": 8
},
"next": "ssl_client"
},
{
"name": "ssl_client",
"type": "OpenSSLClient",
"settings": {
"sni": "mydomain.com",
"verify": true,
"alpn": "http/1.1"
},
"next": "tcp_outbound"
},
{
"name": "tcp_outbound",
"type": "TcpConnector",
"settings": {
"nodelay": true,
"address": "mydomain.com",
"port": 443
}
}
]
}
43 changes: 43 additions & 0 deletions examples/tunnel/direct/tls/port_to_port/config_server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "config_tls_tunnel_server_single_port",
"nodes": [
{
"name": "inbound",
"type": "TcpListener",
"settings": {
"address": "0.0.0.0",
"port": 443,
"nodelay": true
},
"next": "ssl_server"
},
{
"name": "ssl_server",
"type": "OpenSSLServer",
"settings": {
"cert-file": "fullchain.pem",
"key-file": "privkey.pem",
"alpns": [
{
"value": "h2",
"next": "node->next"
},
{
"value": "http/1.1",
"next": "node->next"
}
]
},
"next": "outbound"
},
{
"name": "outbound",
"type": "TcpConnector",
"settings": {
"nodelay": true,
"address": "127.0.0.1",
"port": 443
}
}
]
}
24 changes: 24 additions & 0 deletions examples/tunnel/direct/tls/port_to_port/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SinglePort tls + tcp


assumptions:

> port range: 23 - 65535
> foreign server address: mydomain.com
> in foreign server, the domain certificate files (fullchain.pem, privkey.pem) are present next to Waterwall
> next protocol is http/1.1 , change it if you need h2 or both
---

forward port 443 to mydomain.com:443 , then tls handshake, then to port 2083 inside the foreign server (mydomain.com)

preconnect node is added to lower the handshake time



config_client.json -> run in local server (iran)

config_server.json -> run in foreign server (kharej)
48 changes: 48 additions & 0 deletions examples/tunnel/reverse/tcp/port_to_port/config_client.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "config_tcp_reverse_client_port_to_port",
"nodes": [
{
"name": "users_inbound",
"type": "TcpListener",
"settings": {
"address": "0.0.0.0",
"port": 443,
"nodelay": true
},
"next": "bridge2"
},
{
"name": "bridge2",
"type": "Bridge",
"settings": {
"pair": "bridge1"
}
},
{
"name": "bridge1",
"type": "Bridge",
"settings": {
"pair": "bridge2"
}
},
{
"name": "reverse_server",
"type": "ReverseServer",
"settings": {},
"next": "bridge1"
},
{
"name": "foreign_server_inbound",
"type": "TcpListener",
"settings": {
"address": "0.0.0.0",
"port": 443,
"nodelay": true,
"whitelist": [
"2.2.2.2/32"
]
},
"next": "reverse_server"
}
]
}
Loading

0 comments on commit e8c8b35

Please sign in to comment.