Commit Graph

344 Commits

Author SHA1 Message Date
Juan Batiz-Benet
c595cf8ae0 config: DialBlocklist -> Swarm.AddrFilters
This commit changes the DialBlocklist key to be under the key
Swarm.AddrFilters instead.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-02 16:11:46 -07:00
Juan Batiz-Benet
a119b72243 t0141-addfilter: check init has no filters
License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-02 16:10:30 -07:00
Jeromy
57d7a443a0 test dialblocklist loading from config
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-02 13:38:15 -07:00
Jeromy
7cc73f7b86 add command to manipulate address filters and a sharness test for them
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-06-30 18:25:34 -07:00
Juan Batiz-Benet
6b8e9f51fe fix t0061-daemon-opts.sh nc wait
fix the nc wait. the issue was that stdin needs to remain _open_
but not receive any input for some time. If stdin receives (invalid)
input or closes, the other side terminates the connection before
writing out the muxer frames + identify handshake.

This commit also changes the use of `!` for `test_must_fail`

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-06-26 23:36:43 -07:00
Juan Batiz-Benet
f300e97c50 added sharness/t0061-daemon-opts
Test odd daemon options, like:
- unrestricted-api
- disable-transport-encryption (known breakage atm)

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-06-26 23:36:43 -07:00
Juan Batiz-Benet
9716018ca5 daemon output includes swarm addresses
daemon output now includes initial swarm addresses. this is not a
full solution, as a change in network will not trigger re-printing.
We need a good way to do that.

This made me re-think how we're outputting these messages, perhaps
we should be throwing them as log.Events, and capturing some with
a special keyword to output to the user on stdout. Things like
network addresses being rebound, NATs being holepunched, external
network addresses being figured out, connections established, etc
may be valuable events to show the user. Of course, these should be
very few, as a noisy daemon is an annoying daemon.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-06-26 23:36:43 -07:00
Juan Batiz-Benet
500f51300d ipfs swarm addrs local - show local addrs
Add a command to return local addresses.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-06-26 23:36:42 -07:00
Juan Batiz-Benet
748d25f473 t0060-daemon: test transport is encrypted
License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-06-26 23:36:42 -07:00
Christian Couder
1a77297182 t0060: export IPFS_PATH
IPFS_PATH should really be exported to make sure it is
available to the ipfs binary.

It looks like sharness tests fail otherwise on CircleCi.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-06-26 02:07:57 -07:00
Juan Batiz-Benet
ac7d25c2cc Merge pull request #1423 from ipfs/test/only-hash
add test for only-hash to ensure no blocks are added to datastore
2015-06-25 14:07:03 -07:00
Jeromy Johnson
0332f3dbaa Merge pull request #1348 from ipfs/tk/unixfs-ls
Add 'ipfs file ls …'
2015-06-25 10:03:52 -07:00
Jeromy
53dee3c64d add test for only-hash to ensure no blocks are added to datastore
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-06-25 09:33:47 -07:00
Jeromy
60ad7a5afc sharness tests for --only-hash
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-06-23 09:04:31 -07:00
W. Trevor King
4acab79d66 core/commands/unixfs/ls: Explicitily record stat in LsObject
Instead of abusing a LsLink for non-directory objects [1].

[1]: https://github.com/ipfs/go-ipfs/pull/1348#discussion_r32680669

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-20 13:34:47 -07:00
W. Trevor King
5fd4812b20 core/commands/unixfs/ls.go: Fix (and test) single-directory listing
We don't want to prefix these results with the argument.  If there was
only one argument, the unprefixed results are still explicit.

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-20 13:34:47 -07:00
W. Trevor King
7fc2410d95 core/commands/unixfs/ls: Hash-map for Objects
Discussion with Juan on IRC ([1] through [2]) lead to this adjusted
JSON output.  Benefits over the old output include:

* deduplication (we only check the children of a given Merkle node
  once, even if multiple arguments resolve to that hash)

