Make host and port separate arguments
This commit is contained in:
parent
864236c1fa
commit
6ce1c347ae
2 changed files with 6 additions and 5 deletions
|
@ -17,7 +17,7 @@ If you have:
|
||||||
And you run the following command on your laptop:
|
And you run the following command on your laptop:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ssh -tR 9001:localhost:8080 example.com sirtunnel.py sub1.example.com:9001
|
ssh -tR 9001:localhost:8080 example.com sirtunnel.py sub1.example.com 9001
|
||||||
```
|
```
|
||||||
|
|
||||||
Now any requests to `https://sub.example.com` will be proxied to your local
|
Now any requests to `https://sub.example.com` will be proxied to your local
|
||||||
|
@ -30,8 +30,8 @@ The command above does 2 things:
|
||||||
|
|
||||||
1. It starts a standard [remote SSH tunnel][2] from the server port 9001 to
|
1. It starts a standard [remote SSH tunnel][2] from the server port 9001 to
|
||||||
local port 8080.
|
local port 8080.
|
||||||
2. It runs the command `sirtunnel.py sub1.example.com:9001` on the server.
|
2. It runs the command `sirtunnel.py sub1.example.com 9001` on the server.
|
||||||
The python script parses `sub1.example.com:9001` and uses the Caddy API to
|
The python script parses `sub1.example.com 9001` and uses the Caddy API to
|
||||||
reverse proxy `sub1.example.com` to port 9001 on the server. Caddy
|
reverse proxy `sub1.example.com` to port 9001 on the server. Caddy
|
||||||
automatically retrieves an HTTPS cert for `sub1.example.com`.
|
automatically retrieves an HTTPS cert for `sub1.example.com`.
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,9 @@ from urllib import request
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
tunnel_id = sys.argv[1]
|
host = sys.argv[1]
|
||||||
host, port = tunnel_id.split(':')
|
port = sys.argv[2]
|
||||||
|
tunnel_id = host + '-' + port
|
||||||
|
|
||||||
caddy_add_route_request = {
|
caddy_add_route_request = {
|
||||||
"@id": tunnel_id,
|
"@id": tunnel_id,
|
||||||
|
|
Loading…
Reference in a new issue