mirror of
https://github.com/peterlodri-sec/happy-eyeballs.git
synced 2026-11-22 00:09:57 +01:00
State machine implementation of Happy Eyeballs v3 in Rust
- Rust 99.8%
- Dockerfile 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Bumps the mozilla-actions group with 12 updates in the / directory: | Package | From | To | | --- | --- | --- | | [mozilla/actions/.github/workflows/claude-review.yml](https://github.com/mozilla/actions) | `3.1.1` | `3.2.0` | | [mozilla/actions/.github/workflows/mutants.yml](https://github.com/mozilla/actions) | `3.1.1` | `3.2.0` | | [mozilla/actions/rust](https://github.com/mozilla/actions) | `3.1.1` | `3.2.0` | | [mozilla/actions/.github/workflows/rustfmt.yml](https://github.com/mozilla/actions) | `3.1.1` | `3.2.0` | | [mozilla/actions/.github/workflows/clippy.yml](https://github.com/mozilla/actions) | `3.1.1` | `3.2.0` | | [mozilla/actions/.github/workflows/deny.yml](https://github.com/mozilla/actions) | `3.1.1` | `3.2.0` | | [mozilla/actions/.github/workflows/machete.yml](https://github.com/mozilla/actions) | `3.1.1` | `3.2.0` | | [mozilla/actions/semver](https://github.com/mozilla/actions) | `3.1.1` | `3.2.0` | | [mozilla/actions/.github/workflows/mutants-pr.yml](https://github.com/mozilla/actions) | `3.1.1` | `3.2.0` | | [mozilla/actions/.github/workflows/dependency-review.yml](https://github.com/mozilla/actions) | `3.1.1` | `3.2.0` | | [mozilla/actions/.github/workflows/actionlint.yml](https://github.com/mozilla/actions) | `3.1.1` | `3.2.0` | | [mozilla/actions/.github/workflows/sbom.yml](https://github.com/mozilla/actions) | `3.1.1` | `3.2.0` | Updates `mozilla/actions/.github/workflows/claude-review.yml` from 3.1.1 to 3.2.0 - [Release notes](https://github.com/mozilla/actions/releases) - [Commits]( |
||
| .github | ||
| .oss-scanner | ||
| src | ||
| tests | ||
| .clippy.toml | ||
| .codecov.yml | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CODE_OF_CONDUCT.md | ||
| deny.toml | ||
| LICENSE-APACHE | ||
| LICENSE-MIT | ||
| README.md | ||
Happy Eyeballs v3 Implementation
This crate provides an implementation of Happy Eyeballs v3 as specified in draft-ietf-happy-happyeyeballs-v3-02.
It is implemented as a deterministic, pure state machine. The caller drives all I/O and timers. Current time is explicitly provided by the caller. The state machine itself performs no side effects (e.g. network calls or blocking operations).
Happy Eyeballs v3 is an algorithm for improving the performance of dual-stack applications by racing IPv4 and IPv6 connections while optimizing for modern network conditions including HTTPS service discovery and QUIC.
Usage
let mut he = HappyEyeballs::new("example.com", 443).unwrap();
let now = Instant::now();
// First process outputs from the state machine, e.g. a DNS query to send:
while let Some(output) = he.process_output(now) {
match output {
Output::SendDnsQuery { id, hostname, record_type } => {
// Send DNS query.
}
Output::AttemptConnection { id, endpoint, is_ech_retry } => {
// Attempt connection.
}
_ => {}
}
}
// Later pass results as input back to the state machine, e.g. a DNS
// response arrives:
he.process_input(Input::DnsResult { id: dns_id.unwrap(), result: dns_result }, Instant::now());
For complete example usage, see the tests/.