* alphabetized output (like POSIX's ls).  As a side-effect of this
  change, I'm also matching GNU Coreutils' ls output (maybe in POSIX?)
  by printing an alphabetized list of non-directories (one per line)
  first, with alphabetized directory lists afterwards.

[1]: https://botbot.me/freenode/ipfs/2015-06-12/?msg=41725570&page=5
[2]: https://botbot.me/freenode/ipfs/2015-06-12/?msg=41726547&page=5

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-20 13:34:47 -07:00
W. Trevor King
f0a0ac1b83 core/commands/unixfs/ls: Use a stringified type name
This doesn't affect the text output, which was already using a
stringified name.  The earlier stringification does change the JSON
output from an enumeration integer (e.g. 2) to the string form
(e.g. "File").  If/when we transition to Merkle-object types named by
their hash, we will probably want to revisit this and pass both the
type hash and human-readable-but-collision-prone name on to clients.

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-20 13:34:47 -07:00
W. Trevor King
c9733c5da7 core/commands/unixfs/ls: Set Argument in JSON output
Change the approach to the directory-header control so we can set the
Argument value in the JSON response.

Stripping the trailing newline from the JSON output is annoying, but
looking over [1] I saw no easy way to add a newline to the JSON
output.  And with the general framework that commands/ attempts to be,
it feels a bit funny to customize the JSON output for a command-line
program.  Perhaps a workable solution is to have the command-line
client append newlines to any output that otherwise lacks them?  But
that seems like a change best left to a separate series.

[1]: http://golang.org/pkg/encoding/json/

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-20 13:34:44 -07:00
Jeromy Johnson
7d254aef20 Merge pull request #1404 from ipfs/feat/patch-path
allow patch add-link to add at a path
2015-06-19 22:01:57 -07:00
Jeromy
d585e20ebc allow patch add-link to add at a path
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-06-19 20:45:20 -07:00
W. Trevor King
e700c02cbd core/commands/publish: Allow explicit local node ID
Instead of raising "keychains not yet implemented" whenever we have an
explicit node ID, only raise the error when the given node ID isn't
the local node.  This allows folks to use the more-general
explicit-node-ID form in scripts and such now, as long as they use the
local node name when calling those scripts.

Also add a test for this case, and update the comment for the
one-argument case to match the current syntax for extracting a
multihash name string.

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-19 04:08:43 -07:00
Jeromy
96e98a8e13 add sharness test for log endpoint
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-06-18 12:44:02 -07:00
rht
18f5fcea28 golint util/, thirdparty/
and exchange/bitswap/testutils.go

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2015-06-18 10:03:57 +07:00
Juan Batiz-Benet
c73d0e0b56 Merge pull request #1346 from ipfs/tk/ls-trailing-tabs
core/commands/ls: Remove trailing tabs
2015-06-16 16:42:13 -07:00
Christian Couder
408a818b4a ipfs-test-lib: use test_seq from sharness
As Sharness now includes test_seq we can remove
our implementation.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-06-14 11:21:32 +02:00
Christian Couder
0befe2bf88 install-sharness.sh: update sharness
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-06-13 22:40:34 +02:00
Christian Couder
ac9f441f1f sharness/Makefile: force sharness version check
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-06-13 22:39:37 +02:00
Christian Couder
3101df56fa install-sharness.sh: implement updates
We want to be able to update Sharness to benefit from
new features.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-06-13 22:36:47 +02:00
W. Trevor King
3e6905e8ba core/commands/unixfs: Rename 'ipfs unixfs' to 'ipfs file'
To be less confusing to newcomers (the IPFS filesystem isn't
Unix-specific anyway, and it isn't even very POSIX-specific [1,2,3]).
I'm a bit uncertain about having one name for users and another for
devs, but the consensus seems to be that mainaining two names is worth
the trouble [4].  We also kicked around:

* 'files' (plural),
* 'filesystem' (too long), and
* 'fs' (redundant after 'ipfs', even though IPFS isn't just about
  filesystems)

on IRC [5 through 6].  I wish there was a more evocative term.  I'm
never sure where "file" lands on the scale between "filesysytem",
"everything is a file", "a single chunk of data with an associated
inode".  But we can't think of anything better.

[1]: https://github.com/ipfs/go-ipfs/pull/1348#issuecomment-110529070
[2]: https://github.com/ipfs/go-ipfs/pull/1348#issuecomment-110529921
[3]: https://github.com/ipfs/go-ipfs/pull/1136/files#r29377283
  In my response to this (no longer visibile on GitHub):

  On Wed, Apr 29, 2015 at 01:30:04PM -0700, Juan Batiz-Benet wrote:
  > > +package fsnode
  >
  > i think this package should be called `unixfs` as that's the
  > abstraction that this is calling to.

  Will do, although I don't see what's especially Unix-y about these
  file nodes.

[4]: https://github.com/ipfs/go-ipfs/pull/1348#issuecomment-110529811
[5]: https://botbot.me/freenode/ipfs/2015-06-09/?msg=41428456&page=5
[6]: https://botbot.me/freenode/ipfs/2015-06-09/?msg=41430703&page=5

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-13 13:07:13 -07:00
W. Trevor King
663f37cb99 core/commands/unixfs/ls: Don't recurse into chunked files
Folks operating at the Unix-filesystem level shouldn't care about that
level of Merkle-DAG detail.  Before this commit we had:

  $ ipfs unixfs ls /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox
  /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox:
  ... several lines of empty-string names ...

And with this commit we have:

  $ ipfs unixfs ls /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox
  /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox

I also reworked the argument-prefixing (object.Argument) in the output
marshaller to avoid redundancies like:

  $ ipfs unixfs ls /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox
  /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox:
  /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox

As a side-effect of this rework, we no longer have the trailing blank
line that we used to have after the final directory listing.

The new ErrImplementation is like Python's NotImplementedError, and is
mostly a way to guard against external changes that would need
associated updates in this code.  For example, once we see something
that's neither a file nor a directory, we'll have to update the switch
statement to handle those objects.

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-13 13:06:34 -07:00
W. Trevor King
434871ba18 core/commands/unixfs: Add 'ipfs unixfs ls ...'
This is similar to 'ipfs ls ...', but it:

* Lists file sizes that match the content size:

    $ ipfs --encoding=json unixfs ls /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4
    {
      "Objects": [
        {
          "Argument": "/ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4",
          "Links": [
            {
              "Name": "busybox",
              "Hash": "QmPbjmmci73roXf9VijpyQGgRJZthiQfnEetaMRGoGYV5a",
              "Size": 1947624,
              "Type": 2
            }
          ]
        }
      ]
    }
    $ ipfs cat /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox | wc -c
    1947624

  'ipfs ls ...', on the other hand, is using the Merkle-descendant
  size, which also includes fanout links and the typing information
  unixfs objects store in their Data:

    $ ipfs --encoding=json ls /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4
    {
      "Objects": [
        {
          "Hash": "/ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4",
          "Links": [
            {
              "Name": "busybox",
              "Hash": "QmPbjmmci73roXf9VijpyQGgRJZthiQfnEetaMRGoGYV5a",
              "Size": 1948128,
              "Type": 2
            }
          ]
        }
      ]
    }

* Has a simpler text output corresponding to POSIX ls [1]:

    $ ipfs unixfs ls /ipfs/QmV2FrBtvue5ve7vxbAzKz3mTdWq8wfMNPwYd8d9KHksCF/gentoo/stage3/amd64/2015-04-02
    bin
    dev
    etc
    proc
    run
    sys
    $ ipfs ls /ipfs/QmV2FrBtvue5ve7vxbAzKz3mTdWq8wfMNPwYd8d9KHksCF/gentoo/stage3/amd64/2015-04-02
    QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4 1948183 bin/
    QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn 4       dev/
    QmUz1Z5jnQEjwr78fiMk5babwjJBDmhN5sx5HvPiTGGGjM 1207    etc/
    QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn 4       proc/
    QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn 4       run/
    QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn 4       sys/

  The minimal output allows us to start off with POSIX compliance and
  then add options (which may or may not be POSIX compatible) to
  adjust the output format as we get a better feel for what we need
  ([2] through [3]).

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html
[2]: https://botbot.me/freenode/ipfs/2015-06-12/?msg=41724727&page=5
[3]: https://botbot.me/freenode/ipfs/2015-06-12/?msg=41725146&page=5

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-13 12:44:26 -07:00
W. Trevor King
15135e10df core/commands/ls: Remove trailing tabs
Since 607468a9 (beautify 'ipfs ls' and 'ipfs object links', #833)
we've had these.  That pull request was about text/tabwriter [1] and
elastic tabstops [2], but we don't need a column separator at the end
of each line.

[1]: https://golang.org/pkg/text/tabwriter/
[2]: http://nickgravgaard.com/elastic-tabstops/index.html

Licence: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-09 06:23:44 -07:00
Jeromy
c214210354 add some basic testing for object patch 2015-06-08 10:19:26 -07:00
Christian Couder
14a3315dc7 sharness/test-lib: use go-sleep to sleep
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-06-07 10:29:08 +02:00
Christian Couder
fd449af227 test/Makefile: build go-sleep
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-06-07 10:28:13 +02:00
Christian Couder
59cac0a161 test-lib: use test_seq()
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-06-03 23:53:24 +02:00
Christian Couder
3c2e0ba586 ipfs-test-lib: implement test_seq()
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-06-03 23:51:50 +02:00
Juan Batiz-Benet
898863d632 Merge pull request #1323 from ipfs/revert-godeps-update
Revert "godeps: update everything to master"
2015-06-03 14:26:16 -07:00
Jeromy
db98e77de9 add a test for issue repro 2015-06-03 08:41:25 -07:00
rht
9bdc1d6060 Test repeat in 10 sec: increase check frequency tenfold 2015-06-03 16:49:03 +07:00
Jeromy
ef294431d4 move util.Key into its own package under blocks 2015-06-01 16:10:08 -07:00
Juan Batiz-Benet
0f7f8ead04 disable constantly failing iptb tests
the iptb tests are failing all the time on travis. It's possible
this is still a port problem, and it may be something else.
Regardless, right now they're just adding noise.
2015-05-31 16:05:31 -07:00
Juan Batiz-Benet
109a618aca iptb sharness tests: randomize ports
Otherwise they clash with each other if running on the same machine
2015-05-31 14:59:03 -07:00
Juan Batiz-Benet
b5bd29a5d7 Merge pull request #1290 from ipfs/feat/bitswap-speed
move findproviders out of critical path
2015-05-31 14:30:27 -07:00
rht
f5d5095b1b Add newline to 'ipfs init' error message 2015-05-30 13:40:38 +07:00
rht
17d71c49ce Add test for no repo error message 2015-05-30 13:13:27 +07:00
Jeromy
f574cd4b80 Move findproviders out of main block request path
This PR moves the addition of new blocks to our wantlist (and their
subsequent broadcast to the network) outside of the clientWorker loop.
This allows blocks to more quickly propogate to peers we are already
connected to, where before we had to wait for the previous findProviders
call in clientworker to complete before we could notify our partners of
the next blocks that we want. I then changed the naming of the
clientWorker and related variables to be a bit more appropriate to the
model. Although the clientWorker (now named providerConnector) feels a
bit awkward and should probably be changed.

fix test assumption
2015-05-29 18:28:36 -07:00
Juan Batiz-Benet
ecdf14962c Merge pull request #1294 from rht/cleanup-tour
Cleanup tour
2015-05-29 16:59:17 -07:00
Henry
37b32a6587 sharness/daemon: improve error detection 2015-05-29 14:20:07 +02:00