@cryptotaxi247 / kubo / commits / 4695fd9fe

refactor: namesys cleanup, gateway /ipns/ ttl (#10115)

Henrique Dias committed Oct 18, 2023 at 10:23 UTC 4695fd9fed4c46a13076c569e5abc0dcc9a0acd8
20 files changed +167 -75
client/rpc/name.go
+7 -7
@@ -8,8 +8,8 @@ import (
8
9 iface "github.com/ipfs/boxo/coreiface"
10 caopts "github.com/ipfs/boxo/coreiface/options"
11 - nsopts "github.com/ipfs/boxo/coreiface/options/namesys"
11 "github.com/ipfs/boxo/ipns"
12 + "github.com/ipfs/boxo/namesys"
13 "github.com/ipfs/boxo/path"
14 )
15
@@ -49,9 +49,9 @@ func (api *NameAPI) Search(ctx context.Context, name string, opts ...caopts.Name
49 return nil, err
50 }
51
52 - ropts := nsopts.ProcessOpts(options.ResolveOpts)
53 - if ropts.Depth != nsopts.DefaultDepthLimit && ropts.Depth != 1 {
54 - return nil, fmt.Errorf("Name.Resolve: depth other than 1 or %d not supported", nsopts.DefaultDepthLimit)
52 + ropts := namesys.ProcessResolveOptions(options.ResolveOpts)
53 + if ropts.Depth != namesys.DefaultDepthLimit && ropts.Depth != 1 {
54 + return nil, fmt.Errorf("Name.Resolve: depth other than 1 or %d not supported", namesys.DefaultDepthLimit)
55 }
56
57 req := api.core().Request("name/resolve", name).
@@ -110,9 +110,9 @@ func (api *NameAPI) Resolve(ctx context.Context, name string, opts ...caopts.Nam
110 return nil, err
111 }
112
113 - ropts := nsopts.ProcessOpts(options.ResolveOpts)
114 - if ropts.Depth != nsopts.DefaultDepthLimit && ropts.Depth != 1 {
115 - return nil, fmt.Errorf("Name.Resolve: depth other than 1 or %d not supported", nsopts.DefaultDepthLimit)
113 + ropts := namesys.ProcessResolveOptions(options.ResolveOpts)
114 + if ropts.Depth != namesys.DefaultDepthLimit && ropts.Depth != 1 {
115 + return nil, fmt.Errorf("Name.Resolve: depth other than 1 or %d not supported", namesys.DefaultDepthLimit)
116 }
117
118 req := api.core().Request("name/resolve", name).
core/commands/dht_test.go
+1 -1
@@ -11,7 +11,7 @@ import (
11
12 func TestKeyTranslation(t *testing.T) {
13 pid := test.RandPeerIDFatal(t)
14 - pkname := namesys.PkKeyForID(pid)
14 + pkname := namesys.PkRoutingKey(pid)
15 ipnsname := ipns.NameFromPeer(pid).RoutingKey()
16
17 pkk, err := escapeDhtKey("/pk/" + pid.String())
core/commands/dns.go
+10 -5
@@ -4,8 +4,8 @@ import (
4 "fmt"
5 "io"
6
7 - nsopts "github.com/ipfs/boxo/coreiface/options/namesys"
7 namesys "github.com/ipfs/boxo/namesys"
8 + "github.com/ipfs/boxo/path"
9 cmdenv "github.com/ipfs/kubo/core/commands/cmdenv"
10 ncmd "github.com/ipfs/kubo/core/commands/name"
11
@@ -47,16 +47,21 @@ It will work across multiple DNSLinks and IPNS keys.
47 name := req.Arguments[0]
48 resolver := namesys.NewDNSResolver(node.DNSResolver.LookupTXT)
49
50 - var routing []nsopts.ResolveOpt
50 + var routing []namesys.ResolveOption
51 if !recursive {
52 - routing = append(routing, nsopts.Depth(1))
52 + routing = append(routing, namesys.ResolveWithDepth(1))
53 }
54
55 - output, err := resolver.Resolve(req.Context, name, routing...)
55 + p, err := path.NewPath(name)
56 + if err != nil {
57 + return err
58 + }
59 +
60 + val, err := resolver.Resolve(req.Context, p, routing...)
61 if err != nil && (recursive || err != namesys.ErrResolveRecursion) {
62 return err
63 }
59 - return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: output.String()})
64 + return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: val.Path.String()})
65 },
66 Encoders: cmds.EncoderMap{
67 cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *ncmd.ResolvedPath) error {
core/commands/name/ipns.go
+7 -9
@@ -7,14 +7,12 @@ import (
7 "strings"
8 "time"
9
10 - namesys "github.com/ipfs/boxo/namesys"
11 - cmdenv "github.com/ipfs/kubo/core/commands/cmdenv"
12 -
10 options "github.com/ipfs/boxo/coreiface/options"
14 - nsopts "github.com/ipfs/boxo/coreiface/options/namesys"
11 + "github.com/ipfs/boxo/namesys"
12 "github.com/ipfs/boxo/path"
13 cmds "github.com/ipfs/go-ipfs-cmds"
14 logging "github.com/ipfs/go-log"
15 + cmdenv "github.com/ipfs/kubo/core/commands/cmdenv"
16 )
17
18 var log = logging.Logger("core/commands/ipns")
@@ -75,8 +73,8 @@ Resolve the value of a dnslink:
73 Options: []cmds.Option{
74 cmds.BoolOption(recursiveOptionName, "r", "Resolve until the result is not an IPNS name.").WithDefault(true),
75 cmds.BoolOption(nocacheOptionName, "n", "Do not use cached entries."),
78 - cmds.UintOption(dhtRecordCountOptionName, "dhtrc", "Number of records to request for DHT resolution."),
79 - cmds.StringOption(dhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution eg \"30s\". Pass 0 for no timeout."),
76 + cmds.UintOption(dhtRecordCountOptionName, "dhtrc", "Number of records to request for DHT resolution.").WithDefault(uint(namesys.DefaultResolverDhtRecordCount)),
77 + cmds.StringOption(dhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution eg \"30s\". Pass 0 for no timeout.").WithDefault(namesys.DefaultResolverDhtTimeout.String()),
78 cmds.BoolOption(streamOptionName, "s", "Stream entries as they are found."),
79 },
80 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
@@ -108,10 +106,10 @@ Resolve the value of a dnslink:
106 }
107
108 if !recursive {
111 - opts = append(opts, options.Name.ResolveOption(nsopts.Depth(1)))
109 + opts = append(opts, options.Name.ResolveOption(namesys.ResolveWithDepth(1)))
110 }
111 if rcok {
114 - opts = append(opts, options.Name.ResolveOption(nsopts.DhtRecordCount(rc)))
112 + opts = append(opts, options.Name.ResolveOption(namesys.ResolveWithDhtRecordCount(rc)))
113 }
114 if dhttok {
115 d, err := time.ParseDuration(dhtt)
@@ -121,7 +119,7 @@ Resolve the value of a dnslink:
119 if d < 0 {
120 return errors.New("DHT timeout value must be >= 0")
121 }
124 - opts = append(opts, options.Name.ResolveOption(nsopts.DhtTimeout(d)))
122 + opts = append(opts, options.Name.ResolveOption(namesys.ResolveWithDhtTimeout(d)))
123 }
124
125 if !strings.HasPrefix(name, "/ipns/") {
core/commands/name/publish.go
+7 -9
@@ -11,6 +11,7 @@ import (
11
12 iface "github.com/ipfs/boxo/coreiface"
13 options "github.com/ipfs/boxo/coreiface/options"
14 + ipns "github.com/ipfs/boxo/ipns"
15 cmds "github.com/ipfs/go-ipfs-cmds"
16 ke "github.com/ipfs/kubo/core/commands/keyencode"
17 )
@@ -59,7 +60,7 @@ Publish an <ipfs-path> with another name, added by an 'ipfs key' command:
60 > ipfs name publish --key=mykey /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
61 Published to QmSrPmbaUKA3ZodhzPWZnpFgcPMFWF4QsxXbkWfEptTBJd: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
62
62 -Alternatively, publish an <ipfs-path> using a valid PeerID (as listed by
63 +Alternatively, publish an <ipfs-path> using a valid PeerID (as listed by
64 'ipfs key list -l'):
65
66 > ipfs name publish --key=QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
@@ -72,16 +73,13 @@ Alternatively, publish an <ipfs-path> using a valid PeerID (as listed by
73 cmds.StringArg(ipfsPathOptionName, true, false, "ipfs path of the object to be published.").EnableStdin(),
74 },
75 Options: []cmds.Option{
75 - cmds.BoolOption(resolveOptionName, "Check if the given path can be resolved before publishing.").WithDefault(true),
76 - cmds.StringOption(lifeTimeOptionName, "t",
77 - `Time duration that the record will be valid for. <<default>>
78 - This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are
79 - "ns", "us" (or "µs"), "ms", "s", "m", "h".`).WithDefault("24h"),
80 - cmds.BoolOption(allowOfflineOptionName, "When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing."),
81 - cmds.StringOption(ttlOptionName, "Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental)"),
76 cmds.StringOption(keyOptionName, "k", "Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'.").WithDefault("self"),
83 - cmds.BoolOption(quieterOptionName, "Q", "Write only final hash."),
77 + cmds.BoolOption(resolveOptionName, "Check if the given path can be resolved before publishing.").WithDefault(true),
78 + cmds.StringOption(lifeTimeOptionName, "t", `Time duration the signed record will be valid for. Accepts durations such as "300s", "1.5h" or "7d2h45m"`).WithDefault(ipns.DefaultRecordLifetime.String()),
79 + cmds.StringOption(ttlOptionName, "Time duration hint, akin to --lifetime, indicating how long to cache this record before checking for updates.").WithDefault(ipns.DefaultRecordTTL.String()),
80 + cmds.BoolOption(quieterOptionName, "Q", "Write only final IPNS Name encoded as CIDv1 (for use in /ipns content paths)."),
81 cmds.BoolOption(v1compatOptionName, "Produce a backward-compatible IPNS Record by including fields for both V1 and V2 signatures.").WithDefault(true),
82 + cmds.BoolOption(allowOfflineOptionName, "When --offline, save the IPNS record to the the local datastore without broadcasting to the network (instead of failing)."),
83 ke.OptionIPNSBase,
84 },
85 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
core/commands/resolve.go
+4 -5
@@ -8,14 +8,13 @@ import (
8 "time"
9
10 ns "github.com/ipfs/boxo/namesys"
11 - "github.com/ipfs/boxo/path"
11 cidenc "github.com/ipfs/go-cidutil/cidenc"
12 cmdenv "github.com/ipfs/kubo/core/commands/cmdenv"
13 "github.com/ipfs/kubo/core/commands/cmdutils"
14 ncmd "github.com/ipfs/kubo/core/commands/name"
15
16 options "github.com/ipfs/boxo/coreiface/options"
18 - nsopts "github.com/ipfs/boxo/coreiface/options/namesys"
17 + "github.com/ipfs/boxo/path"
18 cmds "github.com/ipfs/go-ipfs-cmds"
19 )
20
@@ -87,11 +86,11 @@ Resolve the value of an IPFS DAG path:
86 rc, rcok := req.Options[resolveDhtRecordCountOptionName].(uint)
87 dhtt, dhttok := req.Options[resolveDhtTimeoutOptionName].(string)
88 ropts := []options.NameResolveOption{
90 - options.Name.ResolveOption(nsopts.Depth(1)),
89 + options.Name.ResolveOption(ns.ResolveWithDepth(1)),
90 }
91
92 if rcok {
94 - ropts = append(ropts, options.Name.ResolveOption(nsopts.DhtRecordCount(rc)))
93 + ropts = append(ropts, options.Name.ResolveOption(ns.ResolveWithDhtRecordCount(rc)))
94 }
95 if dhttok {
96 d, err := time.ParseDuration(dhtt)
@@ -101,7 +100,7 @@ Resolve the value of an IPFS DAG path:
100 if d < 0 {
101 return errors.New("DHT timeout value must be >= 0")
102 }
104 - ropts = append(ropts, options.Name.ResolveOption(nsopts.DhtTimeout(d)))
103 + ropts = append(ropts, options.Name.ResolveOption(ns.ResolveWithDhtTimeout(d)))
104 }
105 p, err := api.Name().Resolve(req.Context, name, ropts...)
106 // ErrResolveRecursion is fine
core/coreapi/name.go
+10 -6
@@ -15,7 +15,6 @@ import (
15
16 coreiface "github.com/ipfs/boxo/coreiface"
17 caopts "github.com/ipfs/boxo/coreiface/options"
18 - nsopts "github.com/ipfs/boxo/coreiface/options/namesys"
18 "github.com/ipfs/boxo/path"
19 ci "github.com/libp2p/go-libp2p/core/crypto"
20 peer "github.com/libp2p/go-libp2p/core/peer"
@@ -57,13 +56,13 @@ func (api *NameAPI) Publish(ctx context.Context, p path.Path, opts ...caopts.Nam
56
57 eol := time.Now().Add(options.ValidTime)
58
60 - publishOptions := []nsopts.PublishOption{
61 - nsopts.PublishWithEOL(eol),
62 - nsopts.PublishCompatibleWithV1(options.CompatibleWithV1),
59 + publishOptions := []namesys.PublishOption{
60 + namesys.PublishWithEOL(eol),
61 + namesys.PublishWithIPNSOption(ipns.WithV1Compatibility(options.CompatibleWithV1)),
62 }
63
64 if options.TTL != nil {
66 - publishOptions = append(publishOptions, nsopts.PublishWithTTL(*options.TTL))
65 + publishOptions = append(publishOptions, namesys.PublishWithTTL(*options.TTL))
66 }
67
68 err = api.namesys.Publish(ctx, k, p, publishOptions...)
@@ -109,10 +108,15 @@ func (api *NameAPI) Search(ctx context.Context, name string, opts ...caopts.Name
108 name = "/ipns/" + name
109 }
110
111 + p, err := path.NewPath(name)
112 + if err != nil {
113 + return nil, err
114 + }
115 +
116 out := make(chan coreiface.IpnsResult)
117 go func() {
118 defer close(out)
115 - for res := range resolver.ResolveAsync(ctx, name, options.ResolveOpts...) {
119 + for res := range resolver.ResolveAsync(ctx, p, options.ResolveOpts...) {
120 select {
121 case out <- coreiface.IpnsResult{Path: res.Path, Err: res.Err}:
122 case <-ctx.Done():
core/coreapi/path.go
+5 -3
@@ -2,9 +2,10 @@ package coreapi
2
3 import (
4 "context"
5 + "errors"
6 "fmt"
7
7 - "github.com/ipfs/boxo/namesys/resolve"
8 + "github.com/ipfs/boxo/namesys"
9 "github.com/ipfs/kubo/tracing"
10
11 "go.opentelemetry.io/otel/attribute"
@@ -40,12 +41,13 @@ func (api *CoreAPI) ResolvePath(ctx context.Context, p path.Path) (path.Immutabl
41 ctx, span := tracing.Span(ctx, "CoreAPI", "ResolvePath", trace.WithAttributes(attribute.String("path", p.String())))
42 defer span.End()
43
43 - p, err := resolve.ResolveIPNS(ctx, api.namesys, p)
44 - if err == resolve.ErrNoNamesys {
44 + res, err := namesys.Resolve(ctx, api.namesys, p)
45 + if errors.Is(err, namesys.ErrNoNamesys) {
46 return path.ImmutablePath{}, nil, coreiface.ErrOffline
47 } else if err != nil {
48 return path.ImmutablePath{}, nil, err
49 }
50 + p = res.Path
51
52 var resolver ipfspathresolver.Resolver
53 switch p.Namespace() {
core/corehttp/gateway.go
+4 -3
@@ -7,6 +7,7 @@ import (
7 "io"
8 "net"
9 "net/http"
10 + "time"
11
12 "github.com/ipfs/boxo/blockservice"
13 iface "github.com/ipfs/boxo/coreiface"
@@ -195,10 +196,10 @@ func (o *offlineGatewayErrWrapper) GetIPNSRecord(ctx context.Context, c cid.Cid)
196 return rec, err
197 }
198
198 -func (o *offlineGatewayErrWrapper) ResolveMutable(ctx context.Context, path path.Path) (path.ImmutablePath, error) {
199 - imPath, err := o.gwimpl.ResolveMutable(ctx, path)
199 +func (o *offlineGatewayErrWrapper) ResolveMutable(ctx context.Context, path path.Path) (path.ImmutablePath, time.Duration, time.Time, error) {
200 + imPath, ttl, lastMod, err := o.gwimpl.ResolveMutable(ctx, path)
201 err = offlineErrWrap(err)
201 - return imPath, err
202 + return imPath, ttl, lastMod, err
203 }
204
205 func (o *offlineGatewayErrWrapper) GetDNSLinkRecord(ctx context.Context, s string) (path.Path, error) {
core/corehttp/gateway_test.go
+19 -14
@@ -17,7 +17,6 @@ import (
17 "github.com/stretchr/testify/assert"
18
19 iface "github.com/ipfs/boxo/coreiface"
20 - nsopts "github.com/ipfs/boxo/coreiface/options/namesys"
20 "github.com/ipfs/boxo/path"
21 "github.com/ipfs/go-datastore"
22 syncds "github.com/ipfs/go-datastore/sync"
@@ -27,41 +26,47 @@ import (
26
27 type mockNamesys map[string]path.Path
28
30 -func (m mockNamesys) Resolve(ctx context.Context, name string, opts ...nsopts.ResolveOpt) (value path.Path, err error) {
31 - cfg := nsopts.DefaultResolveOpts()
29 +func (m mockNamesys) Resolve(ctx context.Context, p path.Path, opts ...namesys.ResolveOption) (namesys.Result, error) {
30 + cfg := namesys.DefaultResolveOptions()
31 for _, o := range opts {
32 o(&cfg)
33 }
34 depth := cfg.Depth
36 - if depth == nsopts.UnlimitedDepth {
35 + if depth == namesys.UnlimitedDepth {
36 // max uint
37 depth = ^uint(0)
38 }
39 + var (
40 + value path.Path
41 + )
42 + name := path.SegmentsToString(p.Segments()[:2]...)
43 for strings.HasPrefix(name, "/ipns/") {
44 if depth == 0 {
42 - return value, namesys.ErrResolveRecursion
45 + return namesys.Result{Path: value}, namesys.ErrResolveRecursion
46 }
47 depth--
48
46 - var ok bool
47 - value, ok = m[name]
49 + v, ok := m[name]
50 if !ok {
49 - return nil, namesys.ErrResolveFailed
51 + return namesys.Result{}, namesys.ErrResolveFailed
52 }
53 + value = v
54 name = value.String()
55 }
53 - return value, nil
56 +
57 + value, err := path.Join(value, p.Segments()[2:]...)
58 + return namesys.Result{Path: value}, err
59 }
60
56 -func (m mockNamesys) ResolveAsync(ctx context.Context, name string, opts ...nsopts.ResolveOpt) <-chan namesys.Result {
57 - out := make(chan namesys.Result, 1)
58 - v, err := m.Resolve(ctx, name, opts...)
59 - out <- namesys.Result{Path: v, Err: err}
61 +func (m mockNamesys) ResolveAsync(ctx context.Context, p path.Path, opts ...namesys.ResolveOption) <-chan namesys.AsyncResult {
62 + out := make(chan namesys.AsyncResult, 1)
63 + res, err := m.Resolve(ctx, p, opts...)
64 + out <- namesys.AsyncResult{Path: res.Path, TTL: res.TTL, LastMod: res.LastMod, Err: err}
65 close(out)
66 return out
67 }
68
64 -func (m mockNamesys) Publish(ctx context.Context, name ci.PrivKey, value path.Path, opts ...nsopts.PublishOption) error {
69 +func (m mockNamesys) Publish(ctx context.Context, name ci.PrivKey, value path.Path, opts ...namesys.PublishOption) error {
70 return errors.New("not implemented for mockNamesys")
71 }
72
docs/changelogs/v0.24.md
+37
@@ -7,6 +7,8 @@
7 - [Overview](#overview)
8 - [🔦 Highlights](#-highlights)
9 - [Gateway: the root of the CARs are no longer meaningful](#gateway-the-root-of-the-cars-are-no-longer-meaningful)
10 + - [IPNS: improved publishing defaults](#ipns-improved-publishing-defaults)
11 + - [IPNS: record TTL is used for caching](#ipns-record-ttl-is-used-for-caching)
12 - [📝 Changelog](#-changelog)
13 - [👨‍👩‍👧‍👦 Contributors](#-contributors)
14
@@ -22,6 +24,41 @@ path. However, in situations where the path cannot be resolved, such as when
24 the path does not exist, a CAR will be sent with a root of `bafkqaaa` (empty CID).
25 This CAR will contain all blocks necessary to validate that the path does not exist.
26
27 +#### IPNS: improved publishing defaults
28 +
29 +This release changes the default values used when publishing IPNS record
30 +via `ipfs name publish` command:
31 +
32 +- Default `--lifetime` increased from `24h` to `48h` to take full advantage of
33 + the increased expiration window of Amino DHT
34 + ([go-libp2p-kad-dht#793](https://github.com/libp2p/go-libp2p-kad-dht/pull/793))
35 +- Default `--ttl` increased from `1m` to `1h` to improve website caching and follow
36 + saner defaults present in similar systems like DNS
37 + ([specs#371](https://github.com/ipfs/specs/pull/371))
38 +
39 +This change only impacts the implicit defaults, when mentioned parameters are omitted
40 +during publishing. Users are free to override the default if different value
41 +makes more sense for their use case.
42 +
43 +#### IPNS: record TTL is used for caching
44 +
45 +In this release, we've made significant improvements to IPNS caching.
46 +
47 +Previously, the TTL value in IPNS records was not utilized, and the
48 +`boxo/namesys` library maintained a static one-minute resolution cache.
49 +
50 +With this update, IPNS publishers gain more control over how long a valid IPNS
51 +record remains cached before checking an upstream routing system, such as Amino
52 +DHT, for updates. The TTL value in the IPNS record now serves as a hint for:
53 +
54 +- `boxo/namesys`: the internal cache, determining how long the IPNS resolution
55 + result is cached before asking upsteam routing systems for updates.
56 +- `boxo/gateway`: the `Cache-Control` HTTP header in responses to requests made
57 + for `/ipns/name` content paths.
58 +
59 +These changes make it easier for rarely updated IPNS-hosted websites to be
60 +cached more efficiently and load faster in browser contexts.
61 +
62 ### 📝 Changelog
63
64 ### 👨‍👩‍👧‍👦 Contributors
docs/examples/kubo-as-a-library/go.mod
+1 -1
@@ -7,7 +7,7 @@ go 1.20
7 replace github.com/ipfs/kubo => ./../../..
8
9 require (
10 - github.com/ipfs/boxo v0.13.2-0.20231017164040-0a566c9ee75f
10 + github.com/ipfs/boxo v0.13.2-0.20231018081237-a50f784985dd
11 github.com/ipfs/kubo v0.0.0-00010101000000-000000000000
12 github.com/libp2p/go-libp2p v0.31.0
13 github.com/multiformats/go-multiaddr v0.11.0
docs/examples/kubo-as-a-library/go.sum
+2 -2
@@ -300,8 +300,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
300 github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
301 github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
302 github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
303 -github.com/ipfs/boxo v0.13.2-0.20231017164040-0a566c9ee75f h1:iSo5r2GcXv5lX+UwVmarbSB9OjtvfnqQ4nwiiWWib8I=
304 -github.com/ipfs/boxo v0.13.2-0.20231017164040-0a566c9ee75f/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
303 +github.com/ipfs/boxo v0.13.2-0.20231018081237-a50f784985dd h1:CWz2mhz+cmkLRlKgQYlKXkDtx4oWYkCorSSF4ZWkH3o=
304 +github.com/ipfs/boxo v0.13.2-0.20231018081237-a50f784985dd/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
305 github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
306 github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
307 github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=
fuse/ipns/common.go
+2 -2
@@ -4,7 +4,7 @@ import (
4 "context"
5
6 ft "github.com/ipfs/boxo/ipld/unixfs"
7 - nsys "github.com/ipfs/boxo/namesys"
7 + "github.com/ipfs/boxo/namesys"
8 "github.com/ipfs/boxo/path"
9 "github.com/ipfs/kubo/core"
10 ci "github.com/libp2p/go-libp2p/core/crypto"
@@ -28,7 +28,7 @@ func InitializeKeyspace(n *core.IpfsNode, key ci.PrivKey) error {
28 return err
29 }
30
31 - pub := nsys.NewIpnsPublisher(n.Routing, n.Repo.Datastore())
31 + pub := namesys.NewIPNSPublisher(n.Routing, n.Repo.Datastore())
32
33 return pub.Publish(ctx, key, path.FromCid(emptyDir.Cid()))
34 }
go.mod
+1 -1
@@ -15,7 +15,7 @@ require (
15 github.com/fsnotify/fsnotify v1.6.0
16 github.com/google/uuid v1.3.1
17 github.com/hashicorp/go-multierror v1.1.1
18 - github.com/ipfs/boxo v0.13.2-0.20231017164040-0a566c9ee75f
18 + github.com/ipfs/boxo v0.13.2-0.20231018081237-a50f784985dd
19 github.com/ipfs/go-block-format v0.2.0
20 github.com/ipfs/go-cid v0.4.1
21 github.com/ipfs/go-cidutil v0.1.0
go.sum
+2 -2
@@ -335,8 +335,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
335 github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
336 github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
337 github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
338 -github.com/ipfs/boxo v0.13.2-0.20231017164040-0a566c9ee75f h1:iSo5r2GcXv5lX+UwVmarbSB9OjtvfnqQ4nwiiWWib8I=
339 -github.com/ipfs/boxo v0.13.2-0.20231017164040-0a566c9ee75f/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
338 +github.com/ipfs/boxo v0.13.2-0.20231018081237-a50f784985dd h1:CWz2mhz+cmkLRlKgQYlKXkDtx4oWYkCorSSF4ZWkH3o=
339 +github.com/ipfs/boxo v0.13.2-0.20231018081237-a50f784985dd/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
340 github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
341 github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
342 github.com/ipfs/go-bitswap v0.11.0 h1:j1WVvhDX1yhG32NTC9xfxnqycqYIlhzEzLXG/cU1HyQ=
test/cli/gateway_test.go
+14 -1
@@ -8,6 +8,8 @@ import (
8 "os"
9 "path/filepath"
10 "regexp"
11 + "strconv"
12 + "strings"
13 "testing"
14
15 "github.com/ipfs/kubo/config"
@@ -169,7 +171,7 @@ func TestGateway(t *testing.T) {
171
172 t.Run("IPNS", func(t *testing.T) {
173 t.Parallel()
172 - node.IPFS("name", "publish", "--allow-offline", cid)
174 + node.IPFS("name", "publish", "--allow-offline", "--ttl", "42h", cid)
175
176 t.Run("GET invalid IPNS root returns 500 (Internal Server Error)", func(t *testing.T) {
177 t.Parallel()
@@ -184,6 +186,17 @@ func TestGateway(t *testing.T) {
186 assert.Equal(t, "Hello Worlds!", resp.Body)
187 })
188
189 + t.Run("GET IPNS path has correct Cache-Control", func(t *testing.T) {
190 + t.Parallel()
191 + resp := client.Get("/ipns/{{.PeerID}}")
192 + assert.Equal(t, 200, resp.StatusCode)
193 + cacheControl := resp.Headers.Get("Cache-Control")
194 + assert.True(t, strings.HasPrefix(cacheControl, "public, max-age="))
195 + maxAge, err := strconv.Atoi(strings.TrimPrefix(cacheControl, "public, max-age="))
196 + assert.NoError(t, err)
197 + assert.True(t, maxAge-151200 < 60) // MaxAge within 42h and 42h-1m
198 + })
199 +
200 t.Run("GET /ipfs/ipns/{peerid} returns redirect to the valid path", func(t *testing.T) {
201 t.Parallel()
202 resp := client.Get("/ipfs/ipns/{{.PeerID}}?query=to-remember")
test/dependencies/go.mod
+9 -1
@@ -7,7 +7,7 @@ replace github.com/ipfs/kubo => ../../
7 require (
8 github.com/Kubuxu/gocovmerge v0.0.0-20161216165753-7ecaa51963cd
9 github.com/golangci/golangci-lint v1.54.1
10 - github.com/ipfs/boxo v0.13.2-0.20231017164040-0a566c9ee75f
10 + github.com/ipfs/boxo v0.13.2-0.20231018081237-a50f784985dd
11 github.com/ipfs/go-cid v0.4.1
12 github.com/ipfs/go-cidutil v0.1.0
13 github.com/ipfs/go-datastore v0.6.0
@@ -165,6 +165,10 @@ require (
165 github.com/libp2p/go-cidranger v1.1.0 // indirect
166 github.com/libp2p/go-flow-metrics v0.1.0 // indirect
167 github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect
168 + github.com/libp2p/go-libp2p-kad-dht v0.24.4 // indirect
169 + github.com/libp2p/go-libp2p-kbucket v0.6.3 // indirect
170 + github.com/libp2p/go-libp2p-record v0.2.0 // indirect
171 + github.com/libp2p/go-libp2p-routing-helpers v0.7.3 // indirect
172 github.com/libp2p/go-msgio v0.3.0 // indirect
173 github.com/libp2p/go-nat v0.2.0 // indirect
174 github.com/libp2p/go-netroute v0.2.1 // indirect
@@ -264,11 +268,14 @@ require (
268 github.com/ultraware/whitespace v0.0.5 // indirect
269 github.com/urfave/cli v1.22.10 // indirect
270 github.com/uudashr/gocognit v1.0.7 // indirect
271 + github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc // indirect
272 + github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
273 github.com/xen0n/gosmopolitan v1.2.1 // indirect
274 github.com/yagipy/maintidx v1.0.0 // indirect
275 github.com/yeya24/promlinter v0.2.0 // indirect
276 github.com/ykadowak/zerologlint v0.1.3 // indirect
277 gitlab.com/bosi/decorder v0.4.0 // indirect
278 + go.opencensus.io v0.24.0 // indirect
279 go.opentelemetry.io/otel v1.19.0 // indirect
280 go.opentelemetry.io/otel/metric v1.19.0 // indirect
281 go.opentelemetry.io/otel/trace v1.19.0 // indirect
@@ -288,6 +295,7 @@ require (
295 golang.org/x/term v0.13.0 // indirect
296 golang.org/x/text v0.13.0 // indirect
297 golang.org/x/tools v0.13.0 // indirect
298 + gonum.org/v1/gonum v0.13.0 // indirect
299 google.golang.org/protobuf v1.31.0 // indirect
300 gopkg.in/ini.v1 v1.67.0 // indirect
301 gopkg.in/yaml.v2 v2.4.0 // indirect
test/dependencies/go.sum
+21 -2
@@ -252,6 +252,7 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU
252 github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
253 github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
254 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
255 +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
256 github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
257 github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
258 github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
@@ -310,6 +311,7 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
311 github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
312 github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
313 github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
314 +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
315 github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
316 github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
317 github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
@@ -396,8 +398,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
398 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
399 github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
400 github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
399 -github.com/ipfs/boxo v0.13.2-0.20231017164040-0a566c9ee75f h1:iSo5r2GcXv5lX+UwVmarbSB9OjtvfnqQ4nwiiWWib8I=
400 -github.com/ipfs/boxo v0.13.2-0.20231017164040-0a566c9ee75f/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
401 +github.com/ipfs/boxo v0.13.2-0.20231018081237-a50f784985dd h1:CWz2mhz+cmkLRlKgQYlKXkDtx4oWYkCorSSF4ZWkH3o=
402 +github.com/ipfs/boxo v0.13.2-0.20231018081237-a50f784985dd/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk=
403 github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
404 github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
405 github.com/ipfs/go-block-format v0.2.0 h1:ZqrkxBA2ICbDRbK8KJs/u0O3dlp6gmAuuXUJNiW1Ycs=
@@ -546,7 +548,14 @@ github.com/libp2p/go-libp2p v0.31.0 h1:LFShhP8F6xthWiBBq3euxbKjZsoRajVEyBS9snfHx
548 github.com/libp2p/go-libp2p v0.31.0/go.mod h1:W/FEK1c/t04PbRH3fA9i5oucu5YcgrG0JVoBWT1B7Eg=
549 github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s=
550 github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w=
551 +github.com/libp2p/go-libp2p-kad-dht v0.24.4 h1:ktNiJe7ffsJ1wX3ULpMCwXts99mPqGFSE/Qn1i8pErQ=
552 +github.com/libp2p/go-libp2p-kad-dht v0.24.4/go.mod h1:ybWBJ5Fbvz9sSLkNtXt+2+bK0JB8+tRPvhBbRGHegRU=
553 +github.com/libp2p/go-libp2p-kbucket v0.6.3 h1:p507271wWzpy2f1XxPzCQG9NiN6R6lHL9GiSErbQQo0=
554 +github.com/libp2p/go-libp2p-kbucket v0.6.3/go.mod h1:RCseT7AH6eJWxxk2ol03xtP9pEHetYSPXOaJnOiD8i0=
555 github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
556 +github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk=
557 +github.com/libp2p/go-libp2p-routing-helpers v0.7.3 h1:u1LGzAMVRK9Nqq5aYDVOiq/HaB93U9WWczBzGyAC5ZY=
558 +github.com/libp2p/go-libp2p-routing-helpers v0.7.3/go.mod h1:cN4mJAD/7zfPKXBcs9ze31JGYAZgzdABEm+q/hkswb8=
559 github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
560 github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0=
561 github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM=
@@ -848,6 +857,7 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
857 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
858 github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
859 github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
860 +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
861 github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
862 github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
863 github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
@@ -887,9 +897,13 @@ github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMI
897 github.com/warpfork/go-testmark v0.12.1 h1:rMgCpJfwy1sJ50x0M0NgyphxYYPMOODIJHhsXyEHU0s=
898 github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ=
899 github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
900 +github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc h1:BCPnHtcboadS0DvysUuJXZ4lWVv5Bh5i7+tbIyi+ck4=
901 +github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc/go.mod h1:r45hJU7yEoA81k6MWNhpMj/kms0n14dkzkxYHoB96UM=
902 github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11 h1:5HZfQkwe0mIfyDmc1Em5GqlNRzcdtlv4HTNmdpt7XH0=
903 github.com/whyrusleeping/cbor-gen v0.0.0-20230126041949-52956bd4c9aa h1:EyA027ZAkuaCLoxVX4r1TZMPy1d31fM6hbfQ4OU4I5o=
904 github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
905 +github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k=
906 +github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc=
907 github.com/xen0n/gosmopolitan v1.2.1 h1:3pttnTuFumELBRSh+KQs1zcz4fN6Zy7aB0xlnQSn1Iw=
908 github.com/xen0n/gosmopolitan v1.2.1/go.mod h1:JsHq/Brs1o050OOdmzHeOr0N7OtlnKRAGAsElF8xBQA=
909 github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM=
@@ -915,6 +929,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
929 go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
930 go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
931 go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
932 +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
933 +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
934 go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs=
935 go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY=
936 go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE=
@@ -1045,6 +1061,7 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R
1061 golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
1062 golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
1063 golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
1064 +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
1065 golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
1066 golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
1067 golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
@@ -1266,6 +1283,8 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T
1283 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
1284 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
1285 golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
1286 +gonum.org/v1/gonum v0.13.0 h1:a0T3bh+7fhRyqeNbiC3qVHYmkiQgit3wnNan/2c0HMM=
1287 +gonum.org/v1/gonum v0.13.0/go.mod h1:/WPYRckkfWrhWefxyYTfrTtQR0KH4iyHNuzxqXAKyAU=
1288 google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
1289 google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
1290 google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y=
test/sharness/t0160-resolve.sh
+4 -1
@@ -30,8 +30,11 @@ test_resolve_setup_name() {
30 local key="$1"
31 local ref="$2"
32
33 + # we pass here --ttl=0s to ensure that it does not get cached by namesys.
34 + # the alternative would be to wait between tests to ensure that the namesys
35 + # cache gets purged in time, but that adds runtime time for the tests.
36 test_expect_success "resolve: prepare $key" '
34 - ipfs name publish --key="$key" --allow-offline "$ref"
37 + ipfs name publish --key="$key" --ttl=0s --allow-offline "$ref"
38 '
39 }
40