Skip to content

Commit

Permalink
Add IPv6 support, fixes #10
Browse files Browse the repository at this point in the history
  • Loading branch information
boronine committed Nov 10, 2024
1 parent 44a350d commit 245b2da
Show file tree
Hide file tree
Showing 4 changed files with 250 additions and 141 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ usage: h2tunnel <command> [options]
commands:
client
server
client options:
--crt <path> Path to certificate file (.crt)
--key <path> Path to private key file (.key)
Expand All @@ -61,14 +61,14 @@ client options:
server options:
--crt <path> Path to certificate file (.crt)
--key <path> Path to private key file (.key)
--tunnel-listen-ip <ip> IP for the tunnel server to bind on (default: 0.0.0.0)
--tunnel-listen-ip <ip> IP for the tunnel server to bind on (default: ::0)
--tunnel-listen-port <port> Port for the tunnel server to listen on
--proxy-listen-ip <ip> IP for the remote TCP proxy server to bind on (default: 0.0.0.0)
--proxy-listen-ip <ip> IP for the remote TCP proxy server to bind on (default: ::0)
--proxy-listen-port <port> Port for the remote TCP proxy server to listen on
The tunnel and proxy servers will bind to 0.0.0.0 by default which will make them publically available. This requires
The tunnel and proxy servers will bind to ::0 by default which will make them publically available. This requires
superuser permissions on Linux. You can change this setting to bind to a specific network interface, e.g. a VPN, but
this is advanced usage.
this is advanced usage. Note that on most operating systems, binding to ::0 will also bind to 0.0.0.0.
```

Generate `h2tunnel.key` and `h2tunnel.crt` files using `openssl` command:
Expand All @@ -83,7 +83,7 @@ On your server (mysite.example.com), we will be listening for tunnel connections
proxy on port 80. Make sure these are open in your firewall.

```bash
# sudo is required to bind to 0.0.0.0, which is necessary for public access
# sudo is required to bind to ::0, which is necessary for public access
sudo h2tunnel server \
--crt h2tunnel.crt \
--key h2tunnel.key \
Expand Down Expand Up @@ -169,9 +169,9 @@ const server = new TunnelServer({
logger: (line) => console.log(line), // optional
key: `-----BEGIN PRIVATE KEY----- ...`,
cert: `-----BEGIN CERTIFICATE----- ...`,
tunnelListenIp: "0.0.0.0", // optional
tunnelListenIp: "::0", // optional
tunnelListenPort: 15001,
proxyListenIp: "0.0.0.0", // optional
proxyListenIp: "::0", // optional
proxyListenPort: 80,
});

Expand Down
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ server options:
--${"proxy-listen-ip" satisfies Param} <ip> IP for the remote TCP proxy server to bind on (default: ${DEFAULT_LISTEN_IP})
--${"proxy-listen-port" satisfies Param} <port> Port for the remote TCP proxy server to listen on
The tunnel and proxy servers will bind to 0.0.0.0 by default which will make them publically available. This requires
The tunnel and proxy servers will bind to ::0 by default which will make them publically available. This requires
superuser permissions on Linux. You can change this setting to bind to a specific network interface, e.g. a VPN, but
this is advanced usage.
this is advanced usage. Note that on most operating systems, binding to ::0 will also bind to 0.0.0.0.
`;

if (positionals.length === 0) {
Expand Down
Loading

0 comments on commit 245b2da

Please sign in to comment.