Files
firezone/rust/relay
dependabot[bot] a3aa6721c0 build(deps): Bump sha2 from 0.10.7 to 0.10.8 in /rust (#2220)
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.10.7 to
0.10.8.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="28a7b0da94"><code>28a7b0d</code></a>
Update Cargo.lock</li>
<li><a
href="c6decdf36f"><code>c6decdf</code></a>
sha2: Add inline-asm backend for LoongArch64 targets (<a
href="https://redirect.github.com/RustCrypto/hashes/issues/507">#507</a>)</li>
<li><a
href="026b0e81e9"><code>026b0e8</code></a>
md5: minor code tweaks, bump to v0.10.6 (<a
href="https://redirect.github.com/RustCrypto/hashes/issues/506">#506</a>)</li>
<li><a
href="a24e8b73a6"><code>a24e8b7</code></a>
md5: Add inline-asm backend for LoongArch64 targets (<a
href="https://redirect.github.com/RustCrypto/hashes/issues/505">#505</a>)</li>
<li><a
href="7aba4b5271"><code>7aba4b5</code></a>
Add asm!-based backend for LoongArch64 targets (<a
href="https://redirect.github.com/RustCrypto/hashes/issues/504">#504</a>)</li>
<li><a
href="dcfd5a5016"><code>dcfd5a5</code></a>
build(deps): bump actions/checkout from 3 to 4 (<a
href="https://redirect.github.com/RustCrypto/hashes/issues/501">#501</a>)</li>
<li><a
href="4372c776a5"><code>4372c77</code></a>
CI: replace MIPS cross tests with PPC32 (<a
href="https://redirect.github.com/RustCrypto/hashes/issues/503">#503</a>)</li>
<li><a
href="42d3a25a4e"><code>42d3a25</code></a>
k12: fix incorrect hash calculation (<a
href="https://redirect.github.com/RustCrypto/hashes/issues/499">#499</a>)</li>
<li><a
href="342dbfabd4"><code>342dbfa</code></a>
Update asm dependencies (<a
href="https://redirect.github.com/RustCrypto/hashes/issues/498">#498</a>)</li>
<li><a
href="59176e068a"><code>59176e0</code></a>
Update Clippy and fix lints</li>
<li>Additional commits viewable in <a
href="https://github.com/RustCrypto/hashes/compare/sha2-v0.10.7...sha2-v0.10.8">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=sha2&package-manager=cargo&previous-version=0.10.7&new-version=0.10.8)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 16:30:29 -03:00
..

relay

This crate houses a minimalistic STUN & TURN server.

Features

We aim to support the following feature set:

  • STUN binding requests
  • TURN allocate requests
  • TURN refresh requests
  • TURN channel bind requests
  • TURN channel data requests

Relaying of data through other means such as DATA frames is not supported.

Building

You can build the server using: cargo build --release --bin relay

Running

For an up-to-date documentation on the available configurations options and a detailed help text, run cargo run --bin relay -- --help. All command-line options can be overridden using environment variables. Those variables are listed in the --help output at the bottom of each command.

The relay listens on port 3478. This is the standard port for STUN/TURN and not configurable. Additionally, the relay needs to have access to the port range 49152 - 65535 for the allocations.

Portal connection

When given a portal endpoint, the relay will connect to it and wait for an init message before commencing relay operations.

Design

The relay is designed in a sans-IO fashion, meaning the core components do not cause side effects but operate as pure, synchronous state machines. They take in data and emit commands: wake me at this point in time, send these bytes to this peer, etc.

This allows us to very easily unit-test all kinds of scenarios because all inputs are simple values.

The main server runs in a single task and spawns one additional task for each allocation. Incoming data that needs to be relayed is forwarded to the main task where it gets authenticated and relayed on success.