1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-05-18 23:46:44 +08:00

change ipns resolve/publish to store raw keys, not b58 encoded

This commit is contained in:
Jeromy
2015-01-26 20:13:11 +00:00
parent 56b14d8e9e
commit f1267d0624
14 changed files with 117 additions and 48 deletions

View File

@ -6,6 +6,7 @@ import (
"strings"
cmds "github.com/jbenet/go-ipfs/commands"
u "github.com/jbenet/go-ipfs/util"
)
var resolveCmd = &cmds.Command{
@ -48,13 +49,16 @@ Resolve te value of another name:
return
}
var name string
if n.PeerHost == nil {
res.SetError(errNotOnline, cmds.ErrClient)
return
if !n.OnlineMode() {
err := n.SetupOfflineRouting()
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
}
var name string
if len(req.Arguments()) == 0 {
if n.Identity == "" {
res.SetError(errors.New("Identity not loaded!"), cmds.ErrNormal)
@ -66,7 +70,7 @@ Resolve te value of another name:
name = req.Arguments()[0]
}
output, err := n.Namesys.Resolve(name)
output, err := n.Namesys.Resolve(n.Context(), name)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
@ -78,8 +82,8 @@ Resolve te value of another name:
},
Marshalers: cmds.MarshalerMap{
cmds.Text: func(res cmds.Response) (io.Reader, error) {
output := res.Output().(string)
return strings.NewReader(output), nil
output := res.Output().(u.Key)
return strings.NewReader(output.B58String()), nil
},
},
}