Commit Graph

4178 Commits

Author SHA1 Message Date
Juan Batiz-Benet
01e1e71221 Merge pull request #1208 from wking/dns-resolver
Rework mutable namespace resolution to handle recursion
2015-05-20 12:42:18 -04:00
W. Trevor King
ce015d241b namesys/namesys_test: Excercise mpns.ResolveN
Shifting the generic testResolution helper from the protocol-specific
dns_test.go to the generic namesys_test.go.
2015-05-20 08:40:44 -07:00
W. Trevor King
c9fceeb19b namesys/dns_test: Add DNS resolution tests with a mock resolver 2015-05-20 08:40:44 -07:00
W. Trevor King
1e6594d087 namesys/dns: Pluggable lookupTXT field
So we can attach a mock lookup function for testing.
2015-05-20 08:40:44 -07:00
W. Trevor King
e4447b3c96 core/commands/publish: Fix published message
Previously we had a confusing situation, with:

* single-arg doc: published name <name> to <value>
* double-arg doc: published name <value> to <name>
* implementation: Published name <name> to <value>

Now we have the uniform:

  Published to <name>: <value>

With the following goals:

1. It's clear that we're writing <value> to <name>'s IPNS slot in the
   DHT.
2. We preserve the order of arguments from the command-line
   invocation:

     $ ipfs name publish <name> <value>
     Published to <name>: <value>
2015-05-20 08:40:44 -07:00
W. Trevor King
416d454b42 core/commands: Make 'ipfs name resolve' IPNS-only
And add a generic 'ipfs resolve' to handle cross-protocol name
resolution.
2015-05-20 08:40:44 -07:00
W. Trevor King
e643f72c86 core/commands/dns: Add 'ipfs dns ...' for resolving DNS references
This lets users resolve (recursively or not) DNS links without pulling
in the other protocols.  That makes an easier, more isolated target
for alternative implemenations, since they don't need to understand
IPNS, proquint, etc. to handle these resolutions.
2015-05-20 08:40:44 -07:00
W. Trevor King
c2ff02850b core/commands/resolve: Add a -r / --recursive option
For explicitly enabling recursive behaviour (it was previously always
enabled).  That allows folks who are interested in understanding
layered indirection to step through the chain one link at a time.
2015-05-20 08:40:42 -07:00
W. Trevor King
3ead2443e5 namesys: Add recursive resolution
This allows direct access to the earlier protocol-specific Resolve
implementations.  The guts of each protocol-specific resolver are in
the internal resolveOnce method, and we've added a new:

  ResolveN(ctx, name, depth)

method to the public interface.  There's also:

  Resolve(ctx, name)

which wraps ResolveN using DefaultDepthLimit.  The extra API endpoint
is intended to reduce the likelyhood of clients accidentally calling
the more dangerous ResolveN with a nonsensically high or infinite
depth.  On IRC on 2015-05-17, Juan said:

15:34 <jbenet> If 90% of uses is the reduced API with no chance to
  screw it up, that's a huge win.
15:34 <wking> Why would those 90% not just set depth=0 or depth=1,
  depending on which they need?
15:34 <jbenet> Because people will start writing `r.Resolve(ctx, name,
  d)` where d is a variable.
15:35 <wking> And then accidentally set that variable to some huge
  number?
15:35 <jbenet> Grom experience, i've seen this happen _dozens_ of
  times. people screw trivial things up.
15:35 <wking> Why won't those same people be using ResolveN?
15:36 <jbenet> Because almost every example they see will tell them to
  use Resolve(), and they will mostly stay away from ResolveN.

The per-prodocol versions also resolve recursively within their
protocol.  For example:

  DNSResolver.Resolve(ctx, "ipfs.io", 0)

will recursively resolve DNS links until the referenced value is no
longer a DNS link.

I also renamed the multi-protocol ipfs NameSystem (defined in
namesys/namesys.go) to 'mpns' (for Multi-Protocol Name System),
because I wasn't clear on whether IPNS applied to the whole system or
just to to the DHT-based system.  The new name is unambiguously
multi-protocol, which is good.  It would be nice to have a distinct
name for the DHT-based link system.

Now that resolver output is always prefixed with a namespace and
unprefixed mpns resolver input is interpreted as /ipfs/,
core/corehttp/ipns_hostname.go can dispense with it's old manual
/ipfs/ injection.

Now that the Resolver interface handles recursion, we don't need the
resolveRecurse helper in core/pathresolver.go.  The pathresolver
cleanup also called for an adjustment to FromSegments to more easily
get slash-prefixed paths.

