Skip to content

Dev#81

Open
firefart wants to merge 11 commits into
mainfrom
dev
Open

Dev#81
firefart wants to merge 11 commits into
mainfrom
dev

Conversation

@firefart
Copy link
Copy Markdown
Owner

@firefart firefart commented May 7, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 7, 2026 16:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR strengthens the STUN/TURN implementation by hardening parsing/formatting paths against malformed inputs, aligning behavior with multiple RFC requirements, and adding a comprehensive suite of RFC-derived tests to lock in correct wire encoding/decoding.

Changes:

  • Hardened STUN/TURN parsing and attribute stringification with bounds checks and RFC validations (magic cookie, top-bit validation, ChannelData padding).
  • Corrected TURN semantics and protocol encodings (e.g., Send as Indication; REQUESTED-TRANSPORT and LIFETIME handling).
  • Added extensive unit tests covering STUN/TURN/TURN-TCP/RFC test vectors and option validation.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/types_stun.go Adds bounds checks and RFC-correct formatting for several attributes; improves ParseError safety; fixes constant typo.
internal/types_stun_test.go Adds regression tests for ParseError and Attribute.String edge cases.
internal/stun.go Changes TransactionID generation and MESSAGE-INTEGRITY placeholder handling during serialization.
internal/stun_test.go Adds tests for GetAttribute/GetErrorString and serialize/parse round-trips (authenticated + unauthenticated).
internal/rfc6156_test.go Adds RFC 6156 coverage for REQUESTED-ADDRESS-FAMILY constants and encoding rules.
internal/rfc6062_test.go Adds RFC 6062 coverage for TURN-TCP method/attribute constants and ConnectionBind flows.
internal/rfc5769_test.go Adds RFC 5769 test vectors for XOR address decoding and MESSAGE-INTEGRITY HMAC.
internal/rfc5766_test.go Adds RFC 5766 tests for SEND indication semantics, REQUESTED-TRANSPORT, CHANNEL-NUMBER, and ChannelData padding.
internal/requests_turn.go Fixes SendRequest message class to Indication per RFC 5766.
internal/requests_test.go Adds tests for request factory functions across STUN/TURN/TURN-TCP.
internal/parsers_turn.go Updates ChannelData parsing to tolerate RFC padding and slice to reported length.
internal/parsers_turn_test.go Adds ExtractChannelData parsing tests including padding acceptance.
internal/parsers_stun.go Adds STUN top-bit + magic-cookie validation and safer attribute parsing bounds checks.
internal/parsers_stun_test.go Adds parseAttributes bounds/regression tests.
internal/helpers_turntcp.go Improves connection cleanup on error paths; validates CONNECTION-ID size.
internal/helpers_turn.go Avoids sharing MagicCookie slice backing array by cloning before appending.
internal/helpers_turn_test.go Adds tests for mapped address parsing and XOR address edge cases.
internal/helpers_string_test.go Adds tests for stringification helpers (methods/classes/attributes).
internal/helper/iphelper_test.go Adds tests for IP iterator and private IP generation helpers.
internal/helper/helper.go Adds RandomBytes helper for crypto-random byte generation.
internal/helper/helper_test.go Adds tests for IsPrintable/RandomString/IsPrivateIP and updates imports.
internal/cmd/validate_test.go Adds tests for CLI option validation across multiple commands.
internal/cmd/bruteforce.go Ensures connection is closed; improves error parsing/logging for Allocate failures.
go.mod Bumps Go language version directive.
CLAUDE.md Adds repository guidance (commands, architecture notes, linting constraints).

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

Comment thread internal/parsers_turn.go
Comment thread internal/stun.go
Comment thread internal/parsers_stun.go
Comment thread internal/cmd/bruteforce.go Outdated
Comment thread internal/types_stun_test.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
firefart and others added 3 commits May 7, 2026 19:03
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

3 participants