Skip to content

Commit

Permalink
Merge pull request #39 from WisdomSky/feature/add-protocol-arg-support
Browse files Browse the repository at this point in the history
Add protocol argument
  • Loading branch information
WisdomSky authored Oct 8, 2024
2 parents 6619ae9 + 39dc871 commit e80495a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ENV WEBUI_PORT=${WEBUI_PORT:-14333}
ENV METRICS_ENABLE=${METRICS_ENABLE:-"false"}
ENV METRICS_PORT=${METRICS_PORT:-60123}

ENV PROTOCOL=auto

EXPOSE ${WEBUI_PORT}
EXPOSE ${METRICS_PORT}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ services:
| Variable Name | Default value | Required or Optional | Description |
|-----------------|---------------|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| WEBUI_PORT | 14333 | _Optional_ | The port on the host where the WebUI will be running. Useful when an existing process is running on port `14333` and want to assign cloudflared-web into a different available port. |
| PROTOCOL | auto | _Optional_ | Specifies the protocol used to establish a connection between cloudflared and the Cloudflare global network. Available values are `auto`, `http2`, and `quic`. |
| METRICS_ENABLE | false | _Optional_ | Enable [tunnel metrics](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/monitor-tunnels/metrics/) server. |
| METRICS_PORT | 60123 | _Optional_ | Specify port to run tunnel metrics on. `METRICS_ENABLE` must be set to `true`. |
| BASIC_AUTH_PASS | | _Optional_ | Enable Basic Auth by specifying a password. If `BASIC_AUTH_USER` is not specified, the default value for username `admin` will be used. |
Expand Down
4 changes: 4 additions & 0 deletions app/backend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ function init(config, res) {
additionalArgs.metrics = process.env.METRICS_PORT;
}

if (['http2','quic'].indexOf(process.env.PROTOCOL)) {
additionalArgs.protocol = process.env.PROTOCOL;
}

if (fs.existsSync(cloudflaredconfigpath)) {
additionalArgs.configPath = cloudflaredconfigpath;
}
Expand Down
5 changes: 5 additions & 0 deletions app/backend/cloudflare-tunnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ class CloudflaredTunnel {
args.push(`0.0.0.0:${additionalArgs.metrics}`);
}

if (!!additionalArgs.protocol) {
args.push("--protocol");
args.push(additionalArgs.protocol);
}

args.push("run");
args.push("--token");
args.push(this.token);
Expand Down
1 change: 1 addition & 0 deletions dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ENV WEBUI_PORT=${WEBUI_PORT:-14333}
ENV METRICS_ENABLE=${METRICS_ENABLE:-"false"}
ENV METRICS_PORT=${METRICS_PORT:-60123}

ENV PROTOCOL=auto

EXPOSE ${WEBUI_PORT}
EXPOSE ${METRICS_PORT}
Expand Down

0 comments on commit e80495a

Please sign in to comment.