Skip to content

Examples - #5

Open
kad wants to merge 2 commits into
mainfrom
examples
Open

Examples#5
kad wants to merge 2 commits into
mainfrom
examples

Conversation

@kad

@kad kad commented Mar 21, 2026

Copy link
Copy Markdown
Owner

No description provided.

kad and others added 2 commits March 22, 2026 01:07
Document the YAML configuration format in detail with annotated client
and server examples, per-option descriptions, tunnel examples, and a
restriction rules sample that matches the implemented schema. Link the
new guide from the README configuration section.
Clarify that top-level `log_lvl` and `no_color` YAML keys are parsed but
not yet applied automatically, document `http_upgrade_credentials` as
the raw Authorization header value rather than a plain user:password
pair, and restate the server JWT options with their actual mode-specific
behavior.

Also align the README flag description for `--http-upgrade-credentials`
with the implementation.
Copilot AI review requested due to automatic review settings March 21, 2026 23:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a standalone YAML configuration reference to complement the existing CLI/README documentation, and links it from the README so users can find annotated client/server config examples.

Changes:

  • Add docs/CONFIG.md with YAML structure, client/server option descriptions, tunnel examples, and restriction-file examples.
  • Update README.md to link to docs/CONFIG.md and clarify --http-upgrade-credentials behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
docs/CONFIG.md New comprehensive YAML configuration guide (client/server + restrictions examples).
README.md Links to the new guide and updates --http-upgrade-credentials wording.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/CONFIG.md
Comment on lines +105 to +106
- `tls_sni_disable`: disable SNI.
- `tls_ech_enable`: enable ECH if supported by the runtime/server path.

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tls_sni_disable and tls_ech_enable are described as working options here, but the client TLS config code only applies tls_sni_override and does not reference these fields. Please either implement these behaviors or mark them as currently unsupported/no-op in the YAML guide.

Suggested change
- `tls_sni_disable`: disable SNI.
- `tls_ech_enable`: enable ECH if supported by the runtime/server path.
- `tls_sni_disable`: currently a no-op; SNI is always enabled. Reserved for future use.
- `tls_ech_enable`: currently a no-op; ECH is not yet implemented in the client TLS stack.

Copilot uses AI. Check for mistakes.
Comment thread docs/CONFIG.md
Comment on lines +111 to +115
- `http_proxy`: upstream HTTP proxy URL used to reach the wstunnel server.
- `http_proxy_login`: optional proxy username override.
- `http_proxy_password`: optional proxy password override.
- `dns_resolver`: explicit resolvers to use.
- `dns_resolver_prefer_ipv4`: prefer IPv4 answers when both families are available.

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http_proxy / http_proxy_login / http_proxy_password and dns_resolver / dns_resolver_prefer_ipv4 are documented as functional, but there’s no code that uses these config fields to affect dialing or name resolution (they’re only parsed into the config struct). Consider marking them as not implemented yet, or add the missing plumbing so these keys actually take effect.

Suggested change
- `http_proxy`: upstream HTTP proxy URL used to reach the wstunnel server.
- `http_proxy_login`: optional proxy username override.
- `http_proxy_password`: optional proxy password override.
- `dns_resolver`: explicit resolvers to use.
- `dns_resolver_prefer_ipv4`: prefer IPv4 answers when both families are available.
- `http_proxy`: (not yet implemented) reserved for configuring an upstream HTTP proxy URL used to reach the wstunnel server.
- `http_proxy_login`: (not yet implemented) optional proxy username override.
- `http_proxy_password`: (not yet implemented) optional proxy password override.
- `dns_resolver`: (not yet implemented) reserved for configuring explicit DNS resolvers to use.
- `dns_resolver_prefer_ipv4`: (not yet implemented) reserved for preferring IPv4 answers when both families are available.