Now that recursive resolution with the namesys/namesys.go composite
resolver always gets you to an /ipfs/... path, there's no need for the
/ipns/ special case in fuse/ipns/ipns_unix.go.

Now that DNS links can be things other than /ipfs/ or DHT-link
references (e.g. they could be /ipns/<domain-name> references) I've
also loosened the ParsePath logic to only attempt multihash validation
on IPFS paths.  It checks to ensure that other paths have a
known-protocol prefix, but otherwise leaves them alone.

I also changed some key-stringification from .Pretty() to .String()
following the potential deprecation mentioned in util/key.go.
2015-05-20 08:40:05 -07:00
W. Trevor King
04a969835e namesys/dns: Use SplitN to find dnslink references
RFC 6763 requires printable ASCII except '=' for the key [1], but
allows any character including '=' in the value [2].  This patch
adjusts our parsing to avoid splitting on '=' in the value, and then
ignoring anything after that split.

[1]: https://tools.ietf.org/html/rfc6763#section-6.4
[2]: https://tools.ietf.org/html/rfc6763#section-6.5
2015-05-19 19:54:13 -07:00
W. Trevor King
03260a9281 namesys/interface: Expand package docs to discuss mutable names
What they are, why you'd use them, and which command-line tools you
can use to access this functionality.
2015-05-19 19:54:12 -07:00
W. Trevor King
02cb5f3b32 namesys/publisher: Drop the 'namesys: ' prefix for the Publish log
This is already handled by setup in namesys/routing.go:

  var log = u.Logger("namesys")
2015-05-19 19:54:12 -07:00
Juan Batiz-Benet
7157574619 Merge pull request #1250 from ipfs/test-cat-with-stdin
t0040: add tests for ipfs cat with stdin
2015-05-19 20:08:45 -04:00
Juan Batiz-Benet
dcd34c6bb1 Merge pull request #1251 from ipfs/travis-split-go-sharness
.travis: split go and sharness tests
2015-05-19 20:06:38 -04:00
Christian Couder
7bf18cafe0 .travis: split go and sharness tests
Following: https://github.com/ipfs/infrastructure/issues/20#issuecomment-102665147

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-19 19:33:04 -04:00
Juan Batiz-Benet
c153554866 Merge pull request #1252 from ipfs/fix-bitswap-ci
bitswap/test: fix timeout on travis
2015-05-19 19:32:36 -04:00
Juan Batiz-Benet
d7794c7d75 travis: disable kvm setup
Seems to be too unstable?
2015-05-19 19:08:04 -04:00
Juan Batiz-Benet
bc6911ef37 bitswap/test: fix timeout on travis 2015-05-19 16:53:13 -04:00
Christian Couder
863f386251 t0040: add tests for ipfs cat with stdin
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-19 21:28:17 +02:00
Juan Batiz-Benet
c561c0980b Merge pull request #1239 from rht/master
Add gofmt check
2015-05-19 04:03:23 -04:00
rht
1e38f71a38 Add gofmt check 2015-05-19 06:11:15 +07:00
rht
ac7edddb94 Run 'gofmt -s -w' on these files 2015-05-19 06:11:15 +07:00
Juan Batiz-Benet
eea6921fcd Merge pull request #1242 from ipfs/perf/add
remove unnecessary flush, and buffer output channel
2015-05-18 18:39:19 -04:00
Juan Batiz-Benet
9c4135fe08 Merge pull request #1240 from vijayee/master
removed braintree/manners
2015-05-18 18:33:16 -04:00
Jeromy
a67af7d9c1 remove unnecessary flush, and buffer output channel 2015-05-18 14:55:58 -07:00
Jeromy Johnson
ae92955728 Merge pull request #1238 from ipfs/improve-stdin-parsing
Improve stdin parsing
2015-05-18 13:06:32 -07:00
Vijayee Kulkaa
fcb8be5607 removed braintree/manners 2015-05-18 15:28:55 -04:00
Christian Couder
275ec7c2a0 parse_test: test stdin enabled and not variadic arg
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-18 00:24:13 +02:00
Christian Couder
53a80e255f parse: fix arg number check
This should fix issue #1196 (Can't launch a command line
process from Qt).

