Skip to content

Add multi-secret inbound auth and per-user proxy links#76

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-56297248-1198753538-aba1d14a-988a-409c-8099-200b88481b24
Draft

Add multi-secret inbound auth and per-user proxy links#76
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-56297248-1198753538-aba1d14a-988a-409c-8099-200b88481b24

Conversation

Copilot AI commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Users running the proxy on OpenWRT needed per-user credentials instead of a single shared secret. This change allows configuring multiple inbound secrets and using distinct tg://proxy links per user while preserving existing single-secret behavior.

  • Config: multiple secrets for one instance

    • --secret now accepts multiple values (repeatable flag and comma-separated env input).
    • Config now stores secrets: Vec<String> and keeps a primary-secret helper for existing flows.
  • Auth path: accept any configured secret

    • Inbound MTProto handshake validation now tries all configured secrets.
    • Inbound FakeTLS digest validation likewise matches against all configured secrets and responds with the matched one.
  • Link generation: per-user credentials output

    • Startup output keeps the primary link and adds additional tg://proxy links for extra configured secrets.
    • Secret formatting logic is centralized via link_secret_for(secret) to avoid duplication and keep FakeTLS/non-FakeTLS link encoding consistent.
  • Docs and tests

    • README updated to document repeatable/comma-separated --secret usage for per-user credentials.
    • Added config test coverage for multi-secret parsing and primary-secret link behavior.
tg-ws-proxy --host 0.0.0.0 --port 443 \
  --secret 11111111111111111111111111111111 \
  --secret 22222222222222222222222222222222

This configuration accepts both secrets on inbound connections and emits separate tg://proxy links for each user credential.

Copilot AI changed the title [WIP] Add user authentication for TG WS Proxy access Add multi-secret inbound auth and per-user proxy links Jun 7, 2026
Copilot AI requested a review from valnesfjord June 7, 2026 20:38
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.

Добавление пользователей для доступа TG WS Proxy

2 participants