From 73cd3f6563b9934d4ffc860f0168fad9a9610ca0 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Mon, 12 Oct 2015 11:36:16 -0700 Subject: [PATCH] allow ipfs name resolve to respect --local flag for local name resolution License: MIT Signed-off-by: Jeromy --- core/commands/ipns.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/commands/ipns.go b/core/commands/ipns.go index 0c9320226..494ef994e 100644 --- a/core/commands/ipns.go +++ b/core/commands/ipns.go @@ -7,6 +7,7 @@ import ( cmds "github.com/ipfs/go-ipfs/commands" namesys "github.com/ipfs/go-ipfs/namesys" + offline "github.com/ipfs/go-ipfs/routing/offline" u "github.com/ipfs/go-ipfs/util" ) @@ -61,6 +62,11 @@ Resolve the value of another name: } } + router := n.Routing + if local, _, _ := req.Option("local").Bool(); local { + router = offline.NewOfflineRouter(n.Repo.Datastore(), n.PrivateKey) + } + var name string if len(req.Arguments()) == 0 { @@ -80,7 +86,7 @@ Resolve the value of another name: depth = namesys.DefaultDepthLimit } - resolver := namesys.NewRoutingResolver(n.Routing) + resolver := namesys.NewRoutingResolver(router) output, err := resolver.ResolveN(req.Context(), name, depth) if err != nil { res.SetError(err, cmds.ErrNormal)