Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
8e4ce426
Commit
8e4ce426
authored
Sep 24, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
namesys: use routing.SearchValue
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
f69cf074
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
22 deletions
+11
-22
core/commands/name/ipns.go
core/commands/name/ipns.go
+10
-9
namesys/routing.go
namesys/routing.go
+1
-13
No files found.
core/commands/name/ipns.go
View file @
8e4ce426
...
...
@@ -159,16 +159,17 @@ Resolve the value of a dnslink:
}
return
cmds
.
EmitOnce
(
res
,
&
ResolvedPath
{
output
})
}
else
{
output
:=
resolver
.
ResolveAsync
(
req
.
Context
,
name
,
ropts
...
)
for
v
:=
range
output
{
if
v
.
Err
!=
nil
{
return
err
}
if
err
:=
res
.
Emit
(
&
ResolvedPath
{
v
.
Path
});
err
!=
nil
{
return
err
}
}
output
:=
resolver
.
ResolveAsync
(
req
.
Context
,
name
,
ropts
...
)
for
v
:=
range
output
{
if
v
.
Err
!=
nil
{
return
err
}
if
err
:=
res
.
Emit
(
&
ResolvedPath
{
v
.
Path
});
err
!=
nil
{
return
err
}
}
return
nil
},
...
...
namesys/routing.go
View file @
8e4ce426
...
...
@@ -11,7 +11,6 @@ import (
cid
"gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid"
mh
"gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
routing
"gx/ipfs/QmVBnJDKhtFXTRVjXKinqpwGu8t1DyNqPKan2iGX8PR8xG/go-libp2p-routing"
ropts
"gx/ipfs/QmVBnJDKhtFXTRVjXKinqpwGu8t1DyNqPKan2iGX8PR8xG/go-libp2p-routing/options"
logging
"gx/ipfs/QmZChCsSt8DctjceaL56Eibc29CVQq4dGKRXC5JRZ6Ppae/go-log"
dht
"gx/ipfs/QmZVakpN44VAUxs9eXAuUGLFYTCGmSyqSy6hyEKfMv68ME/go-libp2p-kad-dht"
ipns
"gx/ipfs/QmZrmn2BPZbSviQAWeyY2iXkCukmJHv9n7zrLgWU5KgbTb/go-ipns"
...
...
@@ -89,7 +88,7 @@ func (r *IpnsResolver) resolveOnceAsync(ctx context.Context, name string, option
// the value, which in turn verifies the ipns record signature
ipnsKey
:=
ipns
.
RecordKey
(
pid
)
vals
,
err
:=
r
.
s
earchValue
(
ctx
,
ipnsKey
,
dht
.
Quorum
(
int
(
options
.
DhtRecordCount
)))
vals
,
err
:=
r
.
routing
.
S
earchValue
(
ctx
,
ipnsKey
,
dht
.
Quorum
(
int
(
options
.
DhtRecordCount
)))
if
err
!=
nil
{
log
.
Debugf
(
"RoutingResolver: dht get for name %s failed: %s"
,
name
,
err
)
out
<-
onceResult
{
err
:
err
}
...
...
@@ -173,14 +172,3 @@ func (r *IpnsResolver) resolveOnceAsync(ctx context.Context, name string, option
return
out
}
func
(
r
*
IpnsResolver
)
searchValue
(
ctx
context
.
Context
,
key
string
,
opts
...
ropts
.
Option
)
(
<-
chan
[]
byte
,
error
)
{
if
ir
,
ok
:=
r
.
routing
.
(
*
dht
.
IpfsDHT
);
ok
{
return
ir
.
SearchValue
(
ctx
,
key
,
opts
...
)
}
out
:=
make
(
chan
[]
byte
,
1
)
val
,
err
:=
r
.
routing
.
GetValue
(
ctx
,
key
,
opts
...
)
out
<-
val
close
(
out
)
return
out
,
err
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment