Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ipfs/kubo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c338958c30fb^
Choose a base ref
...
head repository: ipfs/kubo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 43059f0bf495
Choose a head ref
  • 4 commits
  • 3 files changed
  • 3 contributors

Commits on Feb 26, 2016

  1. finally add changelog for v0.3.11

    License: MIT
    Signed-off-by: Jeromy <jeromyj@gmail.com>
    whyrusleeping authored and Lars Gierth committed Feb 26, 2016
    Copy the full SHA
    c338958 View commit details
  2. Fixed spelling, capitalized

    License: MIT
    Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
    RichardLitt authored and Lars Gierth committed Feb 26, 2016
    Copy the full SHA
    4f21ea3 View commit details
  3. add note about webui update

    License: MIT
    Signed-off-by: Jeromy <jeromyj@gmail.com>
    whyrusleeping authored and Lars Gierth committed Feb 26, 2016
    Copy the full SHA
    cea84e6 View commit details
  4. Make dns resolve paths under _dnslink.

    Thus allowing to CNAME main site entry to gateway and stil specify
    dnslink.
    
    License: MIT
    Signed-off-by: Jakub Sztandera <kubuxu@gmail.com>
    Kubuxu authored and Lars Gierth committed Feb 26, 2016
    Copy the full SHA
    43059f0 View commit details
Showing with 124 additions and 10 deletions.
  1. +43 −0 CHANGELOG.md
  2. +53 −10 namesys/dns.go
  3. +28 −0 namesys/dns_test.go
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
# go-ipfs changelog

### 0.3.11 - 2016-01-12

This is the final ipfs version before the transition to v0.4.0.
It introduces a few stability improvements, bugfixes, and increased
test coverage.

* Features
* Add 'get' and 'patch' to the allowed gateway commands (@whyrusleeping)
* Updated webui version (@dignifiedquire)

* BugFixes
* Fix path parsing for add command (@djdv)
* namesys: Make paths with multiple segments work. Fixes #2059 (@Kubuxu)
* Fix up panic catching in http handler funcs (@whyrusleeping)
* Add correct access control headers to the default api config (@dignifiedquire)
* Fix closenotify by not sending empty file set (@whyrusleeping)

* Tool Changes
* Have install.sh use the full path to ipfs binary if detected (@jedahan)
* Install daemon system-wide if on El Capitan (@jedahan)
* makefile: add -ldflags to install and nofuse tasks (@lgierth)

* General Codebase
* Clean up http client code (@whyrusleeping)
* Move api version check to header (@rht)

* Documentation
* Improved release checklist (@jbenet)
* Added quotes around command in long description (@RichardLitt)
* Added a shutdown note to daemon description (@RichardLitt)

* Testing
* t0080: improve last tests (@chriscool)
* t0080: improve 'ipfs refs --unique' test (@chriscool)
* Fix t.Fatal usage in goroutines (@chriscool)
* Add docker testing support to sharness (@chriscool)
* sharness: add t0300-docker-image.sh (@chriscool)
* Included more namesys tests. (@Kubuxu)
* Add sharness test to verify requests look good (@whyrusleeping)
* Re-enable ipns sharness test now that iptb is fixed (@whyrusleeping)
* Force use of ipv4 in test (@whyrusleeping)
* Travis-CI: use go 1.5.2 (@jbenet)

### 0.3.10 - 2015-12-07

This patch update introduces the 'ipfs update' command which will be used for
63 changes: 53 additions & 10 deletions namesys/dns.go
Original file line number Diff line number Diff line change
@@ -41,33 +41,76 @@ func (r *DNSResolver) ResolveN(ctx context.Context, name string, depth int) (pat
return resolve(ctx, r, name, depth, "/ipns/")
}

type lookupRes struct {
path path.Path
error error
}

