Commit Graph
195 Commits
Author SHA1 Message Date
Fintan Halpenny 8e26e4c046 radicle: canonicalize home path
If a path was passed to `Home` in non-canonical form it would not use
the right path for any initialisation or use.

The aim is to use the `canonicalize` function for paths. However, this
may return an error if none of the paths exist. To ensure that the
path exists the `new` constructor for `Home` creates the directory and
canonicalizes the path.

Since `new` now initialises the home directory, it would be useful if
it also initialised all the necessary subdirectories -- which removes
the need for the `init` method.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-16 16:35:59 +01:00
Alexis Sellier a7d2fa95cd node: Remove redundant handshake
With `NoiseXK` handshake implemented, there is no longer a need to
have an `Initialize` message and an extra state in the session.
2023-02-16 15:10:31 +01:00
Alexis Sellier 71561a8e12 node: Move state transition code to session 2023-02-16 15:09:53 +01:00
Alexis Sellier 011923f1df node: Buffer gossips until fetch is completed
This change ensures that gossip messages are buffered if we try to
send them during a fetch, and sent after the fetch completes.
2023-02-16 15:09:53 +01:00
Alexis Sellier 0f81f8a7aa node: Take session reference when writing messages
This ensures that we have an existing session when sending messages.
It also will allow us to check the session's state.
2023-02-16 15:09:53 +01:00
Alexis Sellier 950fae209d Make ReadStorage more usable
Previously, we were not able to access a `ReadRepository` instance
through `ReadStorage`. With this change, we are able to.
2023-02-15 22:08:20 +01:00
Alexis Sellier 89fcc6de1c node: Subscribe on track-repo
We re-subscribe after our tracking policy has been changed so that
peers are informed of our interests.
2023-02-15 22:07:51 +01:00
Alexis Sellier 8cbc3c2403 node: Move to NoiseXK
Move from NoiseNN with a custom authentication protocol, to NoiseXK.
Uses ECDH on the ed25519 curve via the `ec25519` library.
2023-02-15 22:05:04 +01:00
Slack Coder 76d23a3fa9 node: Add more command argument documentation
Document `--git-daemon` and describe the default values.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-15 15:17:07 +01:00
Alexis Sellier b29ce1a222 node: Fix bug when socket file is deleted
If the socket file is deleted while the node is running, we can no
longer quit with Ctrl-C. This is the "fix".
2023-02-15 10:41:09 +01:00
Alexis Sellier ee513ccf7e node: Complete the "relay" seed test
These are the final changes to get the "relay" scenario passing.
There are still some issues left, though it's done as far as the
test is concerned.
2023-02-14 20:31:40 +01:00
Alexis Sellier 7919c7ea61 node: Use millisecond precision for timestamps
Previously we used seconds, which could result in false positives
when checking for stale announcements, if things happened too quickly.
2023-02-14 20:31:40 +01:00
Alexis Sellier 72c99b7939 node: Handle SIGINT and SIGTERM properly
This ensures that the socket file is cleaned up on exit.
2023-02-14 13:28:16 +01:00
Alexis Sellier 3ae826dee2 node: Add clone test with seed acting as relay 2023-02-13 10:30:04 +01:00
Alexis Sellier 3e7761740f node: Rely on inventory announcement in rad init 2023-02-13 09:59:44 +01:00
Alexis Sellier c673f5db68 node: Add some useful test utility functions 2023-02-12 21:03:28 +01:00
Alexis Sellier 7087288cfb node: Implement inventory sync command 2023-02-12 20:57:33 +01:00
Alexis Sellier 2f1a18470e node: Fix filter construction and policy code 2023-02-12 17:07:57 +01:00
Alexis Sellier 5f4c6edee4 node: Simulator logging improvements 2023-02-12 16:48:46 +01:00
Alexis Sellier 42b4d95f93 node: Improve output of Session::fetch function 2023-02-12 16:22:51 +01:00
Alexis Sellier bd7c5a0daa node: Add ability to have default tracking policy
When a specific tracking policy isn't found, we allow setting a default.
To preserve existing behavior, the default is `Block`, ie. if a node
isn't tracked explicitly, it is blocked.