The check was bad because it took stdin into account,
but it really shouldn't.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-18 00:03:02 +02:00
Christian Couder
c93d583f02 parse_test: add tests with 2 args and stdin
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-17 23:48:56 +02:00
Christian Couder
942e96400b parse: fix parsing stdin args
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-17 23:43:24 +02:00
Christian Couder
5503c4cc89 parse_test: improve error messages
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-17 23:14:08 +02:00
Christian Couder
97ab64af30 parse: don't use stdin if there are arguments
This should fix issue #1141 (ipfs cat "multihash too short"
error when using stdin) and perhaps others.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-17 21:19:12 +02:00
Christian Couder
ff9cb9ecf4 parse_test: test multiline stdin
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-17 20:34:40 +02:00
Juan Batiz-Benet
88be96bc8c Merge pull request #1229 from timgws/tiny-doc-update
Fix documentation on swarm connect.
2015-05-14 21:52:20 -04:00
Juan Batiz-Benet
cb7c82845e Merge pull request #1220 from ipfs/travis-test-all-commits
Get travis to test all commits
2015-05-14 15:14:30 -04:00
Juan Batiz-Benet
66fad5f1d7 Merge pull request #1230 from ipfs/peerstream-update
go-peerstream update (accept concurrency)
2015-05-13 03:43:00 -04:00
Juan Batiz-Benet
d25147d042 go-peerstream update (accept concurrency)
8d52ed2801
2015-05-13 02:59:43 -04:00
Tim Groeneveld
26ba3e1f74 Issue #873. Thought I might do a small change first to get my feet wet. 2015-05-13 08:15:00 +10:00
Juan Batiz-Benet
ad9d84d534 Merge pull request #1215 from eris-ltd/cors
Add CORS middleware handler to the API.
2015-05-12 06:17:24 -04:00
Juan Batiz-Benet
414ab63696 Merge pull request #1227 from ipfs/parallelize-handshake
net/p2p + secio: parallelize crypto handshake
2015-05-12 06:16:14 -04:00
Juan Batiz-Benet
482a492ab0 travis-ci: make test_all_commits
After losing jenkins, it's been difficult to test all commits
manually. This commit adds a Makefile target that makes travis do it.
Unfortunately, this is way too slow. It takes longer than the
allotted 10min.

After asking the travis people what to do, someone suggested making
sure that each commit is pushed to github independently. This makes
travis run CI on every single commit in the PR, and gives us nice
status indicators on each one (so we know which ones did not pass).

This approach means that we need to push a branch to the repo for
each commit in the PR-- otherwise travis may cancel its run if it
detects that the branch is no longer there. We could automate this
with a bot that essentially does:

  for each PR:
    git fetch the PR branch
    push a branch per commit: <branch>-<commit>

  for each closed PR:
    delete all branches with pattern <branch>-<commit>
2015-05-12 05:57:53 -04:00
Juan Batiz-Benet
0c8a0975c0 Merge pull request #1221 from ipfs/unrestricted-api-access
Add option to allow unrestricted API access
2015-05-12 05:56:00 -04:00
Juan Batiz-Benet
b84fa2b493 net/p2p + secio: parallelize crypto handshake
We had a very nasty problem: handshakes were serial so incoming
dials would wait for each other to finish handshaking. this was
particularly problematic when handshakes hung-- nodes would not
recover quickly. This led to gateways not bootstrapping peers
fast enough.

The approach taken here is to do what crypto/tls does:
defer the handshake until Read/Write[1]. There are a number of
reasons why this is _the right thing to do_:
- it delays handshaking until it is known to be necessary (doing io)
- it "accepts" before the handshake, getting the handshake out of the
  critical path entirely.
- it defers to the user's parallelization of conn handling. users
  must implement this in some way already so use that, instead of
  picking constants surely to be wrong (how many handshakes to run
  in parallel?)

[0] http://golang.org/src/crypto/tls/conn.go#L886
2015-05-12 05:54:09 -04:00
Juan Batiz-Benet
08ea56ce72 Merge pull request #1191 from ipfs/refactor/httpGateway
Refactor/http gateway
2015-05-11 14:43:46 -04:00
Kristoffer Ström
30f674af0e Add option to allow unrestricted API access 2015-05-10 22:25:36 +02:00
David Braun
496e7a4b2c Vendor CORS library. 2015-05-10 10:58:37 -07:00
Henry
4537311f59 http gw: disable PUT and writable tests - again... :( 2015-05-10 15:30:12 +02:00
Juan Batiz-Benet
e67c2a7b14 version bump to 0.3.4
(I'll add the changelog later today)
2015-05-10 09:23:47 -04:00
Juan Batiz-Benet
73e3e90cd9 simple ipns-republish script stopgap 2015-05-10 09:23:12 -04:00