Files
firezone/rust/relay
dependabot[bot] d76c94d057 chore(deps): bump axum from 0.6.20 to 0.7.3 in /rust (#3068)
Bumps [axum](https://github.com/tokio-rs/axum) from 0.6.20 to 0.7.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/tokio-rs/axum/releases">axum's
releases</a>.</em></p>
<blockquote>
<h2>axum-extra - v0.7.3</h2>
<ul>
<li><strong>added:</strong> Implement <code>Deref</code> and
<code>DerefMut</code> for built-in extractors (<a
href="https://redirect.github.com/tokio-rs/axum/issues/1922">#1922</a>)</li>
<li><strong>added:</strong> Add <code>OptionalPath</code> extractor (<a
href="https://redirect.github.com/tokio-rs/axum/issues/1889">#1889</a>)</li>
</ul>
<p><a
href="https://redirect.github.com/tokio-rs/axum/issues/1889">#1889</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/1889">tokio-rs/axum#1889</a>
<a
href="https://redirect.github.com/tokio-rs/axum/issues/1922">#1922</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/1922">tokio-rs/axum#1922</a></p>
<h2>axum - v0.7.3</h2>
<ul>
<li><strong>added:</strong> <code>Body</code> implements
<code>From&lt;()&gt;</code> now (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2411">#2411</a>)</li>
<li><strong>change:</strong> Update version of multer used internally
for multipart (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2433">#2433</a>)</li>
<li><strong>change:</strong> Update tokio-tungstenite to 0.21 (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2435">#2435</a>)</li>
<li><strong>added:</strong> Enable <code>tracing</code> feature by
default (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2460">#2460</a>)</li>
<li><strong>added:</strong> Support graceful shutdown on
<code>serve</code> (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2398">#2398</a>)</li>
<li><strong>added:</strong> <code>RouterIntoService</code> implements
<code>Clone</code> (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2456">#2456</a>)</li>
</ul>
<p><a
href="https://redirect.github.com/tokio-rs/axum/issues/2411">#2411</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/2411">tokio-rs/axum#2411</a>
<a
href="https://redirect.github.com/tokio-rs/axum/issues/2433">#2433</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/2433">tokio-rs/axum#2433</a>
<a
href="https://redirect.github.com/tokio-rs/axum/issues/2435">#2435</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/2435">tokio-rs/axum#2435</a>
<a
href="https://redirect.github.com/tokio-rs/axum/issues/2460">#2460</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/2460">tokio-rs/axum#2460</a>
<a
href="https://redirect.github.com/tokio-rs/axum/issues/2398">#2398</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/2398">tokio-rs/axum#2398</a>
<a
href="https://redirect.github.com/tokio-rs/axum/issues/2456">#2456</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/2456">tokio-rs/axum#2456</a></p>
<h2>axum-extra - v0.7.2</h2>
<ul>
<li><strong>added:</strong> Implement <code>IntoResponse</code> for
<code>MultipartError</code> (<a
href="https://redirect.github.com/tokio-rs/axum/issues/1861">#1861</a>)</li>
</ul>
<p><a
href="https://redirect.github.com/tokio-rs/axum/issues/1861">#1861</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/1861">tokio-rs/axum#1861</a></p>
<h2>axum - v0.7.2</h2>
<ul>
<li><strong>added:</strong> Add <code>axum::body::to_bytes</code> (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2373">#2373</a>)</li>
<li><strong>fixed:</strong> Gracefully handle accept errors in
<code>serve</code> (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2400">#2400</a>)</li>
</ul>
<p><a
href="https://redirect.github.com/tokio-rs/axum/issues/2373">#2373</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/2373">tokio-rs/axum#2373</a>
<a
href="https://redirect.github.com/tokio-rs/axum/issues/2400">#2400</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/2400">tokio-rs/axum#2400</a></p>
<h2>axum-extra - v0.7.1</h2>
<ul>
<li>Updated to latest <code>axum-macros</code></li>
</ul>
<h2>axum - v0.7.1</h2>
<ul>
<li><strong>fix</strong>: Fix readme.</li>
</ul>
<h2>axum-extra - v0.7.0</h2>
<ul>
<li><strong>breaking:</strong> Remove the <code>spa</code> feature which
should have been removed in 0.6.0 (<a
href="https://redirect.github.com/tokio-rs/axum/issues/1802">#1802</a>)</li>
<li><strong>added:</strong> Add <code>Multipart</code>. This is similar
to <code>axum::extract::Multipart</code>
except that it enforces field exclusivity at runtime instead of compile
time,
as this improves usability (<a
href="https://redirect.github.com/tokio-rs/axum/issues/1692">#1692</a>)</li>
<li><strong>added:</strong> Implement <code>Clone</code> for
<code>CookieJar</code>, <code>PrivateCookieJar</code> and
<code>SignedCookieJar</code> (<a
href="https://redirect.github.com/tokio-rs/axum/issues/1808">#1808</a>)</li>
<li><strong>fixed:</strong> Add <code>#[must_use]</code> attributes to
types that do nothing unless used (<a
href="https://redirect.github.com/tokio-rs/axum/issues/1809">#1809</a>)</li>
</ul>
<p><a
href="https://redirect.github.com/tokio-rs/axum/issues/1692">#1692</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/1692">tokio-rs/axum#1692</a>
<a
href="https://redirect.github.com/tokio-rs/axum/issues/1802">#1802</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/1802">tokio-rs/axum#1802</a></p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="fe89ab5592"><code>fe89ab5</code></a>
Release (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2461">#2461</a>)</li>
<li><a
href="b494d455cc"><code>b494d45</code></a>
Implement <code>Clone</code> for <code>RouterIntoService</code> (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2456">#2456</a>)</li>
<li><a
href="560213a7b7"><code>560213a</code></a>
docs: add clarification about building middleware and error types (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2448">#2448</a>)</li>
<li><a
href="ea6dd51e98"><code>ea6dd51</code></a>
Enable tracing by default (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2460">#2460</a>)</li>
<li><a
href="12e8c6219d"><code>12e8c62</code></a>
Support graceful shutdown on <code>serve</code> (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2398">#2398</a>)</li>
<li><a
href="56159b0d4e"><code>56159b0</code></a>
JsonDeserializer extractor for zero-copy deserialization (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2431">#2431</a>)</li>
<li><a
href="c3db223532"><code>c3db223</code></a>
Rework error handling example (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2382">#2382</a>)</li>
<li><a
href="6c276c3ff0"><code>6c276c3</code></a>
Updated docs regarding constraints of Handler arguments (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2451">#2451</a>)</li>
<li><a
href="4f010d9b2d"><code>4f010d9</code></a>
Updating <code>tls-rustls</code> example (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2457">#2457</a>)</li>
<li><a
href="3fda093806"><code>3fda093</code></a>
Use separate lexical scope for lock guard in docs (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2439">#2439</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/tokio-rs/axum/compare/axum-v0.6.20...axum-v0.7.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=axum&package-manager=cargo&previous-version=0.6.20&new-version=0.7.3)](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>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-01-15 03:31:32 +00: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 relay using: cargo build --release --bin firezone-relay

You should then find a binary in target/release/firezone-relay.

Running

The Firezone Relay supports Linux only. To run the Relay binary on your Linux host:

  1. Generate a new Relay token from the "Relays" section of the admin portal and save it in your secrets manager.
  2. Ensure the FIREZONE_TOKEN=<relay_token> environment variable is set securely in your Relay's shell environment. The Relay expects this variable at startup.
  3. Now, you can start the Firezone Relay with:
firezone-relay

To view more advanced configuration options pass the --help flag:

firezone-relay --help

Ports

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 token, the relay will connect to the Firezone portal 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.