Commit Graph

954 Commits

Author SHA1 Message Date
Lee Smet 4bfb834883 Abort PeerManager background tasks on Drop
Properly clean up all background tasks when PeerManager is dropped.
Should fix #251

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-15 11:30:07 +02:00
Lee Smet 02f8a3a362 Don't derive Clone for PeerManager
Cloning it is not needed

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-15 11:09:38 +02:00
Lee Smet 8577d1a652 Make Quic socket optional
Allow the peer manager to run without quic socket, even in public mode.
This will not create the socket, and prevent connections to quic peers.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-15 10:48:17 +02:00
Lee Smet ee34c14420 Fix Clippy warnings in mobile crate
- use tokio Mutex, to avoid holding a synchronous mutex across an await
  point.
- Ignore type complexity on the global channel which governs shutdown
  for now, as it's pretty clear what it does.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-14 18:20:27 +02:00
Lee Smet 25e48facea Change CI to just run Clippy command
Default GitHub runners have it installed out of the box.

Fixes #245

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-14 17:35:36 +02:00
Lee Smet e1d219414a Drop Clone bound on metrics in HttpServerState
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-14 14:08:37 +02:00
dependabot[bot] 782d1b8718 Bump serde from 1.0.200 to 1.0.201
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.200 to 1.0.201.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.200...v1.0.201)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-14 13:45:16 +02:00
Lee Smet 24eee95d83 Drop obsolete Clone bound on Node
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-14 11:45:41 +02:00
Lee Smet bbce3ebee0 Manually implement Clone for MessageStack
This allows us to drop the M: Clone bound as it is not needed

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-14 11:44:09 +02:00
Lee Smet e14ae464db Manually implement Clone for DataPlane
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-14 11:25:12 +02:00
Lee Smet d5c4d11b5a Drop Clone bound on PeerManager
No longer needed since Inner no longer requires Clone for metrics

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-14 10:37:32 +02:00
Lee Smet 3cf769fe7c Drop clone bound on peer_manager::Inner struct
No longer needed since the Router struct does not require Clone anymore

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-14 10:36:45 +02:00
Lee Smet 65e64aaac3 Manually implement Clone for Router
Avoids a where bound on the generic metrics type on Router

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-14 10:23:44 +02:00
dependabot[bot] bb99655b55 Bump serde_json from 1.0.116 to 1.0.117
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.116 to 1.0.117.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.116...v1.0.117)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-14 10:01:19 +02:00
r-vdp e223b4f6c6 Add meta.mainProgram 2024-05-14 10:01:06 +02:00
r-vdp 9544fef2e4 Add an overlay to the flake 2024-05-14 10:01:06 +02:00
r-vdp 792568c2d7 Run nixpkgs-fmt 2024-05-14 10:01:06 +02:00
r-vdp 0826ea1ac2 Only log an error once when a static node is not reachable
When a node cannot be reached (e.g. because we're on an IPv4-only
network), don't fill the system logs with messages.
We can log this once as an error and log the rest only when debug
logging is enabled.
In order for this to work, we reset the connection_attempts variable
when we connect successfully to a peer.
2024-05-13 22:44:29 +02:00
Lee Smet 1f625a8e99 Update CHANGELOG.md
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-08 14:04:28 +02:00
Lee Smet 178c9febdd Manually implement Hash for Subnet
Since we manually implement PartialEq, we also need to manually
implement Hash

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-08 13:10:23 +02:00
Lee Smet 1017084def Add missing doc comments on connection::Tracked
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-08 12:48:43 +02:00
Lee Smet 36d7961b20 Install ring crypto provider for quinn endpoint
A default crypto provider in installed before creating the quinn
endpoint, as that is needed for rustls (part of the endpoint tls
config). This also allows us to get the default provider when connecting
to a remote quic endpoint.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-08 12:40:42 +02:00
Lee Smet d11bbf50a5 Map quinn poll_write error
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-08 12:11:05 +02:00
Lee Smet 8ce84b8d76 Update quic endpoint setup for quinn v0.11
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-08 12:04:01 +02:00
Lee Smet f8b0956f96 Update rcgen to v0.13.1
Required to be compatible with rustls v0.23

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-08 11:16:17 +02:00
Lee Smet 8f52ec266b Create proper client quic config
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-08 11:11:06 +02:00
Lee Smet db869f4105 Update SkipServerCertVerifier to rustls 0.23
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-08 11:02:17 +02:00
Lee Smet f457509bf2 Remove comment on rustls dependency
Dangerous config is no longer needed

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-08 11:01:46 +02:00
Lee Smet 7363238262 Update quinn to v0.11.0 and rustls to v0.23.5
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-08 11:00:31 +02:00
Iwan BK ceeef0fa5e feat(mobile): start & stop mycelium.
Start & stop implemented by adding a global channel.

