hyper-util: SOCKS5 connector sends a bracketed IPv6 literal as a domain name
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- rust
- 領域
- networking
調査の方向性
src/client/legacy/connect/proxy/socks/v5/mod.rs から始めて、宛先ホストがどのように SOCKS5 アドレスとしてパースされるかを調べます。https://[::1]:443 への SocksV5 リクエストを実行し、エンコードされたリクエストが角括弧付きのテキストを持つ ATYP 0x03 ではなく、16 個の生の IPv6 バイトを持つ ATYP 0x04 を使用していることを確認します。
索引モデルが issue の本文から書いたものです。
説明
My Claude discovered this.
Fable:
Affects hyper-util 0.1.20 (src/client/legacy/connect/proxy/socks/v5/mod.rs), seen through reqwest 0.13.5 with a socks5:// proxy (local DNS mode).
What happens
reqwest resolves the target locally and builds the destination URI with the address; an IPv6 address is written in brackets, as a URI requires (https://[2606:4700::6810:102]:443). SocksV5 then takes dst.host(), which for an IPv6 authority still carries the brackets ([2606:4700::6810:102]), and does:
let address = match host.parse::<IpAddr>() {
Ok(ip) => Address::Socket(SocketAddr::new(ip, port)),
Err(_) => ... Address::Domain(host, port)
"[2606:4700::6810:102]".parse::<IpAddr>() fails, so the literal goes out as ATYP 0x03 (domain name) with the brackets in the string. A SOCKS5 server that joins host and port (tailscaled's does, with Go's net.JoinHostPort) ends up with [[2606:4700::6810:102]]:443 and fails with "missing port in address". IPv4 literals have no brackets, so they parse and go out as ATYP 0x01.
Fix
Strip the URI brackets before parsing the host as an IP address, so an IPv6 literal goes out as ATYP 0x04:
- let address = match host.parse::<IpAddr>() {
+ let bare = host.strip_prefix('[').and_then(|h| h.strip_suffix(']')).unwrap_or(&host);
+ let address = match bare.parse::<IpAddr>() {
Ok(ip) => Address::Socket(SocketAddr::new(ip, port)),
A test: a SocksV5 request to https://[::1]:443 must encode ATYP 0x04 with the 16 raw bytes, not ATYP 0x03 with the text [::1].
How it showed up
A Rust server fetching pages through a Tailscale exit node (tailscaled --socks5-server) with reqwest::Proxy::all("socks5://…") and a custom resolver: every host with an AAAA record failed with error sending request (cause: the proxy's "missing port in address"), and hosts with only A records worked. Ordering the resolver's answers IPv4-first works around it.
- 主要言語
- Rust
- スター
- 16.3k
- フォーク
- 1.8k
- 平均マージ
- 2日 5時間
- マージ済み PR(30日)
- 12
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hyperium/hyper のほかの issue
-
C-feature
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
hyperium/hyper#2652 · リアクション 4 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 62/100
メンテナーはふだん 3 日以内に返信
-
C-feature
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
hyperium/hyper#4186 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
HTTP/1 client connection is never closed or pooled when a response completes while the request body is still unsent ((Reading::KeepAlive, Writing::Body) is a terminal state)対応中かも @BlackRabbitCoder が 13 日前に担当しました。 オープンC-bug S-waiting-on-author
hyperium/hyper#4176 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
`Change graceful_shutdown function behavior` PR can cause tonic servers to hang `serve_with_incoming_shutdown` in two different cases再び着手できるかも @seanmonstar が 31 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンA-http2 C-bug
hyperium/hyper#4170 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
似ている issue
-
area:casework bug criticality:p3 triage:needs-implementation
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
registrystack/registry-stack#1623 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
DioxusLabs/anyrender#98 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
leptos-rs/leptos#4885 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
longbridge/gpui-kit#3276 ·
メンテナーはふだん 1 日以内に返信