Skip to content

Conversation

@dshulyak
Copy link
Contributor

@dshulyak dshulyak commented Jul 31, 2025

dnkolegov-ar
dnkolegov-ar previously approved these changes Aug 8, 2025
@dshulyak dshulyak marked this pull request as ready for review August 12, 2025 06:39
Copilot AI review requested due to automatic review settings August 21, 2025 13:56
Copy link

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 introduces a comprehensive specification for an authenticated peer-to-peer UDP protocol designed to address denial-of-service protection and traffic prioritization in RaptorCast communication. The protocol follows the WireGuard design with modifications to support secp256k1 keys and AEGIS128L encryption for improved performance.

Key changes:

  • Defines a complete authenticated UDP protocol using Noise IK handshake pattern with secp256k1, AEGIS128L, and BLAKE3
  • Implements DoS protection through cookie-based rate limiting and session management
  • Provides integration specifications for RaptorCast and discovery services

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- remove special validators session handling during high load
- updated under load rate limit threshold to 2000 rps
- more efficient cookie nonce generation
- restructured data packet, auth tag is a part of header

```mermaid
packet-beta
0: "1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be Type as in the Field descriptions?

- MAC1: Authentication of entire packet using initiator's static key hash
- MAC2: Cookie response MAC, empty unless under load (DoS protection)

Session establishment follows the Noise IK handshake pattern:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Session establishment follows the Noise IK handshake pattern:
Session establishment follows the NoiseIKpsk2 handshake pattern:

```rust
let temp = keyed_hash(&chaining_key, &[]);
let temp2 = keyed_hash(&temp, &[0x1]);
let send_key = keyed_hash(&temp, &[&temp2, &[0x2]].concat());
Copy link
Contributor

Choose a reason for hiding this comment

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

In WireGuard, these keys are calculated differently. It should be

let temp = keyed_hash(&chaining_key, &[]);
let send_key = keyed_hash(&temp, &[0x1]);
let recv_key = keyed_hash(&temp, &[&send_key, &[0x2]].concat());

Is it intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, i will revert to wireguard specification, i can't recall now if i reused it from somewhere or just mistyped

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.

2 participants