Skip to content

APP-coturn-staging-routing: add dialdbg relay testing flags and fix panics#170

Draft
danielbotros wants to merge 1 commit intomainfrom
APP-coturn-staging-routing
Draft

APP-coturn-staging-routing: add dialdbg relay testing flags and fix panics#170
danielbotros wants to merge 1 commit intomainfrom
APP-coturn-staging-routing

Conversation

@danielbotros
Copy link
Member

@danielbotros danielbotros commented Mar 20, 2026

WIP

Summary

  • Add --force-relay, --force-p2p, --relay-host, --signaling-server, --disable-mdns flags to viam-dialdbg for targeted TURN relay testing
  • Fix auth in dial.rs: when signaling_server_override is set, authenticate against the override server rather than the robot FQDN
  • Fix port stripping bug in dial.rs: use .host() instead of .authority() so the rpc-host/domain header does not include the port number
  • Fix panic in stats.rs: use checked_duration_since().unwrap_or_default() to avoid panicking when a candidate timestamp is newer than Instant::now()

Background

Investigation into why rust-utils panicked when making TURN relay connections against coturn v3.9.0 (worked on v3.6.1).

Root cause: RFC 8656 enforcement in coturn 3.9.0 rejects CREATE_PERMISSION requests targeting private/loopback IPs with a STUN 403 error. Due to a coturn 3.9.0 bug, the 403 reason phrase contains 0xffffffff (invalid UTF-8) instead of the ASCII string "Forbidden". The stun-0.7.0 crate's ErrorCodeAttribute::fmt returns Err(fmt::Error) on non-UTF-8 bytes; turn-0.9.0's relay_conn.rs then calls format!() on that broken Display impl, which panics.

The --force-relay and --relay-host flags were added so the TURN relay path can be exercised directly from viam-dialdbg for future testing.

Test plan

  • cargo build --features dialdbg compiles cleanly
  • viam-dialdbg --force-relay --relay-host <turn-host> <robot-fqdn> establishes a relay connection
  • viam-dialdbg --force-p2p <robot-fqdn> falls back to direct P2P (no TURN servers)
  • viam-dialdbg --signaling-server localhost:8081 <robot-fqdn> dials against a local app instance without auth panics

🤖 Generated with Claude Code

…anics

- Add --force-relay, --force-p2p, --relay-host, --signaling-server, --disable-mdns
  flags to viam-dialdbg CLI for targeted TURN relay testing
- Apply relay-only ICE transport policy when --force-relay is set
- Filter ICE servers by host substring when --relay-host is set
- Fix auth: when signaling_server_override is set, authenticate against
  the override server instead of the robot's FQDN
- Fix port stripping: use .host() instead of full authority so the rpc-host
  header does not include the port number
- Fix stats.rs panic: use checked_duration_since to avoid panicking when
  a candidate timestamp is newer than now

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@danielbotros danielbotros requested a review from a team as a code owner March 20, 2026 20:35
@danielbotros danielbotros marked this pull request as draft March 20, 2026 21:45
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.

1 participant