Copilot uses AI. Check for mistakes.
Comment thread docs/CONFIG.md
- `jwt_secret`: optional verification secret for tunnel JWTs. In `mode: ws`, signatures are verified when this is set. In `mode: rust`, tokens are still parsed in Rust-compatible mode and are not cryptographically verified.
- `insecure_no_jwt_validation`: in `mode: ws`, allow Rust-compatible parsing of HS256 tunnel JWTs without signature verification when interoperability matters more than strict validation. It does not make `mode: rust` any stricter; that mode remains compatibility-oriented.
- `websocket_ping_frequency`: websocket ping interval sent by the server.
- `websocket_mask_frame`: enable websocket frame masking.

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Server websocket_mask_frame is documented as configurable, but server.Config.WebsocketMaskFrame is not referenced anywhere in the server implementation (only defined/parsed). Update the guide to note it’s currently a no-op, or wire it into the websocket handling if it’s intended to be supported.

Suggested change
- `websocket_mask_frame`: enable websocket frame masking.
- `websocket_mask_frame`: reserved for future use; currently a no-op and does not affect websocket frame masking.

Copilot uses AI. Check for mistakes.
Comment thread README.md
- `--http-upgrade-path-prefix`: HTTP upgrade path prefix (default: "v1").
- `--jwt-secret`: Shared secret used to sign tunnel JWTs.
- `--http-upgrade-credentials`: Basic auth credentials for upgrade request.
- `--http-upgrade-credentials`: Raw `Authorization` header value for the upgrade request (for Basic auth, pass the full `Basic ...` value).

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README describes --http-upgrade-credentials as a raw Authorization header value, but the CLI flag help text still says “Basic auth credentials for upgrade request” (cmd/wstunnel-go/main.go). Please update the CLI help string or adjust the README line so the docs don’t contradict the actual --help output.

Suggested change
- `--http-upgrade-credentials`: Raw `Authorization` header value for the upgrade request (for Basic auth, pass the full `Basic ...` value).
- `--http-upgrade-credentials`: Basic auth credentials for upgrade request.

Copilot uses AI. Check for mistakes.
Comment thread docs/CONFIG.md
Comment on lines +229 to +232
- !ReverseTunnel
protocol: [reverse_tcp]
port: ["20000..20100"]
```

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the restrictions example, protocol: [reverse_tcp] won’t match what the server actually compares against (it uses getProtoName() which yields ReverseTcp / ReverseUnix / ReverseHttp, etc., and only does case-insensitive matching). Update the docs example to use ReverseTcp/reverseTcp (no underscore) or adjust the implementation to accept reverse_tcp aliases.

Copilot uses AI. Check for mistakes.
Comment thread docs/CONFIG.md

`allow` entries must use tagged YAML objects:

- `!Tunnel` for regular forward tunnels (`tcp`, `udp`, `socks5`, `http_proxy`, `unix`)

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list says http_proxy is a valid !Tunnel protocol, but restriction matching uses getProtoName() which returns Http for HTTP proxy tunnels, so http_proxy will never match (even with EqualFold). The doc should list http (or Http) here to reflect actual accepted values.

Suggested change
- `!Tunnel` for regular forward tunnels (`tcp`, `udp`, `socks5`, `http_proxy`, `unix`)
- `!Tunnel` for regular forward tunnels (`tcp`, `udp`, `socks5`, `http`, `unix`)

Copilot uses AI. Check for mistakes.
Comment thread docs/CONFIG.md
- `http_headers_file`: file with `Header: value` lines. If set, values from the file override duplicate keys in `http_headers`.
- `http_upgrade_credentials`: raw `Authorization` header value sent to the server. For HTTP Basic auth, provide the full header payload such as `Basic dXNlcjpwYXNzd29yZA==`.
- `websocket_ping_frequency`: websocket ping interval.
- `websocket_mask_frame`: enable masking on websocket frames.

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

websocket_mask_frame is documented as an active option, but the client/server configs don’t currently use this field anywhere (it’s only defined/parsed). Either implement masking behavior or document that this key is currently ignored/no-op.

Suggested change
- `websocket_mask_frame`: enable masking on websocket frames.
- `websocket_mask_frame`: currently ignored/no-op; kept for forward compatibility and may be used by future versions.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants