Commit Graph

278 Commits

Author SHA1 Message Date
Joonas Koivunen
b6e21ab17a refactor: drop unused hex dependency 2020-08-25 17:02:48 +03:00
Joonas Koivunen
ad69ef6d6f refactor: use hex_literal instead of hex::decode 2020-08-25 17:02:48 +03:00
Joonas Koivunen
e18c5d9f25 refactor: move one test case 2020-08-25 17:02:48 +03:00
Joonas Koivunen
f7f5a3cd09 refactor: move refs operation from ipfs-http 2020-08-25 17:02:48 +03:00
Joonas Koivunen
055fe8208e fix: check for unique nodes before queueing 2020-08-25 15:16:02 +03:00
Joonas Koivunen
771562aea6 refactor: remove confusing ResolvedNode methods
removes:

 - `fn destination(&self) -> Option<&Cid>`
 - `fn cid(&self) -> &Cid`
2020-08-25 14:07:29 +03:00
Joonas Koivunen
e2efa5236a doc: suggestions from code review
Co-authored-by: ljedrz <ljedrz@users.noreply.github.com>
2020-08-25 14:07:29 +03:00
Joonas Koivunen
2cf1192101 fix: return NotImplemented instead of panic 2020-08-25 12:36:37 +03:00
Joonas Koivunen
c2323b8b7e fix: pass the ".cat should error on unknown path" test again 2020-08-25 12:36:37 +03:00
Joonas Koivunen
e04dd9a6f0 feat: propagate path resolving to ipfs::unixfs::cat level
solved this wrong by isolating it first at http level, however now at
the ipfs::unixfs::cat level the http implementation is looking small as
it should be.

touched some error types and converted them to thiserror.
2020-08-25 12:36:37 +03:00
Joonas Koivunen
32b2553a89 fix: propagate dag errors to ipfs-http as well 2020-08-25 12:36:37 +03:00
Joonas Koivunen
5757a38cda chore: clippy 2020-08-25 12:36:37 +03:00
Joonas Koivunen
8df4be9d94 doc: refresh comments on cat 2020-08-25 12:36:37 +03:00
Joonas Koivunen
7c3ef132a8 chore: remove migrated resolving test cases 2020-08-25 12:36:37 +03:00
Joonas Koivunen
40914a7209 test: migrate resolving invalid list index case 2020-08-25 12:36:37 +03:00
Joonas Koivunen
c66cfe3136 chore: delete already migrated resolving test 2020-08-25 12:36:37 +03:00
Joonas Koivunen
efcfd510e2 feat: local resolving via http
sadly the test doesnt seem to work against jsipfs over http, so it
cannot be enabled, updated the skipped comment though.
2020-08-25 12:36:37 +03:00
Joonas Koivunen
51f3b072eb refactor: migrate from walk_path to dag::resolve
phew, big milestone here. still need to migrate the rest of the tests
but all is looking good.
2020-08-25 12:36:37 +03:00
Joonas Koivunen
358f800bdd refactor: replace walk_paths with ipfs::dag::resolve
zero new test errors ...
2020-08-25 12:36:37 +03:00
Joonas Koivunen
01483fa760 refactor: use more stringserialized in root_files 2020-08-25 12:35:51 +03:00
Joonas Koivunen
02dd734fd9 refactor: replace walk_path in favor of resolve
only one error message conformance test failing so far.
2020-08-25 12:35:51 +03:00
Joonas Koivunen
981a67d781 refactor: use ipfs.dag().resolve in http
perhaps the error message requirements have changed, since this worked
right away? aah nope, they must concern other uses of walk_path. well,
this passes the tests either way.
2020-08-25 12:35:51 +03:00
Joonas Koivunen
1a9d3216b9 refactor: remove IpfsPath::path to allow changing impl details
for example, we might want to just do the splitting manually over a
String. this can be added back, but right now it allowed removal of
unnecessary dependencies at tests.
2020-08-25 12:35:42 +03:00
ljedrz
d84d64cdc9 feat: implement /dht/query (i.e. get_closest_peers)
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-21 13:23:47 +02:00
ljedrz
c4b9358d7e docs: comment on some /dht features
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-21 11:20:13 +02:00
ljedrz
7f7ef95f1f feat: implement /dht/provide
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-21 11:17:14 +02:00
ljedrz
3e2e09ee8c feat: implement /dht/findprovs
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-20 19:18:02 +02:00
ljedrz
a33ee5fe09 feat: make dht/findpeer search the non-local DHT if necessary
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-20 19:05:50 +02:00
bors[bot]
140a86bdcc
Merge #320
320: Implement Ipfs::find_peer and /dht/findpeer r=koivunej a=ljedrz

Builds on https://github.com/rs-ipfs/rust-ipfs/pull/319, only the last 2 commits are new.

Introduces `Ipfs::find_peer` and `/dht/findpeer` that return addresses belonging to the given `PeerId`; if they are connected to already, the values are returned right away, otherwise the local DHT records are checked.

Blocked by https://github.com/rs-ipfs/rust-ipfs/pull/319.



Co-authored-by: ljedrz <ljedrz@gmail.com>
2020-08-20 10:18:15 +00:00
ljedrz
4f2ffe702e
perf: reorder checks to maximize short-circuiting speed
Co-authored-by: Joonas Koivunen <joonas.koivunen@gmail.com>
2020-08-20 10:12:00 +02:00
Joonas Koivunen
61b8b6ff1e doc: note reason for strange structuring 2020-08-19 21:56:34 +03:00
Joonas Koivunen
d75ea86685 chore: clippy 2020-08-19 21:50:52 +03:00
Joonas Koivunen
714ecaf093 refactor: remove http IpfsPath and tests 2020-08-19 21:49:07 +03:00
Joonas Koivunen
a57b11ba77 refactor: http: switch to ipfs::path::IpfsPath 2020-08-19 21:49:07 +03:00
Joonas Koivunen
fa652784d5 refactor: remove walk options from http::IpfsPath
definitely wrong place to have those options, and those should have test
cases, since the defaults were ... mixed.
2020-08-19 21:49:07 +03:00
Joonas Koivunen
ba81695178 doc: add FIXME for bad visited usage 2020-08-19 21:49:07 +03:00
Joonas Koivunen
9182ff4d6a doc: update stale FIXME into different FIXME 2020-08-19 21:49:07 +03:00
Joonas Koivunen
3935cf0c49 refactor: remove WalkSuccess::EmptyPath 2020-08-19 21:49:07 +03:00
Joonas Koivunen
ff4037db73 refactor: remove unused pub method 2020-08-19 21:49:06 +03:00
Joonas Koivunen
af8870aaae refactor: remove commented out code 2020-08-19 21:49:06 +03:00
Joonas Koivunen
960ba71a23 refactor: ipfs-http path towards ipfs::path::IpfsPath
first step, lot of commented out code left behind. it was definitely bad
idea to mix the IpfsPath and the iteration over that path.
2020-08-19 21:49:06 +03:00
Joonas Koivunen
a6918d9413 doc: note the refs timeout test case 2020-08-19 21:49:06 +03:00
ljedrz
32815129f1 feat: introduce /dht/findpeer
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-19 16:51:43 +02:00
bors[bot]
34205806a9
Merge #315
315: Use explicit Multiaddr wrappers r=koivunej a=ljedrz

Whether a `Multiaddr` contains `Protocol::P2p` (i.e. essentially `/p2p/PeerId`) or not has a lot of bearing on conformance tests, the internal object and APIs and error-handling. Since it is easy to introduce related human errors, it would be a good idea to enforce some type safety here by introducing 2 wrapper objects: `MultiaddrWoPeerId` and `MultiaddrWithPeerId`.

The extent to which they should be applied (in lieu of `Multiaddr`) is a matter for discussion - in my initial attempt I decided to apply them quite liberally, as it results in more type safety (there are still a few plain `Multiaddr`s left though).

Co-authored-by: ljedrz <ljedrz@gmail.com>
2020-08-18 16:53:28 +00:00
ljedrz
e119d25add feat: add extra /version fields
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-18 14:58:25 +02:00
ljedrz
6e8dff0bb7 feat: utilize the new Multiaddr wrappers 2020-08-17 15:51:26 +02:00
bors[bot]
aaf72c9ed4
Merge #110
110: add: p2p suffixes to multiaddrs from identify r=koivunej a=koivunej

not verified but indirectly used by the conformance tests when dialing a peer with an expected peerid.

Not 100% sure if this should be done, at least long as #105 is done at least to accept the multiaddrs with `/p2p/`.

Co-authored-by: Joonas Koivunen <joonas@equilibrium.co>
Co-authored-by: ljedrz <ljedrz@gmail.com>
2020-08-17 09:56:40 +00:00
ljedrz
7e1047f517 docs: note about the P2p protocol suffix returned by Ipfs::identity
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-17 10:43:00 +02:00
ljedrz
a02eedf10b refactor: remove append_p2p in /id
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-17 10:36:36 +02:00
ljedrz
993b80d2d1 fix: disallow Multiaddrs without the P2p protocol
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-14 16:19:56 +02:00