Commit Graph

567 Commits

Author SHA1 Message Date
cloudhead 153be9ede4
node: Improve session type definition 2024-05-06 22:22:39 +02:00
Dr Maxim Orlovsky a3cce22f7a
node: Patch dependencies for Tor/socks5 support 2024-05-06 22:19:36 +02:00
cloudhead 2801403182
signals: Move signal handling to its own crate
We're going to share this code with `radicle-term`.
2024-05-03 14:30:51 +02:00
cloudhead 0d880e12e1
node: Respect relay config on subscribe
Don't relay when a subscribe message is received, unless our relay
configuration allows us.
2024-05-02 13:48:47 +02:00
cloudhead a9b94b0ad6
node: New relay configuration for nodes
Relay now has three values: "always", "never" and "auto".

The first two operate like the previous `true`/`false`. The
new (default) value turns relaying on for nodes with public (external)
addresses and off for nodes without. This should reduce redundant traffic on
the network, that was causing the rate limiters to trigger.
2024-05-02 11:45:29 +02:00
cloudhead afe13b9e47
node: Don't rate-limit persistent peers 2024-05-01 11:06:28 +02:00
cloudhead eece90e9f7
node: Fix naming/spelling of "limitter" module 2024-04-30 14:24:09 +02:00
cloudhead e5df616ead
node: Protect against non-monotonic clocks
Many (most?) system clocks are not monotonic, and even though we're
getting a `LocalTime`, which *is* monotonic when using `now()`, it is
constructed from a `SystemTime` which isn't.
2024-04-30 10:56:37 +02:00
cloudhead bb5355fcb1
node: Promote rate-limitting log to "debug" 2024-04-29 18:02:26 +02:00
cloudhead 55c4de0239
Remove outdated Dockerfiles 2024-04-29 18:02:07 +02:00
cloudhead b31fbde159
node: Add `log` to node config 2024-04-29 15:59:17 +02:00
cloudhead 7126d05130
node: Use constant delay for refreshing node ann
We use a shorter, constant delay, so that it is the same on all nodes.
2024-04-29 12:49:59 +02:00
cloudhead a815640a3b
node: Always try to relay node announcements
They are cached and will often be old. They should still be relayed.
2024-04-29 12:28:30 +02:00
cloudhead fe5757d122
Tidy up environment variables
* Try to use constants instead of strings
* Move crypto seed override out of radicle-crypto
* Use GIT_COMMITTER_DATE for commit overrides
* Use RAD_LOCAL_TIME as general time override
* Allow variables to be used in release mode
2024-04-26 10:38:54 +02:00
cloudhead deeb39c558
node: Support "transparent" Tor
This allows for configuring your node such that `.onion` addresses
encountered are treated as regular DNS names.
2024-04-26 10:37:41 +02:00
cloudhead 70d2e1a0db
node: Improve `Timestamp` conversion safety
Remove `Timestamp::from(u64)` instance, since not all `u64`s are valid
Timestamps, and add `try_from` instead.
2024-04-26 10:33:34 +02:00
cloudhead c607619683
node: Don't relay old messages
Avoids spamming peers on startup.
2024-04-24 13:25:58 +02:00
cloudhead 2b771921d5
node: Type-safe timestamps
Use a struct to represent timestamps, to improve type safety.
2024-04-24 12:19:40 +02:00
cloudhead 0fcfbb3ecf
node: Don't re-use timestamps
There are rare cases where ref announcements may be sent in close
succession, and the current clock time is re-used. This will cause the
second (newer) announcement to be ignored by peers.

We add a `timestamp` method that checks if the timestamp is re-used, and
increments it if so, ensuring that we always use a fresh one.
2024-04-24 12:19:40 +02:00
cloudhead cdebbe5bb7
node: Improved message logging 2024-04-23 10:41:43 +02:00
cloudhead d77b5d5abe
node: Add 'disconnect' command to handle 2024-04-23 09:52:25 +02:00
cloudhead 7a1ba7d4b1
node: Add support for `.onion` addresses in wire
Adds support for encoding and decoding onion addresses in the gossip
protocol.
2024-04-22 12:16:17 +02:00
cloudhead 4276a70eb1
node: Event on local refs announcement
This allows us to listen on the socket for when the user announces new
refs.
2024-04-18 10:57:55 +02:00
cloudhead e5d8563cca
node: Update routing table on fetch
Since a user can force a fetch of a private repository without any
announcement being involved, we update the routing table if the fetch
completes successfully, with the remote node.
2024-04-18 10:51:23 +02:00
Fintan Halpenny 8bf871903a
node: handle removal of cob from cache
When a `Patch` or `Issue` is entirely removed from the Git repository,
then there is no update to be made -- instead it should also be
removed from the cache.