// resolveOnce implements resolver.
// TXT records for a given domain name should contain a b58
// encoded multihash.
func (r *DNSResolver) resolveOnce(ctx context.Context, name string) (path.Path, error) {
segments := strings.SplitN(name, "/", 2)
domain := segments[0]

if !isd.IsDomain(segments[0]) {
if !isd.IsDomain(domain) {
return "", errors.New("not a valid domain name")
}
log.Infof("DNSResolver resolving %s", domain)

rootChan := make(chan lookupRes, 1)
go workDomain(r, domain, rootChan)

subChan := make(chan lookupRes, 1)
go workDomain(r, "_dnslink."+domain, subChan)

var subRes lookupRes
select {
case subRes = <-subChan:
case <-ctx.Done():
return "", ctx.Err()
}

var p path.Path
if subRes.error == nil {
p = subRes.path
} else {
var rootRes lookupRes
select {
case rootRes = <-rootChan:
case <-ctx.Done():
return "", ctx.Err()
}
if rootRes.error == nil {
p = rootRes.path
} else {
return "", ErrResolveFailed
}
}
if len(segments) > 1 {
return path.FromSegments("", strings.TrimRight(p.String(), "/"), segments[1])
} else {
return p, nil
}
}

func workDomain(r *DNSResolver, name string, res chan lookupRes) {
txt, err := r.lookupTXT(name)

log.Infof("DNSResolver resolving %s", segments[0])
txt, err := r.lookupTXT(segments[0])
if err != nil {
return "", err
// Error is != nil
res <- lookupRes{"", err}
return
}

for _, t := range txt {
p, err := parseEntry(t)
if err == nil {
if len(segments) > 1 {
return path.FromSegments("", strings.TrimRight(p.String(), "/"), segments[1])
}
return p, nil
res <- lookupRes{p, nil}
return
}
}

return "", ErrResolveFailed
res <- lookupRes{"", ErrResolveFailed}
}

func parseEntry(txt string) (path.Path, error) {
28 changes: 28 additions & 0 deletions namesys/dns_test.go
Original file line number Diff line number Diff line change
@@ -65,6 +65,9 @@ func newMockDNS() *mockDNS {
"ipfs.example.com": []string{
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
},
"_dnslink.dipfs.example.com": []string{
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
},
"dns1.example.com": []string{
"dnslink=/ipns/ipfs.example.com",
},
@@ -85,6 +88,12 @@ func newMockDNS() *mockDNS {
"loop2.example.com": []string{
"dnslink=/ipns/loop1.example.com",
},
"_dnslink.dloop1.example.com": []string{
"dnslink=/ipns/loop2.example.com",
},
"_dnslink.dloop2.example.com": []string{
"dnslink=/ipns/loop1.example.com",
},
"bad.example.com": []string{
"dnslink=",
},
@@ -100,6 +109,18 @@ func newMockDNS() *mockDNS {
"withtrailingrec.example.com": []string{
"dnslink=/ipns/withtrailing.example.com/segment/",
},
"double.example.com": []string{
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
},
"_dnslink.double.example.com": []string{
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
},
"double.conflict.com": []string{
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
},
"_dnslink.conflict.example.com": []string{
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjE",
},
},
}
}
@@ -109,6 +130,7 @@ func TestDNSResolution(t *testing.T) {
r := &DNSResolver{lookupTXT: mock.lookupTXT}
testResolution(t, r, "multihash.example.com", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", nil)
testResolution(t, r, "ipfs.example.com", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", nil)
testResolution(t, r, "dipfs.example.com", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", nil)
testResolution(t, r, "dns1.example.com", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", nil)
testResolution(t, r, "dns1.example.com", 1, "/ipns/ipfs.example.com", ErrResolveRecursion)
testResolution(t, r, "dns2.example.com", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", nil)
@@ -122,11 +144,17 @@ func TestDNSResolution(t *testing.T) {
testResolution(t, r, "loop1.example.com", 2, "/ipns/loop1.example.com", ErrResolveRecursion)
testResolution(t, r, "loop1.example.com", 3, "/ipns/loop2.example.com", ErrResolveRecursion)
testResolution(t, r, "loop1.example.com", DefaultDepthLimit, "/ipns/loop1.example.com", ErrResolveRecursion)
testResolution(t, r, "dloop1.example.com", 1, "/ipns/loop2.example.com", ErrResolveRecursion)
testResolution(t, r, "dloop1.example.com", 2, "/ipns/loop1.example.com", ErrResolveRecursion)
testResolution(t, r, "dloop1.example.com", 3, "/ipns/loop2.example.com", ErrResolveRecursion)
testResolution(t, r, "dloop1.example.com", DefaultDepthLimit, "/ipns/loop1.example.com", ErrResolveRecursion)
testResolution(t, r, "bad.example.com", DefaultDepthLimit, "", ErrResolveFailed)
testResolution(t, r, "withsegment.example.com", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/sub/segment", nil)
testResolution(t, r, "withrecsegment.example.com", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/sub/segment/subsub", nil)
testResolution(t, r, "withsegment.example.com/test1", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/sub/segment/test1", nil)
testResolution(t, r, "withrecsegment.example.com/test2", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/sub/segment/subsub/test2", nil)
testResolution(t, r, "withrecsegment.example.com/test3/", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/sub/segment/subsub/test3/", nil)
testResolution(t, r, "withtrailingrec.example.com", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/sub/segment/", nil)
testResolution(t, r, "double.example.com", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", nil)
testResolution(t, r, "conflict.example.com", DefaultDepthLimit, "/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjE", nil)
}