Commit Graph

610 Commits

Author SHA1 Message Date
dependabot[bot]
9e7f71f874 build(deps): Bump tauri-utils from 1.5.2 to 1.5.3 in /rust (#3767)
Bumps [tauri-utils](https://github.com/tauri-apps/tauri) from 1.5.2 to
1.5.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/tauri-apps/tauri/releases">tauri-utils's
releases</a>.</em></p>
<blockquote>
<h2>tauri-utils v1.5.3</h2>
<p>Updating crates.io index</p>
<!-- raw HTML omitted -->
<pre><code>Fetching advisory database from
`https://github.com/RustSec/advisory-db.git`
Loaded 603 security advisories (from /home/runner/.cargo/advisory-db)
    Updating crates.io index
    Scanning Cargo.lock for vulnerabilities (581 crate dependencies)
Crate:     atty
Version:   0.2.14
Warning:   unsound
Title:     Potential unaligned read
Date:      2021-07-04
ID:        RUSTSEC-2021-0145
URL:       https://rustsec.org/advisories/RUSTSEC-2021-0145
Dependency tree:
atty 0.2.14
└── clap 3.2.25
    └── tauri 1.6.0
        ├── tauri 1.6.0
        ├── restart 0.1.0
        └── app-updater 0.1.0
<p>warning: 1 allowed warning found
</code></pre></p>
<!-- raw HTML omitted -->
<h2>[1.5.3]</h2>
<h3>New features</h3>
<ul>
<li><a
href="7aa30dec85"><code>7aa30dec</code></a>(<a
href="https://redirect.github.com/tauri-apps/tauri/pull/8620">#8620</a>)
Add <code>priority</code>, <code>section</code> and
<code>changelog</code> options in Debian config.</li>
</ul>
<!-- raw HTML omitted -->
<pre><code>Updating crates.io index
Packaging tauri-utils v1.5.3
(/home/runner/work/tauri/tauri/core/tauri-utils)
Verifying tauri-utils v1.5.3
(/home/runner/work/tauri/tauri/core/tauri-utils)
    Updating crates.io index
 Downloading crates ...
  Downloaded phf_codegen v0.8.0
  Downloaded phf v0.8.0
  Downloaded nodrop v0.1.14
  Downloaded phf_generator v0.11.2
  Downloaded itoa v0.4.8
&lt;/tr&gt;&lt;/table&gt; 
</code></pre>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="a4b82d9dba"><code>a4b82d9</code></a>
chore: bump tauri-utils</li>
<li><a
href="b735b6799f"><code>b735b67</code></a>
Apply Version Updates From Current Changes (v1) (<a
href="https://redirect.github.com/tauri-apps/tauri/issues/8475">#8475</a>)</li>
<li><a
href="7b5e8712e7"><code>7b5e871</code></a>
ci: update msrv test and cargo.lock</li>
<li><a
href="2421073576"><code>2421073</code></a>
fix(macos): use BTreeMap for windows map to prevent crash on idle (<a
href="https://redirect.github.com/tauri-apps/tauri/issues/8117">#8117</a>)</li>
<li><a
href="510b62261c"><code>510b622</code></a>
chore(core): Add missing changefile for <a
href="https://redirect.github.com/tauri-apps/tauri/issues/8546">#8546</a>
(<a
href="https://redirect.github.com/tauri-apps/tauri/issues/8822">#8822</a>)</li>
<li><a
href="b0f27814b9"><code>b0f2781</code></a>
fix(cli): map <code>--profile dev</code> to <code>debug</code> folder
when finding executable (<a
href="https://redirect.github.com/tauri-apps/tauri/issues/8776">#8776</a>)</li>
<li><a
href="cc3d8e7731"><code>cc3d8e7</code></a>
fix(core): Command::output suspend while wait for response (<a
href="https://redirect.github.com/tauri-apps/tauri/issues/8539">#8539</a>)</li>
<li><a
href="8ce51cec3b"><code>8ce51ce</code></a>
feat: retain cli args when relaunching after update, closes <a
href="https://redirect.github.com/tauri-apps/tauri/issues/7402">#7402</a>
(<a
href="https://redirect.github.com/tauri-apps/tauri/issues/7718">#7718</a>)</li>
<li><a
href="0bff8c325d"><code>0bff8c3</code></a>
fix(cli): Ignore query parameter in dev server (<a
href="https://redirect.github.com/tauri-apps/tauri/issues/8697">#8697</a>)</li>
<li><a
href="a9b2c0625c"><code>a9b2c06</code></a>
chore: Commit Cargo.lock (<a
href="https://redirect.github.com/tauri-apps/tauri/issues/8586">#8586</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/tauri-apps/tauri/compare/tauri-utils-v1.5.2...tauri-utils-v1.5.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tauri-utils&package-manager=cargo&previous-version=1.5.2&new-version=1.5.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 this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-26 17:50:43 +00:00
Gabi
5edd195320 refactor(connlib): unify peer storage (#3738)
Now that we have `&mut` access everywhere in the tunnel, the remaining
shared-memory and locks are in how we store peers. To resolve this, we
introduce a new `PeerStore` that allows us to look up peers by IP and by
ID.
2024-02-26 16:07:38 +00:00
Thomas Eizinger
220c9ee1e1 fix(connlib): correctly handle GRO (#3732)
With the use of `quinn-udp`, we are actually already using GRO for
reading packets from the UDP socket. Especially during a test like
iperf, it is thus very likely to read multiple packets from the same
peer in a single syscall. In that case, `stride` tells us how they are
split.

Without handling `stride` correctly, we would be feeding multiple
packets at once to boringtun which would (obviously) choke on it because
its checksum verification fails.

It turns out we can actually handle this quite nicely by returning an
`Iterator<Item = Received>` and decapsulating them one-by-one.
2024-02-26 03:40:09 +00:00
Thomas Eizinger
0ded6ad79d refactor(snownet): be more explicit about dispatching messages (#3741)
As part of handling an incoming packet, `snownet` has to go through
several steps:

1. The packet might be a control message from a STUN server, we handle
that first.
2. The packet might from a TURN server, which could either be a control
message or a channel-data message.
The former should be handled directly where as the latter needs to
unpacked and passed along further.
3. Once potentially unpacked, the packet could be a STUN message for an
ICE agent of one of our connections.
4. Lastly, the packet might be a wireguard payload from one of our
connections.

Previously, we handled all of that in one big function which resulted in
us sometimes "falling through" to the next branch when we didn't want
that. For example, if a message is from a TURN server's address, it MUST
be a control or channel data message but it can never be a wireguard
packet. In certain circumstances, we don't detect that though. For
example, if a channel is not yet bound, we refuse to decapsulate the
message which results in us incorrectly passing on the message to later
stages.

We refactor the handling into individual functions and explicitly signal
to the upper layer using `ControlFlow`, whether we should continue or
abort.

As an added benefit, this allows us to remove the "memory" of timed-out
control messages in `StunBinding` and `Allocation`.
2024-02-23 21:26:11 +00:00
Reactor Scram
5375415959 build: enable Tauri dep for Linux and alphabetize deps (#3742)
Waiting on #3735 
I think this change is what triggers `cargo chef` to get confused
(#3740)

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-02-23 20:22:45 +00:00
Gabi
03ea93d0bd fix(ci): phoenix channel tests not running (#3749)
Similar to #3747
2024-02-23 20:15:31 +00:00
Reactor Scram
da242e0bef fix(gui-client): remove duplicated script (#3745)
This was moved up to the main `/scripts/tests` dir and combined with
some other automated tests, so this is redundant now. Due to a merge
conflict or some small oversight I accidentally left the original file
in place too.
2024-02-23 20:11:50 +00:00
Gabi
4c0c8391d5 fix(relay): update tests for current values (#3746)
In #3726 this value was increased but the test didn't reflect that.

I've not the slightest idea how this is passing on CI. It isn't locally.

Now I have an Idea, relay tests aren't run on CI.
2024-02-23 18:02:47 +00:00
Reactor Scram
fd31152106 refactor(ci): enable Linux do-nothing GUI builds (but not tests) in CI/CD, extract scripts for that (#3735)
Builds a do-nothing `return 0` Linux client to make sure the CI/CD
scripts are set up and producing AppImage / deb bundles as expected.


![image](https://github.com/firezone/firezone/assets/13400041/7d2d8f02-adde-4b1b-89ec-02aaf112ac48)

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-02-23 17:57:39 +00:00
Reactor Scram
7825710a69 refactor(GUI clients): extract known_dirs module (#3734)
The CI tests aren't running for Linux just yet.
This organizes the well-known directories used on Linux and Windows for
logs, config, etc., and adds them to the (unused) Linux smoke test

Waiting on #3727

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-02-23 17:31:35 +00:00
Reactor Scram
90b2bdb9b1 test(windows): make sure files are written to the right paths during smoke tests (#3727)
I will need to set up the same paths for Linux, (#3734) and I want an
automated test to make sure everything gets into the right directories.

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-02-23 16:14:20 +00:00
Reactor Scram
4ecdde3653 ci: change cargo chef call so it will ignore the GUI client (#3740)
I don't know much about `cargo chef` so I gave this its own PR in case
I'm doing something that'll subtly break it
I've run into this problem on some branches and not others, where it's
trying to build all the Tauri / glib stuff even though the Docker image
won't need it:
https://github.com/firezone/firezone/actions/runs/8012206575/job/21887478015#step:7:1175
2024-02-23 16:08:21 +00:00
Gabi
d16fb616d3 connlib: remove tun mutex (#3743)
extracted from #3738
2024-02-23 15:48:27 +00:00
Gabi
781810f918 feat(dev): add dev yml for rust development (#3670)
Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-02-23 00:25:25 +00:00
Reactor Scram
835cd548ef chore: make rtnetlink versions explicit (#3736)
If I do `rm Cargo.lock && cargo check --all` then I get errors about
rtnetlink.


![image](https://github.com/firezone/firezone/assets/13400041/c1eeff84-d65c-403d-9b33-24e00168ba36)

Dependabot tried to update these a couple weeks ago in #3558 and it had
some conflicts, so I'm just making the old versions explicit so that
redoing the lockfile won't break anything.

This is because I got into a weird state with the new `dirs` dependency
for Linux where I removed it from Cargo.toml, but it was still in the
lockfile or something, so the program built even though it should not
have. And then when I tried to rebuild Cargo.lock I got these errors
about rtnetlink.
2024-02-22 22:32:34 +00:00
Thomas Eizinger
2264eeebc3 chore(snownet): reuse RingBuffer (#3725)
Previously, we eagerly created a channel bind message and then buffered
it if we didn't have an allocation. That resulted in some duplicated
checks once we did end up sending the message.

To avoid this, we remove the dedicated `BufferedChannelBindings` struct
and instead use the newly added `RingBuffer`. Whilst we are at it, we
also increase the number of buffered messages to avoid dropping them too
early.
2024-02-22 21:26:41 +00:00
Reactor Scram
4106419ef1 refactor: rename windows-client to gui-client (#3721)
This may cause conflicts with all my other PRs but it has to happen.

```[tasklist]
- [ ] Update test names in branch protection (I don't think I have perms for this)
```
2024-02-22 20:21:27 +00:00
Reactor Scram
6925af88ea test: add mock token storage for CI tests on Ubuntu (#3720)
Setting up gnome-keyring in CI is tricky. I'll fix it later. For now,
this allows other tests to pass in CI on Ubuntu.
2024-02-22 16:04:16 +00:00
Reactor Scram
bee2dabf4c refactor(ci): extract setup-tauri action and generalize Windows builds (#3702)
This prevents duplication for different Tauri jobs like building the
release packages vs testing a debug build with mock keyring.

```[tasklist]
- [ ] Fix branch protection rules for changed tests
```

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-02-22 01:59:47 +00:00
Thomas Eizinger
c85348a25f fix(snownet): don't log addresses twice (#3711)
The `from` address is already logged as part of the `decapsulate` span
in the `Node`. The `local` address isn't that interesting thus noise
most of the time.
2024-02-22 01:10:27 +00:00
Thomas Eizinger
b545a36ae7 feat(relay): increase number of allowed requests per nonce (#3726)
In the relay's authentication scheme, each nonce is only valid for a
certain number of requests. This guards against replay attacks.

Currently, this is set to 10 which means all requests after 10 will
receive a "stale nonce" error. 10 turns out to be way to low and greatly
delays the setup of channels and allocations which is always a burst of
messages that end up incurring additional round trips because they all
need to be re-sent with a new nonce.
2024-02-22 01:09:55 +00:00
Gabi
6256d94799 fix(gateway): expire resources (#3722)
I forgot to actually call the expire resources function after the
refactor 🤦

This will be much cleaned up in a PR that I'm working on to eliminate
the `peers_by_id`/`peers_by_ip` maps.

In the mean time let's merge this asap since the gateway not expiring
resources is a security hole.
2024-02-22 00:28:17 +00:00
Thomas Eizinger
09b1d5cf2e feat(snownet): optimise which channels we bind (#3709)
Currently, we bind a lot of TURN channels on our relays because we bind
a channel to each candidate on each relay. With every node having
usually 4 relays, that results in 16 channels per connection just for
the relay candidates.

We can bring this down optimistically by first checking if the remote's
candidate is a relay candidate and happens to be on a relay that we are
also using. In that case, we only bind the channel on that one.

That should also improve latency when data needs to be relayed because
we reduce the number of hops by 1 and don't send traffic between two
relays.

Additionally, there is no reason to bind channels for host candidates.
2024-02-21 22:38:04 +00:00
Reactor Scram
808cbf4ce7 refactor: move BUNDLE_ID since it won't be Windows-specific (#3706)
It is still client-specific, but this was the closest place I could find
in connlib to put it.
A hypothetical GUI / .deb / systemd-involved gateway would need to be
"dev.firezone.gateway"
2024-02-21 19:50:07 +00:00
Gabi
0cdb8a91fe fix(connlib): set the real packet length before putting it into the device (#3718)
This was fixed at some point in the feature branch but was lost to time.

This is preventing macos from working(and might be causing some issues
in other platforms)
2024-02-21 19:43:24 +00:00
Thomas Eizinger
355edc72b0 fix(snownet): make TURN channel bindings more reliable (#3708)
Previously, we would only bind channels for _established_ connections.
This caused a problem if we'd get the other parties candidates before
the offer response. Additionally, we'd often send multiple channel
bindings for the same peer which caused additional warnings in the logs.
2024-02-21 02:44:44 +00:00
dependabot[bot]
401ba2b475 build(deps): Bump arboard from 3.3.0 to 3.3.1 in /rust (#3687)
Bumps [arboard](https://github.com/1Password/arboard) from 3.3.0 to
3.3.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/1Password/arboard/releases">arboard's
releases</a>.</em></p>
<blockquote>
<h2>v3.3.1</h2>
<h3>Changed</h3>
<ul>
<li>Updated Windows clipboard and migrated from <code>winapi</code> to
<code>windows-sys</code>.</li>
<li>Internally migrated to Rust 2021 edition.</li>
<li>Significantly improved the crate's error documentation.</li>
<li>Updated <code>core-graphics</code> to <code>0.23</code></li>
<li>Updated <code>x11rb</code> to <code>0.13</code></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/1Password/arboard/compare/v3.3.0...v3.3.1">https://github.com/1Password/arboard/compare/v3.3.0...v3.3.1</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/1Password/arboard/blob/master/CHANGELOG.md">arboard's
changelog</a>.</em></p>
<blockquote>
<h2>3.3.1 on 2024-12-02</h2>
<h3>Changed</h3>
<ul>
<li>Updated Windows clipboard and migrated from <code>winapi</code> to
<code>windows-sys</code>.</li>
<li>Internally migrated to Rust 2021 edition.</li>
<li>Significantly improved the crate's error documentation.</li>
<li>Updated <code>core-graphics</code> to <code>0.23</code></li>
<li>Updated <code>x11rb</code> to <code>0.13</code></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="77e0e078eb"><code>77e0e07</code></a>
Release 3.3.1</li>
<li><a
href="409bd98978"><code>409bd98</code></a>
Update x11rb to 0.13 and core-graphics to 0.23</li>
<li><a
href="bd91f9c438"><code>bd91f9c</code></a>
Increase error documentation on Clipboard type</li>
<li><a
href="a648570ce9"><code>a648570</code></a>
Update CI actions</li>
<li><a
href="0d6725d97f"><code>0d6725d</code></a>
Spell check docs</li>
<li><a
href="a100f2d77c"><code>a100f2d</code></a>
Update clipboard-win to v5 and replace winapi with windows-sys (<a
href="https://redirect.github.com/1Password/arboard/issues/123">#123</a>)</li>
<li><a
href="1b8df75ee2"><code>1b8df75</code></a>
Bump to Rust 2021 edition</li>
<li><a
href="e3f54c3049"><code>e3f54c3</code></a>
Document MSRV of 1.61</li>
<li><a
href="8c475cfd14"><code>8c475cf</code></a>
Make winapi crate optional</li>
<li>See full diff in <a
href="https://github.com/1Password/arboard/compare/v3.3.0...v3.3.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=arboard&package-manager=cargo&previous-version=3.3.0&new-version=3.3.1)](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: Jamil <jamilbk@users.noreply.github.com>
2024-02-21 02:19:22 +00:00
Thomas Eizinger
14756ade20 feat(connlib): filter out relays based on our locally created sockets (#3705)
Currently, we will always try to reach all relays that we are given by
the portal. That creates unnecessary warnings if we don't have
connectivity for a certain IP version.

By filtering based on the IP version of our bound sockets, we can avoid
these warnings in the logs.

---------

Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-02-21 02:18:37 +00:00
Gabi
5db63048d9 refactor(connlib): simplify resource ordering by implementing Ord trait (#3696)
This is a small refactor that could be extracted from the work I'm doing
for #2022

Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-02-21 02:16:57 +00:00
Thomas Eizinger
e766407dfb feat!(portal): return relays as plain socket addresses (#3665)
Extracted out of #3391.

We don't actually need this for #3391 though because we've added a
compatibility layer during deserialization. But, it will be good to
remove that compat layer at some point which means we have to return the
addresses as plain socket addresses. Because that is a breaking change,
I decided to extract this into a different PR.

Co-authored-by: conectado <gabrielalejandro7@gmail.com>

---------

Co-authored-by: conectado <gabrielalejandro7@gmail.com>
2024-02-21 01:31:03 +00:00
Jamil
19a7bac4ae chore(ci): enforce shellscript formatting and style (#3679)
Noticed that we all have different styles of writing scripts :-).

This PR adds linting to our shell scripts to standardize on formatting,
catch common issues and/or possible security bugs.

For editor setup:
- Ensure [`shellcheck`](https://github.com/koalaman/shellcheck) and
[`shfmt`](https://github.com/mvdan/sh) are in your `PATH`
- Configure `shfmt` with indentation of `4`, otherwise it uses tabs by
default.
[Here](https://github.com/jamilbk/nvim/blob/master/init.vim#L159) is how
you can do that with Vim and
[here](https://marketplace.visualstudio.com/items?itemName=mkhl.shfmt)
is how for VScode.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Brian Manifold <bmanifold@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Dryga <andrew@dryga.com>
Co-authored-by: Gabi <gabrielalejandro7@gmail.com>
2024-02-21 01:01:32 +00:00
Thomas Eizinger
179078e72f fix(connlib): set socket to IPv6 only before binding address (#3701)
Binding the IPv6 socket would always fail because we do it _after_ the
IPv4 socket. However, without setting the socket to `IP6_ONLY`, binding
the unspecified IPv6 address (`::`) also wants to bind to IPv4
(depending on the kernel settings). To avoid this, we need to first
configure the socket properly and then bind it to the given address.

Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-02-21 00:19:00 +00:00
dependabot[bot]
2d836e8cde build(deps): Bump ring from 0.17.7 to 0.17.8 in /rust (#3686)
Bumps [ring](https://github.com/briansmith/ring) from 0.17.7 to 0.17.8.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/briansmith/ring/commits">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ring&package-manager=cargo&previous-version=0.17.7&new-version=0.17.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>
2024-02-21 00:00:44 +00:00
Gabi
3d3e737ba3 refactor(connlib): replace webrtc-rs with snownet (#3391)
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

Resolves: #3377.

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-02-20 06:56:31 +00:00
Gabi
10608dc528 fix(snownet): don't trigger busy loop upon refreshing allocation (#3693)
Currently, after the refresh timeout the gateway or client starts
looping forever, since after the refresh timeout is reached the
`poll_timeout` will always return `ALLOCATION_LIFETIME/2`(which would be
"now"), since `allocation_lifetime` is never updated.

To fix this, we need to check whether we currently have a refresh
request in flight before queuing a new one. Additionally, we need to
abort refreshing as soon as the lifetime of the allocation expires.

Related: #3617.
Related: #3631.

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-02-20 01:31:03 +00:00
dependabot[bot]
e3b875eb35 build(deps): Bump semver from 1.0.21 to 1.0.22 in /rust (#3685)
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.21 to 1.0.22.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/dtolnay/semver/releases">semver's
releases</a>.</em></p>
<blockquote>
<h2>1.0.22</h2>
<ul>
<li>Fix unused_imports warnings when compiled by rustc 1.78</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c8ad1bf6db"><code>c8ad1bf</code></a>
Release 1.0.22</li>
<li><a
href="f76db8d7f2"><code>f76db8d</code></a>
Resolve redundant import warning</li>
<li><a
href="f32b420f75"><code>f32b420</code></a>
Ignore incompatible_msrv clippy lint for conditionally compiled
code</li>
<li>See full diff in <a
href="https://github.com/dtolnay/semver/compare/1.0.21...1.0.22">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=semver&package-manager=cargo&previous-version=1.0.21&new-version=1.0.22)](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>
2024-02-19 22:34:06 +00:00
Reactor Scram
87f843dcfb ci: document and fix a couple things for local Docker testing (#3672)
Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-02-17 16:16:39 +00:00
Thomas Eizinger
0ae48bb1dd chore(snownet): expose Server and Client (#3664)
Extracted out of #3391.
2024-02-16 21:45:14 +00:00
Thomas Eizinger
e137884009 feat(snownet): instrument public API using tracing (#3663)
Extracted out of #3391.
2024-02-16 21:45:01 +00:00
Reactor Scram
2f5bc2a90e docs(linux): document default DNS setup on Debian 12 and Ubuntu 20.04 (#3668)
Closes #3667
2024-02-16 18:20:45 +00:00
Reactor Scram
46228a1e62 feat(linux): Control DNS with systemd-resolved (#3643)
If `FIREZONE_DNS_CONTROL` is set to `systemd-resolved`, then shell out
to `resolvectl` to request all system DNS queries to go to Firezone's
sentinel DNS server(s).

```[tasklist]
- [ ] Figure out how to stop the runner from using the Docker bridge iface
```

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-02-16 17:17:02 +00:00
Gabi
10c9f622f3 fix(snownet): generate candidates only after we accept the ICE answer (#3658)
This is done to delay the candidate generation after the gateway has
already received the request.

Since we already know the candidates in most cases, an optimization in
the future to reduce the number of round-trips to the gateway we can add
the candidates to the request connection message.
2024-02-16 01:23:44 +00:00
Thomas Eizinger
19bcaa9539 refactor(connlib): move DNS resolution into tunnel (#3652)
Previously, this mapping was not stored within the tunnel so we had to
perform the resolution further up. This has changed and the tunnel
itself now knows about this mapping. Thus, we can easily move the actual
DNS resolution also into the tunnel, thereby reducing the API surface of
`Tunnel` because we don't need the `write_dns_lookup_response` function.

This is crucial because it is the last place where `Tunnel` is being
cloned in #3391. With this sorted out the way, we can remove all `Arc`s
and locks from `Tunnel` as part of #3391.
2024-02-16 00:29:31 +00:00
Reactor Scram
75e447f9d4 docs(linux): document test setups for exercising all the Linux code (#3660)
Trying to make sure I don't overlook anything. The possible combinations
of setups is like 100+, but these 6 will at least exercise everything
one time, and they're probably going to be the most common, right?

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-02-16 00:12:26 +00:00
dependabot[bot]
97eb506bb3 build(deps): Bump tokio from 1.35.1 to 1.36.0 in /rust (#3561)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.35.1 to 1.36.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/tokio-rs/tokio/releases">tokio's
releases</a>.</em></p>
<blockquote>
<h2>Tokio v1.36.0</h2>
<h1>1.36.0 (February 2nd, 2024)</h1>
<h3>Added</h3>
<ul>
<li>io: add <code>tokio::io::Join</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6220">#6220</a>)</li>
<li>io: implement <code>AsyncWrite</code> for <code>Empty</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6235">#6235</a>)</li>
<li>net: add support for anonymous unix pipes (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6127">#6127</a>)</li>
<li>net: add <code>UnixSocket</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6290">#6290</a>)</li>
<li>net: expose keepalive option on <code>TcpSocket</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6311">#6311</a>)</li>
<li>sync: add <code>{Receiver,UnboundedReceiver}::poll_recv_many</code>
(<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6236">#6236</a>)</li>
<li>sync: add <code>Sender::{try_,}reserve_many</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6205">#6205</a>)</li>
<li>sync: add <code>watch::Receiver::mark_unchanged</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6252">#6252</a>)</li>
<li>task: add <code>JoinSet::try_join_next</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6280">#6280</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>io: make <code>copy</code> cooperative (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6265">#6265</a>)</li>
<li>io: make <code>repeat</code> and <code>sink</code> cooperative (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6254">#6254</a>)</li>
<li>io: simplify check for empty slice (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6293">#6293</a>)</li>
<li>process: use pidfd on Linux when available (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6152">#6152</a>)</li>
<li>sync: use AtomicBool in broadcast channel future (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6298">#6298</a>)</li>
</ul>
<h3>Documented</h3>
<ul>
<li>io: clarify <code>clear_ready</code> docs (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6304">#6304</a>)</li>
<li>net: document that <code>*Fd</code> traits on <code>TcpSocket</code>
are unix-only (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6294">#6294</a>)</li>
<li>sync: document FIFO behavior of <code>tokio::sync::Mutex</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6279">#6279</a>)</li>
<li>chore: typographic improvements (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6262">#6262</a>)</li>
<li>runtime: remove obsolete comment (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6303">#6303</a>)</li>
<li>task: fix typo (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6261">#6261</a>)</li>
</ul>
<p><a
href="https://redirect.github.com/tokio-rs/tokio/issues/6220">#6220</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6220">tokio-rs/tokio#6220</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6235">#6235</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6235">tokio-rs/tokio#6235</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6127">#6127</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6127">tokio-rs/tokio#6127</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6290">#6290</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6290">tokio-rs/tokio#6290</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6311">#6311</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6311">tokio-rs/tokio#6311</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6236">#6236</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6236">tokio-rs/tokio#6236</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6205">#6205</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6205">tokio-rs/tokio#6205</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6252">#6252</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6252">tokio-rs/tokio#6252</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6280">#6280</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6280">tokio-rs/tokio#6280</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6265">#6265</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6265">tokio-rs/tokio#6265</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6254">#6254</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6254">tokio-rs/tokio#6254</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6293">#6293</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6293">tokio-rs/tokio#6293</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6238">#6238</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6238">tokio-rs/tokio#6238</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6152">#6152</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6152">tokio-rs/tokio#6152</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6298">#6298</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6298">tokio-rs/tokio#6298</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6262">#6262</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6262">tokio-rs/tokio#6262</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6303">#6303</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6303">tokio-rs/tokio#6303</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6261">#6261</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6261">tokio-rs/tokio#6261</a></p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="eaf81ed324"><code>eaf81ed</code></a>
chore: prepare Tokio v1.36.0 (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6312">#6312</a>)</li>
<li><a
href="53f9e5a357"><code>53f9e5a</code></a>
ci: make sure dictionary words are sorted and unique (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6316">#6316</a>)</li>
<li><a
href="9077762545"><code>9077762</code></a>
net: expose keepalive option on <code>TcpSocket</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6311">#6311</a>)</li>
<li><a
href="131e7b4e49"><code>131e7b4</code></a>
ci: add spellchecking (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6297">#6297</a>)</li>
<li><a
href="e53b92a993"><code>e53b92a</code></a>
io: clarify <code>clear_ready</code> docs (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6304">#6304</a>)</li>
<li><a
href="7536132065"><code>7536132</code></a>
sync: use AtomicBool in broadcast channel future (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6298">#6298</a>)</li>
<li><a
href="b6d0c9091d"><code>b6d0c90</code></a>
macros: fix trait_method breaking change detection (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6308">#6308</a>)</li>
<li><a
href="4846959e8a"><code>4846959</code></a>
runtime: remove obsolete comment (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6303">#6303</a>)</li>
<li><a
href="ec3038357f"><code>ec30383</code></a>
net: add <code>UnixSocket</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6290">#6290</a>)</li>
<li><a
href="f80bbec28f"><code>f80bbec</code></a>
io: simplify check for empty slice (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6293">#6293</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/tokio-rs/tokio/compare/tokio-1.35.1...tokio-1.36.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tokio&package-manager=cargo&previous-version=1.35.1&new-version=1.36.0)](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>
2024-02-15 23:25:36 +00:00
Gabi
55e4fb100f fix(gateway): re-implement resource address resolution in eventloop (#3656)
Reimplements what #3654 reverted with a fix

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-02-15 20:51:59 +00:00
Reactor Scram
0fbd40fcb2 feat(linux): Notify systemd when we've started (#3628)
Regardless of `FIREZONE_DNS_CONTROL`, always try to notify systemd that
we've started.

I had accidentally conflated the idea of running as a systemd service
with the idea of using systemd to control DNS. They're separate, but
I'll keep the service unit in here and always use `sd-notify` since it
should be harmless to use even in Alpine.

~~If `FIREZONE_DNS_CONTROL` is `systemd-resolved`, try to notify systemd
that we've finished startup and the tunnel is ready.~~

Also adds a CI test, including a systemd service file that is **not**
ready for general use.
Ready for review once it's green.

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-02-15 20:12:37 +00:00
Reactor Scram
085351f455 revert: 3622 to fix failing DNS CI test (#3654)
Reverts #3622 I don't know why, but that change seemed to cause the
`/etc/resolv.conf` test to fail in CI and I was thinking of the "roll
back first" principle
https://cloud.google.com/blog/products/gcp/reliable-releases-and-rollbacks-cre-life-lessons

~~I also change one `ping` in CI to `until ping`. This was an earlier
attempt before I did the revert, and it seems safe to leave it in.~~
2024-02-15 19:26:34 +00:00
Thomas Eizinger
c53553cd26 feat(snownet): timeout connections without a handshake after 20 seconds (#3633)
It was discovered by @conectado that this timeout needs to be longer
than 10 seconds.
2024-02-15 01:55:46 +00:00
Thomas Eizinger
23e89c7290 feat(snownet): attempt to make new allocation when refresh fails (#3631)
Initially, we thought that we need to replace the entire `Allocation` if
the credentials to the relay change. However, during testing it turned
out that the credentials will change every time the portal sends us new
credentials. Likely, the portal hashes some kind of nonce into the
password as well.

Consequently, throwing away the entire state of the `Allocation` is
wrong. Instead, we will simply try to refresh the allocation using the
new credentials. If the refresh fails, we will try to make a new
allocation. If that also fails unrecoverably, then we "suspend" the
allocation, i.e. the `Allocation` will not perform any further action by
itself.

In case we get a new `refresh` call (which happens every time we want to
use the `Allocation` for a connection), we restart things and try to
make a new one.
2024-02-15 01:41:10 +00:00