This covers the case where the original author of the COB deletes the
COB.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-04-09 16:06:51 +02:00
cloudhead 53ecc88437
node: Always notify the service of a fetch result
Even if the peer is no longer connected.
2024-04-09 16:00:49 +02:00
cloudhead 395d317954
node: Keep track of data sent/received in fetch
Keep track and log the Git data sent/received.
2024-04-09 15:59:55 +02:00
cloudhead ef1ed621d7
node: Don't re-queue fetch that is already queued 2024-04-08 17:15:57 +02:00
cloudhead e19c773a86
fetch: Improve logging of clone 2024-04-08 17:06:38 +02:00
cloudhead 976b58ba7a
node: Simplify and fix fetch dequeueing
There was redundant code and a missing `break`.
2024-04-08 12:48:49 +02:00
cloudhead ad7ba82e6a
node: Populate refs db on startup
If the refs database is empty, populate it on startup.
Also includes a script to clear it.
2024-04-05 21:59:58 +02:00
cloudhead 7834dccd2c
node: Account for skipped refs when announcing 2024-04-05 17:40:53 +02:00
cloudhead bc247dff24
node: Skip fetch early if no refs in announcement 2024-04-05 12:17:17 +02:00
cloudhead e55c86f1ce
node: Improve fetch logging 2024-04-04 18:41:53 +02:00
cloudhead 6ff4efebed
node: Remove namespaces from fetch request
It was unused..
2024-04-04 18:22:19 +02:00
cloudhead f2fe0242e1
node: Always check refs status before fetching
We were only checking it on dequeue.

Also simplifies some of the logic by centralizing the check for fetching
our own refs.
2024-04-04 18:10:49 +02:00
cloudhead 51e64cfa8b
node: Fix logging for skipped refs
We were using the wrong condition.
2024-04-04 12:24:49 +02:00
Fintan Halpenny cd9b46fe51
radicle: fault tolerant thresholds
There are two areas where we can be more tolerant of delegate namespaces
being missing or not validating:
1. Calculating the canonical HEAD
2. Fetching from a remote

In 1. the protocol is tolerant in that if the local node does not have
the default branch for a delegate, it will still attempt to use any of
the delegates it does have to reach the threshold.

This is made safe by ensuring that if the threshold is being updated
then the node performing the update must have a threshold of delegates
locally in their storage. It also made safe by 2.

In 2. the protocol is tolerant by allowing delegates to be missing
from the serving side, as long as they can still meet a threshold of
delegates. This is further tolerant, when validating the received
data, a threshold of delegates are valid to consider the fetch
successful -- otherwise it will fail.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-04-03 14:30:05 +02:00
cloudhead 7e13e0759f
node: Simplify handling of fetch completion
* Don't branch based on whether it was a user-requested fetch or not.
* Only announce inventory on clones of public repos.
2024-04-03 14:25:02 +02:00
cloudhead fd4f5fff7d
node: Don't fetch if only our own remote
Skip the fetch from announcement if the announcement only contains our
own remote.
2024-04-03 14:25:02 +02:00
cloudhead 6744ffc325
node: Improvements to test reliability 2024-04-03 14:25:02 +02:00
cloudhead e90c6a49bc
node: Include identity doc in fetch result
This avoids having to reload the document in the service, which can be
an expensive operation.
2024-04-03 14:25:02 +02:00
cloudhead 2b9a014243
node: Small changes and note around initial state 2024-04-01 16:32:30 +02:00
cloudhead 256c620d31
node: Use refs cache to decide on fetching
When deciding whether or not to fetch a repo based on a refs
announcement, we need to know whether our signed refs are stale or not,
compared to the ones in the announcement. This can be quite expensive as
it requires multiple reads from Git's ODB, which often results in
packfile loading.

To remedy this, we introduce a refs cache in our node database that is
consulted when an announcement is received.

We also remove the logic that generates `info` messages, since they are
rarely needed and introduced more complexity.

Additionally, we revert commit 3ad2b4431f,
which introduced logic to minimze wants and haves with additional logic,
since it potentially also increases the load on the ODB.
2024-03-29 16:00:33 +01:00
cloudhead 9cdf0aa1fd
Update radicle crates to 0.9.0 2024-03-26 11:56:27 +01:00
cloudhead 5b5a6842c1
Update toolchain to Rust 1.77 2024-03-26 10:03:11 +01:00
cloudhead 0bcec941ee
node: Change behavior on conflicting connections
Instead of dropping the existing connection(s), we drop the same
connection on both sides, by using a simple rule that yields the same
result whether the node sees the connection as inbound or outbound.

The trick is to use something that both nodes agree on, for instance
whos public key is greater than the other, and use that information
to close the same connection on both sides.
2024-03-25 12:48:27 +01:00
cloudhead e695d06bbb
node: Logging improvements & other small things 2024-03-25 12:05:05 +01:00
cloudhead dbf47fe4e9
Implement new versioning system
See `VERSIONING.md` for details.
2024-03-25 11:54:08 +01:00
cloudhead ada492f699
node: Improve logging more 2024-03-22 18:00:48 +01:00