However, this change allows for using `Track` as the default, which
is a way to track everything without having to know the entities in
advance.
2023-02-12 16:22:51 +01:00
xphoniex bdc0ab9881 Update radicle-git and radicle-surf
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-10 22:14:50 +01:00
Alexis Sellier 488f043226 node: Properly reap git-daemon process 2023-02-10 12:57:04 +01:00
Slack Coder 02c07d7be1 cli: Test rad-clone is deterministic
The last commit of a newly cloned repository should remain untouched by
making `Node::project()` use a repository fixture instead of a randomly
generated one.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-09 16:49:52 +01:00
Alexis Sellier 69ac8be8fd node: Update local routing table on announce 2023-02-08 21:28:49 +01:00
Alexis Sellier f01735bef6 cli: Have init trigger routing table updates
Before this change, nodes had to be restarted to announce newly
initialized projects.
2023-02-08 16:29:42 +01:00
Alexis Sellier c138cd062c node: Give each peer its own inbox
Instead of a shared queue, each peer gets its own inbox.
2023-02-08 11:43:39 +01:00
Alexis Sellier 054655d79b node: Log read buffer if not empty 2023-02-07 21:13:29 +01:00
Alexis Sellier f66ecd4ece node: Replication fixes
* Read git request line before starting daemon, so that we don't leave
  git data in the socket read buffer in case of an error connecting to
  the daemon.
* Send a response on the fetch channel even if we disconnect the remote.
* Don't send `done` packet if there's an error; it won't be expected.
2023-02-07 21:04:13 +01:00
Alexis Sellier d59c422b9d node: Send special done packet to end protocol 2023-02-07 10:47:35 +01:00
Alexis Sellier f5f36191d9 node: Fix some connection-related logic 2023-02-07 10:47:35 +01:00
Alexis Sellier 7bdedd0ffd node: Fix bug with persistent peer reconnect
We weren't updating the sessions map when a persistent peer
was re-attempted. It would then panic when `connected` was called,
because the state would be `Disconnected`.
2023-02-07 10:47:35 +01:00
Alexis Sellier 2ceb39553e node: Remove redundant log 2023-02-07 10:47:35 +01:00
Alexis Sellier 037ff39894 node: Use JSON for control commands 2023-02-07 10:46:12 +01:00
Alexis Sellier 2649e9c6fe cli: Add rad-clone test 2023-02-07 10:46:12 +01:00
Alexis Sellier a8531eff36 node: Implement seeds control command 2023-02-07 10:46:12 +01:00
Alexis Sellier b542ddcd6c node: Create shared test environment
We move and combine some of the test code, so that the CLI tests and
node tests use shared code.
2023-02-07 10:46:12 +01:00
Alexis Sellier 45e31a5192 Communicate fetch results through control socket
This allows a CLI to report to the user what fetch requests were
fulfilled, and which ones failed.
2023-02-07 10:46:12 +01:00
Slack Coder 98f09130bb node: Elaborate --help message
Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-04 20:03:31 +01:00
Fintan Halpenny 3f48c2c516 Rust 1.67
Rust 1.67 was announced[0]. Update the necessary files for running
1.67 and fix the clippy suggestions for string interpolation.

[0]: https://blog.rust-lang.org/2023/01/26/Rust-1.67.0.html

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-04 19:30:29 +01:00
Alexis Sellier 98f7fe1db8 node: Rename GIT_RESET env var 2023-01-30 18:23:24 +01:00
Alexis Sellier c1a749e09e node: Make git-daemon errors more apparent 2023-01-30 14:07:31 +01:00
Alexis Sellier 03b94c81a0 node: Make git daemon listen configurable 2023-01-30 13:47:09 +01:00
Alexis Sellier 498a5c4e4a node: Handle fetched differently if initiated 2023-01-30 13:22:33 +01:00
Alexis Sellier 3aa105afda node: Return error if remote errors
Instead of simply breaking out of the loop, log and return an error.
2023-01-30 13:15:33 +01:00
Alexis Sellier 0726c553da node: Run git fetch without any user config 2023-01-30 12:35:08 +01:00
Alexis Sellier a0910f7593 Cleanup old fetch code
We only use the old code in the simulator now.
2023-01-30 12:26:29 +01:00
Alexis Sellier be77eebc3d node: Only try to fetch from connected nodes 2023-01-30 11:20:33 +01:00
Alexis Sellier ac23f45d9b node: Cleanup working naming 2023-01-29 21:41:16 +01:00
Alexis Sellier 7d5347b74f node: Document worker a little more 2023-01-29 21:34:40 +01:00