feat(turn): add TCP TURN client example and expose server/local addr#83
feat(turn): add TCP TURN client example and expose server/local addr#83nightness wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a TCP-based TURN client example and exposes client address accessors to support TURN-over-TCP fallback scenarios (e.g., UDP blocked by corporate firewalls).
Changes:
- Added
turn_client_tcpexample demonstrating TURN relay over TCP with RFC4571 framing. - Exposed
Client::turn_server_addr()andClient::local_addr()accessors. - Updated internal call sites to handle
turn_server_addr()now returningOption<SocketAddr>.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| rtc-turn/src/client/relay.rs | Updates TURN server address retrieval to handle Option and map to ErrNilTurnSocket. |
| rtc-turn/src/client/mod.rs | Exposes turn_server_addr() / local_addr() publicly and adjusts transactions to use the new return type. |
| rtc-turn/examples/turn_client_tcp.rs | New example implementing TURN client over TCP (RFC6062) with RFC4571 framing. |
| rtc-turn/Cargo.toml | Registers the new turn_client_tcp example target. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #83 +/- ##
==========================================
- Coverage 71.17% 71.07% -0.10%
==========================================
Files 442 443 +1
Lines 67330 67468 +138
==========================================
+ Hits 47922 47953 +31
- Misses 19408 19515 +107 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Replace unwrap() on log level parse with proper error message
- Use split_once('=') for --user flag to avoid panic on malformed input
- Simplify ctrlc handler: use unbounded channel, no thread wrapper needed
- Extract turn_server_addr_or_err() helper to deduplicate repeated pattern
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ocal_addr - Add rtc-turn/examples/turn_client_tcp.rs: demonstrates TURN over TCP using RFC 4571 framing (TcpFrameDecoder + frame_packet from rtc-shared) - Make Client::turn_server_addr() and Client::local_addr() public so callers (e.g. the ICE gatherer in the async layer) can identify TURN server addresses - Fix relay.rs and mod.rs call sites from the return-type change (Result → Option for turn_server_addr) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace unwrap() on log level parse with proper error message
- Use split_once('=') for --user flag to avoid panic on malformed input
- Simplify ctrlc handler: use unbounded channel, no thread wrapper needed
- Extract turn_server_addr_or_err() helper to deduplicate repeated pattern
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix invalid email TLD in clap author metadata (brainwires@github -> .com) - Fix non-blocking write_all by using blocking writes with timeout - Fix EOF spin: read_tcp_input now returns Err on EOF to break main loop - Add 5 unit tests for turn_server_addr(), turn_server_addr_or_err(), local_addr() Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
76ad3f5 to
dc27c09
Compare
|
Rebased onto upstream/master so this PR contains only its own changes. Previous branch structure caused merge conflicts when PRs were merged in sequence. Each PR is now independently mergeable. |
Summary
examples/turn_client_tcp.rsdemonstrating TURN relay over TCPturn_server_addr()andlocal_addr()accessors on the TURN clientReview feedback addressed
unwrap()on--log-levelparse with friendly errorsplit_once('=')for--userto avoid panic on malformed inputctrlchandler: unbounded channel, no thread wrapperturn_server_addr_or_err()helper to deduplicate repeated patterncargo fmt/cargo clippypass cleanwrite_all()WouldBlock risk: use blocking writes with timeoutread_tcp_input()now returnsErron EOF to break main loopturn_server_addr(),turn_server_addr_or_err(),local_addr()Test plan
cargo build --example turn_client_tcp -p rtc-turncargo test -p rtc-turn(39 tests pass, including 5 new accessor tests)Generated with Claude Code