Commit Graph
219 Commits
Author SHA1 Message Date
Asmir Avdicevic 59babe14aa chore: update netsim sims (#887) 2023-03-27 13:50:59 +02:00
Fabrice Desré 4e8ae8419e Fix typo in cli documentation (#885) 2023-03-27 10:41:26 +02:00
Floris Bruynooghe 887c128ccf deps(default-net): bump version (#879)
This contains code for android
2023-03-27 09:51:43 +02:00
bing bf22ee2c31 chore: ci - replace actions-rs with dtolnay/rust-toolchain (#884)
this action maintained by dtolnay provides some nicer defaults,
eg. no need to specify a minimal profile. It's also maintained :)
2023-03-24 23:25:10 +01:00
Asmir Avdicevic 2c0663a9fc feat: cmd to list provide addrs (#859) 2023-03-24 17:55:45 +01:00
Asmir Avdicevic 3291291991 fix: fix netsim bin paths (#881) 2023-03-24 11:10:24 +01:00
Floris Bruynooghe f19894486b ci(android): Use the real android targets (#880)
This changes the cross-compiling targets to use those that are used by
the real android phones.
2023-03-23 18:03:53 +01:00
Asmir Avdicevic 8fe1d8157a feat: ci netsim integration tests (#877)
* feat: ci netsim integration tests

* cleanup
2023-03-23 17:31:47 +01:00
Rüdiger Klaehn 5770abe462 Validate progress (#874)
* refactor: change rpc protocol to send progress on provide

* WIP add progress

* WIP more hacking in progress work

* WIP more progress

* WIP add the actual progress tracking

* progress finished

* refactor: move ProvideResponse / ProvideResponseEntry out of the RPC protocol

* validate progress

- generate events

* Add nice validate progress

* refactor: simplify provide code

* pr: review comments from this PR and last one
2023-03-23 12:34:02 +02:00
Rüdiger Klaehn fb3c1e4132 Progress for adding files (#873)
* refactor: change rpc protocol to send progress on provide

* WIP add progress

* WIP more hacking in progress work

* WIP more progress

* WIP add the actual progress tracking

* progress finished

* refactor: move ProvideResponse / ProvideResponseEntry out of the RPC protocol

* refactor: simplify provide code
2023-03-23 11:57:18 +02:00
Floris Bruynoogheanddignifiedquire 9ac4cf6e77 feat: Set multiple addrs in the ticket (#820)
If the provider address is bound to a wildcard address put a list of
addresses in the ticket.

Co-authored-by: dignifiedquire <me@dignifiedquire.com>
2023-03-22 14:27:38 +01:00
Rüdiger Klaehn ada047aa06 Allow nested directories while still keeping the flat collection / blob hierarchy (#845)
* feat(persistence): copy over directory functions from beetle

* feat: add snapshot type that deals with persistence

* test(persistence): add property based tests for db persistence

* feat(persistence): basic persistence works

* Make provider cloneable

* refactor:

provider is getting to big, so give it its own submodule and put database
in there.

* clippy

* fix: disable persistence in cli tests

* refactor: make the snapshot stuff just pub(crate)

so we don't bloat the public API

* fix: properly handle when iroh data dir does not exist yet

Also fix mixup of dir names

* fix: persist key in iroh data root if persistence is on

* feat: canonicalize before adding collection

Not saying that we should suddenly start to care about canonicalization, but
it is almost free, so we might as well do it.

* feat: allow deep directory structures

* fix: make sure deep directories are created

* refactor: use walkdir

* pr: remove unused dev dependency and dead code annotation

* test: add basic test for persistence

* pr: remove key and persist options

it will now always persist.

Also fix the test by not mixing sync and async.

* refactor: get rid of collection name

The name should be external

* refactor: make fields in Collection private

...so we can canonicalize it

* ci: change toolchain for doc to stable

* refactor: canonicalize collection on create

conceptually, a collection should be a set of name -> blob mappings that
is sorted by name. We could use a BTreeMap or a RadixTree later.

* fix: special handling for single files

* doc: add comment about traversal

* feat: properly handle windows insanity

* Add basic test for canonicalize_path

* test: add a test that sends a (tiny) hierarchy

* refactor: runtime check for duplicate names

* pr review: minor changes and comments
2023-03-22 12:14:59 +02:00
Rüdiger Klaehn 16b11cff0c Remove collection name (#867)
* refactor: get rid of collection name

The name should be external

* refactor: make fields in Collection private

...so we can canonicalize it

* ci: change toolchain for doc to stable
2023-03-21 13:52:47 +02:00
Asmir Avdicevic 7b91c9ae4d feat: release builds (#863) 2023-03-21 09:34:20 +01:00
Asmir Avdicevic 10787624b0 feat: custom configs for netsim (#862) 2023-03-20 11:17:23 +01:00
Friedel Ziegelmayer f05ec8cbde feat(provider): emit events about outgoing transfers 2023-03-17 23:12:22 +01:00
Rüdiger Klaehn 2bc899a07f Add rpc command to validate the store contents (#852)
* feat(persistence): copy over directory functions from beetle

* feat: add snapshot type that deals with persistence

* test(persistence): add property based tests for db persistence

* feat(persistence): basic persistence works

* Make provider cloneable

* refactor:

provider is getting to big, so give it its own submodule and put database
in there.

* clippy

* fix: disable persistence in cli tests

* refactor: make the snapshot stuff just pub(crate)

so we don't bloat the public API

* fix: properly handle when iroh data dir does not exist yet

Also fix mixup of dir names

* fix: persist key in iroh data root if persistence is on

* feat: validation of database

* feat: add nicer output for validate

* pr: remove unused dev dependency and dead code annotation

* test: add basic test for persistence

* pr: remove key and persist options

it will now always persist.

Also fix the test by not mixing sync and async.

* pr: address PR issues

- styled output
- comments
- no big buffer on stack

* doc: add todo for commented out errors that need to be done
2023-03-17 15:12:16 +02:00
Rüdiger Klaehn bdfd82f7cc Basic persistence (#832)
* feat(persistence): copy over directory functions from beetle

* feat: add snapshot type that deals with persistence

* test(persistence): add property based tests for db persistence

* feat(persistence): basic persistence works

* Make provider cloneable

* refactor:

provider is getting to big, so give it its own submodule and put database
in there.

* clippy

* fix: disable persistence in cli tests

* refactor: make the snapshot stuff just pub(crate)

so we don't bloat the public API

* fix: properly handle when iroh data dir does not exist yet

Also fix mixup of dir names

* fix: persist key in iroh data root if persistence is on

* pr: remove unused dev dependency and dead code annotation

* test: add basic test for persistence

* pr: remove key and persist options

it will now always persist.

Also fix the test by not mixing sync and async.
2023-03-17 13:54:19 +02:00
Friedel Ziegelmayer 8324900895 Merge pull request #855 from n0-computer/fix-many-files
fix: large collections
2023-03-16 17:35:59 +01:00
dignifiedquire c28e0a8447 fix(provider): ensure postcard buffers are appropriately sized 2023-03-16 17:25:52 +01:00
dignifiedquire bdab1741da test: add failing test for large collections 2023-03-16 17:25:48 +01:00
Rüdiger Klaehn b2730ee004 fix: use absolute paths everywhere (#836)
Otherwise it is not possible to add things if the add cli has a different
$PATH than the daemon.
2023-03-14 10:34:01 +02:00
Rüdiger Klaehn 7e5ac39054 Id and shutdown (#823)
* feat: add shutdown command

hard for process exit, soft for graceful shutdown

* feat: add id command

currently it prints exactly the same thing as provide prints on startup

* pr and clippy:

rename hard to force, and avoid giant enum for IdResponse
2023-03-10 12:35:49 +02:00
Friedel Ziegelmayer 4e9aae334f Merge pull request #824 from n0-computer/fix-update-default-net
fix: update to new default-net
2023-03-09 22:35:34 +01:00
Rüdiger Klaehn 0394b30692 Allow disabling rpc (#821)
* Allow disabling rpc by passing 0 for rpc-port

* review: make a special enum so rpc port can be disabled with "disabled"

* pr: impl Into<Option> instead of having a named fn
2023-03-09 19:20:49 +02:00
Rüdiger Klaehn d68f05dc76 feat: use chunk groups feature (#798)
caution: this is not compatible with existing iroh/sendme
2023-03-09 19:20:25 +02:00
dignifiedquire e2584c007b fix: update to new default-net 2023-03-09 17:59:51 +01:00
Floris Bruynooghe 9f2b486a6f ref: Improve error for connection timeout (#818)
Otherwise you just get `timed out` as error and have no clue what's
going on.
2023-03-09 15:25:58 +01:00
Friedel Ziegelmayer 9323e10c97 feat(net): implement local address detection (#822)
Based on the work done in `x-hp`.
2023-03-09 15:19:03 +01:00
Floris Bruynooghe 55a4c3aa4a deps: New version of tempfile to avoid security issue (#819)
A dependency of tempfile had a security issue which could affect us.
Bump the version.
2023-03-09 10:33:59 +01:00
Floris Bruynooghe b0ade88df2 ref: Bring back testdir for integration tests (#811)
This should have a fix for the windows bug now.
2023-03-03 14:54:52 +01:00
Floris Bruynooghe 96bb61b2a8 ci: Add cargo-deny (#810)
This is a minimal cargo deny config which should not give us too many
issues.  Let's see how this works in practice.
2023-03-03 14:54:23 +01:00
Rüdiger Klaehn a3ed15a876 Daemonize iroh (#779)
* ref: use separate alpn for rpc calls

* feat: pass errors to the client

* Add comment about path

* feat: copy over the watch and version stuff from iroh

This is so we can detect if the sendme server is running

* docs: add todo about better way to check the server is available

* refactor: update to new quic-rpc

* refactor: move RpcError and RpcResult to util

* refactor: prettify the code a bit

* feat: print peer id and address and stuff on startup

* refactor: make a constant for RPC port

* refactor: Put RPC_ALPN into a const

* fix: use Ipv4Addr::LOCALHOST on server

* fix: ipv6

* refactor: Use RwLock instead of mutex

Should help a bit, so why not?

* feature: make rpc port configurable

* add ability to talk to provider internally via the RPC interface

* adapt cli tests

* review comments

* docs: Add some docs for why we need to wait when closing a rpc client

* feat: nicer output for add and provide

* clippy

* fix: better output for list

* refactor: remove the delay when dropping the client

This now gets taken care of in quic-rpc. The shutdown_timeout is good to
limit the time for a clean shutdown so we don't have to wait indefinitely.
2023-03-01 19:53:32 +02:00
Kasey d6456d26b4 add more context to the tests to better understand why certain matches failed (#799)
also adjust the order of testing: we now test the success of the `get` command & the output file before testing the stderr output
2023-03-01 09:59:30 -05:00
Floris Bruynooghe fe97e4d154 ref: micro-optimise by reserving buffer size (#803)
Before going into the loop we may as well make sure to reserve enough
space for the entire buffer.  Otherwise we could be allocating
multiple times.

This does not change the total allocated size.  Though this does add a
missing limit to the allocated size.
2023-03-01 11:07:38 +01:00
Floris Bruynooghe c0d4984086 fix: Do not send duplicate NotFound responses (#802)
The code was accidentally sending this response twice.  send_blob()
already sends NotFound, and it seems like it belongs more there.
2023-03-01 10:23:37 +01:00
Floris Bruynooghe eb18a89fa6 fix: Output writing (#804)
This simply delegates to eprintln! for writing output.  This ensures
writes happen more synchronously and the flaky integration tests are
fixed.

While in theory these are blocking operations on the async executor,
this is acceptable because:

- We already use println!() without any problems.  Arguably this is
  more of an issue since we also write data to stdout but it isn't
  because we don't do that at the same time.

- We print a small number of messages, not large amounts of data.  Any
  blocking from this will be small.

- This acquires a sync mutex while writing, that's fine because it is
  acquired and released in the same chunk of async code and not held
  across await points.  This is unlikely to block much as only main
  writes and only one write happens at a time.

- When logging via tracing is enabled this will also end up logging on
  here and will compete for the lock.  This is slightly higher
  contention but doesn't really interfere with the logging here.
2023-02-28 18:34:54 +01:00
Floris Bruynooghe e80051e43d ref: Remove duplicate read_lp implementation (#801)
Seems like we ended up with two bits of code doing exactly the same.
Clean it up.

This settles on read_lp() as name since this is symmetric with
write_lp() which writes bytes.  This implementation inlines the
functions a bit more as well, the entire function is still small and
it is used often.
2023-02-28 18:10:34 +01:00
Rüdiger Klaehn 7cf2a3a621 No out writer (#797)
* refactor: replace out_writer with a out_println! macro

* refactor: rename out_println! to progress!

It does not really write to stdout but to stderr, so out...anything is a
bit misleading.
2023-02-27 14:25:21 +02:00
Asmir Avdicevic 1a68106d07 feat(ci): push data to metro (#794) 2023-02-26 15:33:41 -05:00
Kasey 61ba002855 test: cli integration test for provide-get loop (#781)
Tests the provide-get loop, transferring a single file, a folder of multiple files, and data from stdin of the provider to stdout if the better, ensuring that the content is transferred successfully.

The tests also test the stdout of the provider and stderr of the getter, using regex matching on each line of the respective output.
2023-02-24 11:35:05 -05:00
Ar Nazeh a12de97431 docs: fix typo (#792)
I assume it is a typo.
2023-02-24 11:00:33 +01:00
Asmir Avdicevic 7fb888d699 fix(ci): format output as table (#791) 2023-02-24 10:06:30 +01:00
Floris Bruynooghe 33c0482874 fix: Improve listening addr output (#789)
This fixes the log message output which had an extraneous newline in
it and needlessly used debug output.

It also adds the listening address to the normal provider output: This
is universally useful since you can specify addresses with -a but
don't otherwise know which one is used if using OS-allocated ports.
This can also be useful for testing.
2023-02-24 09:52:44 +01:00
Floris Bruynooghe a0b7c26e5a feat: Show more numbers in human readable form (#790)
This shows sizes in KiB, MiB etc.  Also adds a few totals and transfer
summaries.
2023-02-23 19:46:24 +01:00
Floris Bruynooghe 907644345f fix: Avoid other output between contents when printing (#786)
This makes sure the OutWriter writes the newline as part of the same
buffer as the output.  This makes it less likely that the output will
be interrupted between the content and the newline.  E.g. without this
and enabling logging, log messages will be injected between the
content and the newline, making the output garbled.

Unfortunately this isn't entirely correct and is more of a heuristic
because most of our output is small enough that they fit in a single
write.  In the blocking world you'd lock Stderr while printing the
messages, in the tokio world however I don't know how to safely do
this.
2023-02-23 19:45:11 +01:00
Asmir Avdicevic 6a5c13e31c fix(ci): move from sendme to iroh (#788) 2023-02-23 09:42:33 +01:00
Floris Bruynooghe d9aed3ca78 ref: Rename --token to --auth-token for get (#785)
This is consistent with the naming for the provide subcommand and is
more descriptive as well.
2023-02-22 18:51:58 +01:00
dignifiedquire 7923829538 chore: Release iroh version 0.3.0 v0.3.0 2023-02-22 15:27:10 +01:00
dignifiedquire c8855f8cba chore: add changelog for 0.3.0 2023-02-22 15:24:34 +01:00