Commit Graph

51 Commits

Author SHA1 Message Date
Thomas Eizinger
d6805d7e48 chore(rust): bump to Rust 1.88 (#9714)
Rust 1.88 has been released and brings with it a quite exciting feature:
let-chains! It allows us to mix-and-match `if` and `let` expressions,
therefore often reducing the "right-drift" of the relevant code, making
it easier to read.

Rust.188 also comes with a new clippy lint that warns when creating a
mutable reference from an immutable pointer. Attempting to fix this
revealed that this is exactly what we are doing in the eBPF kernel.
Unfortunately, it doesn't seem to be possible to design this in a way
that is both accepted by the borrow-checker AND by the eBPF verifier.
Hence, we simply make the function `unsafe` and document for the
programmer, what needs to be upheld.
2025-07-12 06:42:50 +00:00
Thomas Eizinger
ec2599d545 chore(rust): simplify stream logs feature (#9780)
Instead of conditionally enabling the `logs` feature in the Sentry
client, we always enable it and control via the `tracing` integration,
which events should get forwarded to Sentry. The feature-flag check
accesses only shared-memory and is therefore really fast.

We already re-evaluate feature flags on a timer which means this boolean
will flip over automatically and logs will be streamed to Sentry.
2025-07-04 14:51:53 +00:00
Thomas Eizinger
d5be185ae4 chore(rust): remove telemetry spans and events (#9634)
Originally, we introduced these to gather some data from logs / warnings
that we considered to be too spammy. We've since merged a
burst-protection that will at most submit the same event once every 5
minutes.

The data from the telemetry spans themselves have not been used at all.
2025-06-25 17:15:57 +00:00
Thomas Eizinger
3b972643b1 feat(rust): stream logs to Sentry when enabled in PostHog (#9635)
Sentry has a new "Logs" feature where we can stream logs directly to
Sentry. Doing this for all Clients and Gateways would be way too much
data to collect though.

In order to aid debugging from customer installations, we add a
PostHog-managed feature flag that - if set to `true` - enables the
streaming of logs to Sentry. This feature flag is evaluated every time
the telemetry context is initialised:

- For all FFI usages of connlib, this happens every time a new session
is created.
- For the Windows/Linux Tunnel service, this also happens every time we
create a new session.
- For the Headless Client and Gateway, it happens on startup and
afterwards, every minute. The feature-flag context itself is only
checked every 5 minutes though so it might take up to 5 minutes before
this takes effect.

The default value - like all feature flags - is `false`. Therefore, if
there is any issue with the PostHog service, we will fallback to the
previous behaviour where logs are simply stored locally.

Resolves: #9600
2025-06-25 16:14:14 +00:00
Thomas Eizinger
490e9c1dde refactor(gui-client): tidy up app startup (#9468)
As part of investigating #9400, I refactored the startup code of the GUI
client to play around with the initialization order of the runtime and
other parts. After finding the root cause (fixed in #9469), I figured it
would still be nice to land these improvements.

This refactors the app startup:

- Only initialize what is absolutely necessary outside of `try_main`:
The runtime and the telemetry instance.
- Settings are loaded earlier
- Telemetry is initializer earlier
- Add a bootstrap logger that logs to stdout whilst we are booting
- Re-order some code inside `gui::run` to bundle the initialization of
Tauri into a single command chain

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-08 08:04:15 +00:00
Thomas Eizinger
88cda1c6ad fix(telemetry): negate filters for spammy events (#9469)
Boolean logic is hard. Instead of filtering _out_ these spammy events on
a certain level, we accidentally configured the `SentryLayer` such that
only events on level ERROR would be sent to Sentry.

To fix this, we rewrite the filter such that it is phrased in an
affirmative manner, i.e. it only allows an event if it matches all of
the given criteria. This filter this then applied in a **negated** way,
i.e. we don't want to see events that match these criteria.

Resolves: #9400
2025-06-07 13:05:30 +00:00
Thomas Eizinger
365bc51ea9 build(deps): bump sentry to v0.38.1 (#9357)
Unfortunately, this pulls in a lot of dependencies that aren't actually
used due to a bug in `cargo`. See
https://github.com/getsentry/sentry-rust/issues/804#issuecomment-2929627500.
2025-06-06 11:25:01 +00:00
Thomas Eizinger
14cabafa6a chore(rust): set opentelemetry to INFO (#9146)
This is currently spammy on DEBUG for all platforms where we don't
collect metrics.
2025-05-15 00:23:01 +00:00
Thomas Eizinger
275e29bb07 chore(rust): silence more error logs from WinTUN (#9090) 2025-05-12 11:42:34 +00:00
Thomas Eizinger
f70ddc9ee6 chore(connlib): filter noisy log from opentelemetry_sdk (#9062)
Opentelemetry logs a DEBUG log every time it creates a new meter. That
happens fairly often now in our codebase which spams the logs on the
DEBUG level.

```
2025-05-09T02:31:51.147Z DEBUG opentelemetry_sdk:  name="MeterProvider.ExistingMeterReturned" meter_name="connlib"
```

We fix that be setting `opentelemetry_sdk` to default to `INFO` if it is
not specified explicitly.
2025-05-09 04:18:29 +00:00
Thomas Eizinger
5c9dd439e2 chore(rust): filter spammy WinTUN errors in the sentry_layer (#9036)
By default, we send all WARN and ERROR logs to Sentry. This also
includes logs emitted via the `log` crate via a facade that `tracing`
installs. The wintun-rs bindings install such a logger in the native
WinTUN code. The WinTUN code has a bug where it doesn't handle adapter
removal idempotently. That is, if the adapter has already been removed
it logs an error instead of succeeding.

Typically, such logs can easily be suppressed in Sentry. In this case
however, Sentry fails to group these different logs together because
WinTUN's error message contains a path to a temporary directory which is
different every time it gets executed. As such, these logs spam our
Sentry instance with no way for us to disable them with existing tools.

The WireGuard mailing list for WinTUN also appears to be dead. We
attempted to contact the list in February and have not received a reply
yet. The last archive goes back to November 2024 [0]. We use WinTUN as a
prebuild and signed DLL so we also cannot meaningfully patch this on our
end without upstreaming it.

Thus, as a last resort, we add some infrastructure to our logging setup
that allows us to client-side filter events based on certain patterns of
the message and a log level.

[0]: https://lists.zx2c4.com/pipermail/wireguard/

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-06 01:16:18 +00:00
Thomas Eizinger
122d84cfa2 fix(connlib): recreate log file if it got deleted (#8926)
Currently, when `connlib`'s log file gets deleted, we write logs into
nirvana until the corresponding process gets restarted. This is painful
for users to do because they need to restart the IPC service or Network
Extension. Instead, we can simply check if the log file exists prior to
writing to it and re-create it if it doesn't.

Resolves: #6850
Related: #7569
2025-04-29 13:05:02 +00:00
Thomas Eizinger
dce5ab9178 build(deps): bump Rust to 1.86 (#8636) 2025-04-03 21:14:08 +00:00
Thomas Eizinger
84a2c275ca build(rust): upgrade to Rust 1.85 and Edition 2024 (#8240)
Updates our codebase to the 2024 Edition. For highlights on what
changes, see the following blogpost:
https://blog.rust-lang.org/2025/02/20/Rust-1.85.0.html
2025-03-19 02:58:55 +00:00
Thomas Eizinger
421f8e76d6 feat(connlib): always symlink to latest log file (#8400)
When debugging Firezone, it is useful to use `tail -f` on the current
logfile to see what `connlib` is doing. This is quite annoying to do
however because the log file rolls over with every restart of the
application. As a small QoL improvement, we always symlink the latest
log file to a link called `latest`. Therefore, all one needs to do is
re-run the latest `tail -f ./latest` command to get the new logs.

Resolves: #8388
2025-03-10 14:16:58 +00:00
Thomas Eizinger
f882edb3bd feat(gui-client): configure IPC service to log to stdout (#8219)
On Linux, logs sent to stdout from a systemd-service are automatically
captured by `journald`. This is where most admins expect logs to be and
frankly, doing any kind of debugging of Firezone is much easier if you
can do `journalctl -efu firezone-client-ipc.service` in a terminal and
check what the IPC service is doing.

On Windows, stdout from a service is (unfortunately) ignored.

To achieve this and also allow dynamically changing the log-filter, I
had to introduce a (long-overdue) abstraction over tracing's "reload"
layer that allows us to combine multiple reload-handles into one.
Unfortunately, neither the `reload::Layer` nor the `reload::Handle`
implement `Clone`, which makes this unnecessarily difficult.

Related: #8173
2025-02-23 00:23:29 +00:00
Thomas Eizinger
105c984512 fix(rust): only use ANSI colors if the output supports it (#8070)
Fixes: #8054.
2025-02-10 04:39:18 +00:00
Thomas Eizinger
d2e9b09874 refactor(rust): stringify errors early (#8033)
As it turns out, the effort in #7104 was not a good idea. By logging
errors as values, most of our Sentry reports all have the same title and
thus cannot be differentiated from within the overview at all. To fix
this, we stringify errors with all their sources whenever they got
logged. This ensures log messages are unique and all Sentry issues will
have a useful title.
2025-02-06 14:18:35 +00:00
Thomas Eizinger
c6492d4832 fix(rust): don't start all log files with connlib. (#7853)
At present, the file logger for all Rust code starts each logfile with
`connlib.`. This is very confusing when exporting the logs from the GUI
client because even the logs from the client itself will start with
`connlib.`. To fix this, we make the base file name of the log file
configurable.
2025-01-28 01:35:05 +00:00
Thomas Eizinger
a5086af352 chore(rust): remove JSON logging (#7854)
Nobody looks at these logs, writing them uses unnecessary CPU + storage
on users devices. It also means we have 1 background thread less because
we need one less non-blocking writer.
2025-01-27 23:35:07 +00:00
Thomas Eizinger
088273f009 feat(clients): reduce memory usage of background logger thread (#7748)
In order to not block the main thread, `connlib` uses a background
thread to write log files to disk. By default, the channel with this
background thread can hold 128_000 items
(https://docs.rs/tracing-appender/latest/tracing_appender/non_blocking/constant.DEFAULT_BUFFERED_LINES_LIMIT.html).
This results in a significant chunk of memory being allocated that we
don't necessarily need.
2025-01-13 18:26:25 +00:00
Thomas Eizinger
dd6b52b236 chore(rust): share edition key via workspace table (#7451) 2024-12-03 00:28:06 +00:00
Thomas Eizinger
8bc1277c24 fix(telemetry): include span attributes in breadcrumbs (#7421)
This is another attempt at fixing #7386. Previous PR was #7379. The
difference is, this time it works! In the following screenshot,
`handle_input` is a currently active span.


![image](https://github.com/user-attachments/assets/0845d566-8ca7-4ba2-8786-9c5819cdfd48)

I had to make some patches to Sentry, most notably:

- https://github.com/getsentry/sentry-rust/pull/708
- https://github.com/getsentry/sentry-rust/pull/712

The way we configure Sentry is quite tricky:

First and foremost, we need to understand that the `tracing` adapter for
Sentry has a `span_filter` configuration. When a span gets filtered out
there, the rest of `sentry-tracing` never sees the data in that span.
Thus, in order to capture variables from spans, we need to have a fairly
generous span filter. In this PR, we change this span filter to include
all spans except those on TRACE level.

Secondly, by default, the Sentry SDK doesn't send any spans to the
backend, i.e. the sampling rate is 0. Previously, we set the sampling
rate to 1.0 because the `span_filter` was already filtering out all
non-telemetry spans. A telemetry span is a concept that we invented. It
is a span that gets sampled at _creation_ time with a probability of 1%.
This is useful because creating a lot of spans is also expensive, so we
don't want to do it e.g. on a per-packet basis. With just these
configuration options, we now have a problem: We don't want to submit
all spans to Sentry but we need the `span_filter` to allow all spans
otherwise we can't capture the contextual fields from the span in
breadcrumbs. Luckily, the Sentry SDK has another configuration option:
`traces_sampler`.

The `traces_sampler` gets to compute a sampling rate for each individual
span. This allows us to discard all spans from being sent to Sentry
unless they are `telemetry` spans.

Resolves: #7386.
2024-12-02 20:00:35 +00:00
Thomas Eizinger
c6e7e6192e build(rust): bump Rust to 1.83 (#7409)
Rust 1.83 comes with a bunch of new lints for elidible lifetimes. Those
also trigger in the generated code of `derivative`. That crate is
actually unmaintained so we replace our usages of it with `derive_more`.
2024-11-29 01:04:06 +00:00
Thomas Eizinger
2c26fc9c0e ci: lint Rust dependencies using cargo deny (#7390)
One of Rust's promises is "if it compiles, it works". However, there are
certain situations in which this isn't true. In particular, when using
dynamic typing patterns where trait objects are downcast to concrete
types, having two versions of the same dependency can silently break
things.

This happened in #7379 where I forgot to patch a certain Sentry
dependency. A similar problem exists with our `tracing-stackdriver`
dependency (see #7241).

Lastly, duplicate dependencies increase the compile-times of a project,
so we should aim for having as few duplicate versions of a particular
dependency as possible in our dependency graph.

This PR introduces `cargo deny`, a linter for Rust dependencies. In
addition to linting for duplicate dependencies, it also enforces that
all dependencies are compatible with an allow-list of licenses and it
warns when a dependency is referred to from multiple crates without
introducing a workspace dependency. Thanks to existing tooling
(https://github.com/mainmatter/cargo-autoinherit), transitioning all
dependencies to workspace dependencies was quite easy.

Resolves: #7241.
2024-11-22 00:17:28 +00:00
Thomas Eizinger
86ada01828 fix(gui-client): initialise sentry-tracing for IPC service (#7363)
It was already a bit sus that we didn't receive as many errors in Sentry
from the IPC service as from the GUI client. Turns out that we forgot to
initialise our `sentry_layer` there. Additionally, we also didn't
initialise the `LogTracer`, meaning we didn't capture logs from the
`log` crate which is used by some of the dependencies, for example
`wintun`.
2024-11-18 22:40:01 +00:00
Thomas Eizinger
11dd0c42ca refactor(telemetry): remove IGNORED_TARGETS (#7365)
Sentry allows us to do this kind of filtering on the server-side, we can
thus remove this complexity from our codebase.
2024-11-18 18:17:30 +00:00
Thomas Eizinger
de35bb067e fix(telemetry): don't embed errors values in telemetry_event! (#7366)
Due to https://github.com/getsentry/sentry-rust/issues/702, errors which
are embedded as `tracing::Value` unfortunately get silently discarded
when reported as part of Sentry "Event"s and not "Exception"s.

The design idea of these telemetry events is that they aren't fatal
errors so we don't need to treat them with the highest priority. They
may also appear quite often, so to save performance and bandwidth, we
sample them at a rate of 1% at creation time.

In order to not lose the context of these errors, we instead format them
into the message. This makes them completely identical to the `debug!`
logs which we have on every call-site of `telemetry_event!` which
prompted me to make that implicit as part of creating the
`telemetry_event!`.

Resolves: #7343.
2024-11-18 18:17:08 +00:00
Thomas Eizinger
8c5a5fa690 chore(rust): correctly disable ANSI escapes globally (#7336)
I think I finally understood and correctly traced, where the use of ANSI
escape codes came from. It turns out, the `with_ansi` switch on
`tracing_subscriber::fmt::Layer` is what you want to toggle. From there,
it trickles down to the `Writer` which we can then test for in our
`Format`.

Resolves: #7284.

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
2024-11-14 05:00:53 +00:00
Thomas Eizinger
48ba2869a8 chore(rust): ban the use of .unwrap except in tests (#7319)
Using the clippy lint `unwrap_used`, we can automatically lint against
all uses of `.unwrap()` on `Result` and `Option`. This turns up quite a
few results actually. In most cases, they are invariants that can't
actually be hit. For these, we change them to `Option`. In other cases,
they can actually be hit. For example, if the user supplies an invalid
log-filter.

Activating this lint ensures the compiler will yell at us every time we
use `.unwrap` to double-check whether we do indeed want to panic here.

Resolves: #7292.
2024-11-13 03:59:22 +00:00
Thomas Eizinger
19f51568c2 chore(rust): don't pass errors as values for debug logs (#7318)
Our logging library `tracing` supports structured logging. Structured
logging means we can include values within a `tracing::Event` without
having to immediately format it as a string. Processing these values -
such as errors - as their original type allows the various `tracing`
layers to capture and represent them as they see fit.

One of these layers is responsible for sending ERROR and WARN events to
Sentry, as part of which `std::error::Error` values get automatically
captured as so-called "sentry exceptions".

Unfortunately, there is a caveat: If an `std::error::Error` value is
included in an event that does not get mapped to an exception, the
`error` field is completely lost. See
https://github.com/getsentry/sentry-rust/issues/702 for details.

To work around this, we introduce a `err_with_sources` adapter that an
error and all its sources together into a string. For all
`tracing::debug!` statements, we then use this to report these errors.

It is really unfortunate that we have to do this and cannot use the same
mechanism, regardless of the log level. However, until this is fixed
upstream, this will do and gives us better information in the log
submitted to Sentry.
2024-11-12 04:00:02 +00:00
Thomas Eizinger
ad4eea29ff chore(rust): don't panic in fallible functions (#7298)
"Just let it crash" is terrible advice for software that is shipped to
end users. Where possible, we should use proper error handling and only
fail the current function / task that is active, e.g. drop a particular
packet instead of failing all of connlib. We more or less already do
that.

Activating the clippy lint `unwrap_in_result` surfaced a few more places
where we panic despite being in a function that is fallible already.
These cases can easily be converted to not panic and return an error
instead.
2024-11-11 23:55:23 +00:00
Thomas Eizinger
b7969ce3a1 fix(telemetry): ignore events from certain log targets (#7272)
Resolves: #7246.
2024-11-07 00:02:54 +00:00
Thomas Eizinger
47e45a3cf3 chore(telemetry): improve telemetry spans and events (#7206)
DNS resolution is a critical part of `connlib`. If it is slow for
whatever reason, users will notice this. To make sure we notice as well,
we add `telemetry` spans to the client's and gateway's DNS resolution.
For the client, this applies to all DNS queries that we forward to the
upstream servers. For the gateway, this applies to all DNS resources.

In addition to those IO operations, we also instrument the
`match_resource_linear` function. This function operates in `O(n)` of
all defined DNS resources. It _should_ be fast enough to not create an
impact but it can't hurt to measure this regardless.

Lastly, we also instrument `refresh_translations` on the gateway.
Refreshing the DNS resolution of a DNS resource should really only
happen, when the previous IP addresses become stale yet the user is
still trying to send traffic to them. We don't actually have any data on
how often that happens. By instrumenting it, we can gather some of this
data.

To make sure that none of these telemetry events and spans hurt the
end-user performance, we introduce macros to `firezone-logging` that
sample the creation of these events and spans at a rate of 1%. I ran a
flamegraph and none of these even showed up. The most critical one here
is probably the `match_resource_linear` span because it happens on every
DNS query.

Resolves: #7198.

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
2024-11-06 01:17:57 +00:00
Thomas Eizinger
b3b9f08343 chore(clients): use custom log format also for log files (#7261)
The custom, easier-to-read log format also needs to be applied to the
file logger.
2024-11-04 23:54:53 +00:00
Thomas Eizinger
de2afb23be chore: exclude noisy crates from Sentry breadcrumbs (#7189) 2024-10-30 14:09:43 +00:00
Thomas Eizinger
7037830b19 chore(connlib): submit DEBUG events as breadcrumbs (#7177)
This should give us much more context for a particular error without
having to bother a customer with sending us the logs / digging for them
ourselves in our staging or production environment.

Resolves: #7176.
2024-10-29 23:39:07 +00:00
Thomas Eizinger
1f7a0430b7 chore(rust): record tracing WARNs as Sentry exceptions (#7166)
It appears that I have misunderstood the documentation of
`sentry-tracing`. When a message gets logged as an event (rather than an
"exception") `std::error::Error`s attached as tracing `Value`s do not
get recorded. It doesn't really matter whether we record our events as
exceptions or messages. We should ideally look at all of them and
particularly noisy ones can be muted forever in Sentry so we don't end
up in a "boy who cried wolf" situation. Therefore, this PR changes our
event filter to also submit WARNs as exceptions to make sure they get
logged accordingly.

Resolves: #7161.
Related: https://github.com/getsentry/sentry-rust/issues/702.
2024-10-28 14:07:42 +00:00
Thomas Eizinger
82fcad0a3b refactor(rust): only send telemetry spans to Sentry (#7153)
With the introduction of the `tracing-sentry` integration in #7105, we
started sending tracing spans to Sentry. By default, all spans with
level INFO and above get sampled at the configured rate and sent to
Sentry.

This results in a lot of useless transaction in Sentry because we use
INFO level spans in multiple places in connlib to attach contextual
information like the current connection ID.

This PR introduces the concept of `telemetry` spans which - similar to
the `telemetry` log target in #7147 - qualifies a span for being sent to
Sentry. By convention, these are also defined as requiring the TRACE
level. This ensures we won't ever see them as part of regular log
output.
2024-10-24 20:25:26 +00:00
Thomas Eizinger
12ca4f1cc7 chore(connlib): introduce telemetry log target (#7147)
With #7105, all ERROR events from `tracing` get logged as exceptions in
Sentry and all WARN events get logged as "messages". We don't want to
fill up the user's harddrive with logs which means we have to be
somewhat conservative, what gets logged on INFO and above (with INFO
being the default log level). There are certain events though where it
would be useful to know, how often they happen because too many of them
can indicate a problem.

To solve this problem, we introduce a dedicated `telemetry` log target
that the tracing-sentry integration layer watches for. Events for the
`telemetry` log target that gets logged on TRACE will be sampled at a
rate of 1% and submitted as messages to Sentry.
2024-10-24 01:24:45 +00:00
Thomas Eizinger
80c5b0df71 refactor(connlib): replace LogUnwrap with macros (#7138)
Using a trait means the call-site of the log message will always be the
`log_unwrap` module, despite the `#[track_caller]` annotation. That one
only works for `std::panic::Location` unfortunately which `tracing`
isn't using.

Macros will be evaluated earlier and thus the messages will show up with
the correct module name.
2024-10-23 23:44:23 +00:00
Thomas Eizinger
6eecfc0cfb fix: replace panics with Result for IP packets (#7135)
My theory for this issue is that we receive a UDP DNS response from an
upstream server that is bigger than our MTU and thus forwarding it
fails.

This PR doesn't fix that issue by itself but only mitigates the actual
panic. To properly fix the underlying issue, we need to parse the DNS
message. Truncate it and set the TC bit.

Related: #7121.
2024-10-23 16:25:12 +00:00
Thomas Eizinger
990324b2ec chore(rust): enable sentry-tracing integration (#7105)
Using the `sentry-tracing` integration, we can automatically capture
events based on what we log via `tracing`. The mapping is defined as
follows:

- ERROR: Gets captured as a fatal error
- WARN: Gets captured as a message
- INFO: Gets captured as a breadcrumb
- `_`: Does not get captured at all

If telemetry isn't active / configured, this integration does nothing.
It is therefore safe to just always enable it.
2024-10-22 23:23:49 +00:00
dependabot[bot]
13b7c11d76 build(deps): Bump nu-ansi-term from 0.46.0 to 0.50.1 in /rust (#7113)
Bumps [nu-ansi-term](https://github.com/nushell/nu-ansi-term) from
0.46.0 to 0.50.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/nushell/nu-ansi-term/releases">nu-ansi-term's
releases</a>.</em></p>
<blockquote>
<h2>v0.50.1</h2>
<h2>What's Changed</h2>
<ul>
<li>Remove unused import by <a
href="https://github.com/nickelc"><code>@​nickelc</code></a> in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/63">nushell/nu-ansi-term#63</a></li>
<li>Update <code>windows-sys</code> to 0.52 by <a
href="https://github.com/nickelc"><code>@​nickelc</code></a> in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/62">nushell/nu-ansi-term#62</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/nushell/nu-ansi-term/compare/v0.50.0...v0.50.1">https://github.com/nushell/nu-ansi-term/compare/v0.50.0...v0.50.1</a></p>
<h2>v0.50.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Rename the LICENCE file to LICENSE by <a
href="https://github.com/newpavlov"><code>@​newpavlov</code></a> in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/51">nushell/nu-ansi-term#51</a></li>
<li>gnu_legacy: with GNU, write foreground first, else background first.
by <a href="https://github.com/sylvestre"><code>@​sylvestre</code></a>
in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/54">nushell/nu-ansi-term#54</a></li>
<li>Bump to 0.50 by <a
href="https://github.com/kubouch"><code>@​kubouch</code></a> in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/56">nushell/nu-ansi-term#56</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/newpavlov"><code>@​newpavlov</code></a>
made their first contribution in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/51">nushell/nu-ansi-term#51</a></li>
<li><a href="https://github.com/sylvestre"><code>@​sylvestre</code></a>
made their first contribution in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/54">nushell/nu-ansi-term#54</a></li>
<li><a href="https://github.com/kubouch"><code>@​kubouch</code></a> made
their first contribution in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/56">nushell/nu-ansi-term#56</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/nushell/nu-ansi-term/compare/v0.49.0...v0.50.0">https://github.com/nushell/nu-ansi-term/compare/v0.49.0...v0.50.0</a></p>
<h2>v0.49.0</h2>
<p>This release attempts to fix API limitations of the previous
<code>0.48.0</code> release.
You can now again construct <code>Style</code> directly through its
fields.</p>
<h2>Breaking changes</h2>
<h3>coming from <code>0.47.0</code></h3>
<ul>
<li>Style has now a <code>prefix_with_reset</code> field to enable
additional reset sequences that are introduced before setting a
style.</li>
</ul>
<h3>coming from <code>0.48.0</code></h3>
<ul>
<li><code>Style.with_reset</code> has been renamed to
<code>Style.prefix_with_reset</code></li>
<li><code>AnsiGenericString::hyperlink()</code> changed in signature
from <code>...(&amp;mut self, ...)</code> to <code>...(self, ...) -&gt;
Self</code></li>
<li><code>AnsiGenericString::icon()</code> and <code>::cwd()</code> have
been removed for now.</li>
</ul>
<h2>What's Changed</h2>
<ul>
<li>Fix Re-enabling manual Style creation by <a
href="https://github.com/mhelsley"><code>@​mhelsley</code></a> in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/47">nushell/nu-ansi-term#47</a></li>
<li>Use chaining for <code>AnsiGenericString::hyperlink</code> by <a
href="https://github.com/sholderbach"><code>@​sholderbach</code></a> in
<a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/48">nushell/nu-ansi-term#48</a></li>
<li>Make <code>Style.with_reset</code> more explicit as
<code>prefix_with_reset</code> by <a
href="https://github.com/sholderbach"><code>@​sholderbach</code></a> in
<a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/50">nushell/nu-ansi-term#50</a></li>
<li>Bump version for 0.49 release by <a
href="https://github.com/sholderbach"><code>@​sholderbach</code></a> in
<a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/49">nushell/nu-ansi-term#49</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/nushell/nu-ansi-term/compare/v0.48.0...v0.49.0">https://github.com/nushell/nu-ansi-term/compare/v0.48.0...v0.49.0</a></p>
<h2>v0.48.0</h2>
<blockquote>
<p><strong>Warning</strong>
This release introduces an unintended breaking change for users that
want to construct <code>Style</code> directly. (see <a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/46">#46</a>
for tracking)</p>
</blockquote>
<h2>New features</h2>
<p>This release <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/43">introduces
support</a> to express several OSC control codes by calling methods on
<code>AnsiGenericString</code>. Primarily you can now mark particular
text with a hyperlink by calling <code>.hyperlink()</code> on it.</p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/nushell/nu-ansi-term/blob/main/CHANGELOG.md">nu-ansi-term's
changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
<h2>v0.47.0 (2023-03-13)</h2>
<h3>Breaking changes</h3>
<ul>
<li>Bumped minimum supported Rust version (MSRV) to 1.62.1</li>
<li>Change of <code>Color::default()</code> value to the ANSI default
color <code>Color::Default</code> (code <code>39</code> and
<code>49</code> for foreground and background respectively). This
replaces <code>Color::White</code> as the default value.</li>
</ul>
<h3>Other changes</h3>
<ul>
<li><code>const</code>ification of several functions and methods.</li>
<li>Improved CI workflow.</li>
<li>Updated to Rust edition 2021.</li>
<li>Replaced <code>winapi</code> dependency with
<code>windows-sys</code>.</li>
<li>Removed <code>overload</code> dependency.</li>
<li>Added <code>AnsiGenericString::as_str()</code> to allow access to
the underlying string.</li>
<li>Fixed typos in README.</li>
<li>Added <code>CHANGELOG.md</code> for changes since forking
<code>ansi_term</code>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="0912f8f6a3"><code>0912f8f</code></a>
bump version number 0.50.1</li>
<li><a
href="b902580d8f"><code>b902580</code></a>
Update <code>windows-sys</code> to 0.52 (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/62">#62</a>)</li>
<li><a
href="cc9b338a00"><code>cc9b338</code></a>
Remove unused import (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/63">#63</a>)</li>
<li><a
href="eaf4f5ff47"><code>eaf4f5f</code></a>
Bump to 0.50 (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/56">#56</a>)</li>
<li><a
href="6c7e2627fe"><code>6c7e262</code></a>
gnu_legacy: with GNU, write fg first, else bg first. (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/54">#54</a>)</li>
<li><a
href="f1c83ff292"><code>f1c83ff</code></a>
Rename the LICENCE file to LICENSE (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/51">#51</a>)</li>
<li><a
href="eaa7d7f7e7"><code>eaa7d7f</code></a>
Bump version for 0.49 release (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/49">#49</a>)</li>
<li><a
href="b972a62dce"><code>b972a62</code></a>
Make <code>Style.with_reset</code> more explicit as
<code>prefix_with_reset</code> (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/50">#50</a>)</li>
<li><a
href="b853460c71"><code>b853460</code></a>
Use chaining for <code>AnsiGenericString::hyperlink</code> (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/48">#48</a>)</li>
<li><a
href="76e507cecd"><code>76e507c</code></a>
Fix Re-enabling manual Style creation (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/47">#47</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/nushell/nu-ansi-term/compare/v0.46.0...v0.50.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=nu-ansi-term&package-manager=cargo&previous-version=0.46.0&new-version=0.50.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 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-10-22 16:05:56 +00:00
Thomas Eizinger
73eebd2c4d refactor(rust): consistently record errors as tracing::Value (#7104)
Our logging library, `tracing` supports structured logging. This is
useful because it preserves the more than just the string representation
of a value and thus allows the active logging backend(s) to capture more
information for a particular value.

In the case of errors, this is especially useful because it allows us to
capture the sources of a particular error.

Unfortunately, recording an error as a tracing value is a bit cumbersome
because `tracing::Value` is only implemented for `&dyn
std::error::Error`. Casting an error to this is quite verbose. To make
it easier, we introduce two utility functions in `firezone-logging`:

- `std_dyn_err`
- `anyhow_dyn_err`

Tracking errors as correct `tracing::Value`s will be especially helpful
once we enable Sentry's `tracing` integration:
https://docs.rs/sentry-tracing/latest/sentry_tracing/#tracking-errors
2024-10-22 04:46:26 +00:00
Thomas Eizinger
3d6ed6dde7 refactor(connlib): respond with SERVFAIL on resolver error (#7067)
Currently, any failure in the `StubResolver` while processing a query
results only in a log but no response. For UDP DNS queries, that isn't
too bad because the client will simply retry. With the upcoming support
for TCP DNS queries in #6944, we should really always reply with a
message.

This PR refactors the handling of DNS messages to always generate a
reply. In the case of an error, we reply with SERVFAIL.

This opens up a few more refactorings where we can now collapse the
handling of some branches into the same. As part of that, I noticed the
recurring need for "unwrapping" a `Result<(), E>` and logging the error.
To make that easier, I introduced an extension trait that does exactly
that.
2024-10-17 03:01:59 +00:00
Thomas Eizinger
857bbf5d98 chore(connlib): introduce custom logging format (#7024)
This PR introduces a custom logging format for all Rust-components. It
is more or less a copy of `tracing_subscriber::fmt::format::Compact`
with the main difference that span-names don't get logged.

Spans are super useful because they allow us to record contextual
values, like the current connection ID, for a certain scope. What is IMO
less useful about them is that in the default formatter configuration,
active spans cause a right-drift of the actual log message.

The actual log message is still what most accurately describes, what
`connlib` is currently doing. Spans only add contextual information that
the reader may use for further understand what is happening. This
optional nature of the utility of spans IMO means that they should come
_after_ the actual log message.

Resolves: #7014.
2024-10-14 18:09:38 +00:00
Thomas Eizinger
a9f515a453 chore(rust): use #[expect] instead of #[allow] (#6692)
The `expect` attribute is similar to `allow` in that it will silence a
particular lint. In addition to `allow` however, `expect` will fail as
soon as the lint is no longer emitted. This ensures we don't end up with
stale `allow` attributes in our codebase. Additionally, it provides a
way of adding a `reason` to document, why the lint is being suppressed.
2024-09-16 13:51:12 +00:00
Reactor Scram
5a44151bba test(bin-shared): improve network notifier test (#6676)
On Windows, the network notifier always notifies once at startup. We
make the DNS notifier and Linux match this behavior, and we assert it in
the unit test.

Part of a yak shave towards removing Tauri.
2024-09-13 14:53:13 +00:00
Reactor Scram
ac2d4cd95e chore(rust): disable ANSI coloring in log files (#6508)
Closes #6467

It's still enabled for the stdout / stderr logs
2024-08-30 20:23:48 +00:00