Upon startup `Node` listens to ctrl-c and channel receiver.
On stop, we send message to that channel and Node can exit..
2024-05-07 16:01:32 +02:00
dependabot[bot] 776f01a34c Bump base64 from 0.22.0 to 0.22.1
Bumps [base64](https://github.com/marshallpierce/rust-base64) from 0.22.0 to 0.22.1.
- [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.22.0...v0.22.1)

---
updated-dependencies:
- dependency-name: base64
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-07 11:56:54 +02:00
dependabot[bot] 843cd41c34 Bump tun from eaad334 to eb4d41c
Bumps [tun](https://github.com/LeeSmet/rust-tun) from `eaad334` to `eb4d41c`.
- [Commits](https://github.com/LeeSmet/rust-tun/compare/eaad3340ef74475def7e080dedff77f7d830f3b8...eb4d41c0a5d6a6e9c55340e2f61e50683d9f4731)

---
updated-dependencies:
- dependency-name: tun
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-07 11:09:05 +02:00
dependabot[bot] 0124416eec Bump prometheus from 0.13.3 to 0.13.4
Bumps [prometheus](https://github.com/tikv/rust-prometheus) from 0.13.3 to 0.13.4.
- [Changelog](https://github.com/tikv/rust-prometheus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tikv/rust-prometheus/compare/v0.13.3...v0.13.4)

---
updated-dependencies:
- dependency-name: prometheus
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-07 11:08:23 +02:00
dependabot[bot] 501e31b644 Bump serde from 1.0.199 to 1.0.200
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.199 to 1.0.200.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.199...v1.0.200)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-07 11:08:11 +02:00
dependabot[bot] ed3ec70097 Bump tokio-util from 0.7.10 to 0.7.11
Bumps [tokio-util](https://github.com/tokio-rs/tokio) from 0.7.10 to 0.7.11.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-util-0.7.10...tokio-util-0.7.11)

---
updated-dependencies:
- dependency-name: tokio-util
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-07 11:07:39 +02:00
Lee Smet ad5e3745b6 Expose selected route propagation time metric
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-06 16:08:37 +02:00
Lee Smet a128aff6c5 Add metric for selected route propagation duration
See how much time is spent in this routine. Time spent here is
effectively: waiting for source table lock, updating source table if
necessary, and queuing the update.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-06 16:00:00 +02:00
Iwan BK 4baef0fb91 cleanup Cargo.toml and myceliumd conditional compilation 2024-05-06 10:00:08 +02:00
Iwan BK 7cbe84dbf5 add ios as target.
iOS is not working yet.
This change only mean for mycelium flutter app to be compiled
2024-05-06 10:00:08 +02:00
Iwan BK 93a88b11f7 create TunConfig as shared config for the TUN devices.
Android have different config than darwin, windows, and Linux
2024-05-06 10:00:08 +02:00
Iwan BK c780885e10 fix(mobile): cleanup based on the PR review 2024-05-06 10:00:08 +02:00
Iwan BK c04825912d feat(android): initial support for android 2024-05-06 10:00:08 +02:00
Lee Smet adf8fc4054 Bump version to v0.5.2
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-03 11:16:20 +02:00
Lee Smet ba5452bf6c Add openssl dep in flake.nix
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-02 17:25:05 +02:00
Lee Smet 31f04378a3 Feature gate statically linking openssl
Add `vendored-openssl` as feature flag, which is used to statically link
to a local build copy of openssl. Previously this was always done,
though local openssl installs on dev machines are not rare, and it saves
some compile time it seems.

Closes #214

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-02 15:29:58 +02:00
Lee Smet 570d978c00 Revert "Remove unused Subnet::mask method"
This reverts commit 6b1d0a87f8.
2024-05-02 13:51:10 +02:00
Lee Smet ba21ff72b6 Update CHANGELOG.md
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-02 12:02:24 +02:00
Lee Smet aa69b234d2 Add test cases for subnet with different sizes
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-02 11:59:48 +02:00
Lee Smet 4e6b581e99 Manually implement PartialEq for Subnet
Previous derived implementation meant that equality checks were done
based on the byte representation in memory, which is not what we
intuitively want (since a full IP address is contained and this is not
trimmed). Now we only verify the subnet is equal.

Fixes #228

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-02 11:56:47 +02:00
Lee Smet c16be9d10a Add test for Subnet::partial_eq
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-05-02 11:56:23 +02:00