Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
d82b5272
提交
d82b5272
authored
1月 24, 2018
作者:
Steven Allen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
switch to fast base58 library
License: MIT Signed-off-by:
Steven Allen
<
steven@stebalien.com
>
上级
fe8846fc
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
31 行增加
和
16 行删除
+31
-16
dht.go
core/commands/dht.go
+16
-5
id.go
core/commands/id.go
+3
-3
core.go
core/core.go
+6
-2
package.json
package.json
+6
-6
没有找到文件。
core/commands/dht.go
浏览文件 @
d82b5272
...
...
@@ -15,7 +15,7 @@ import (
routing
"gx/ipfs/QmRijoA6zGS98ELTDbGsLWPZbVotYsGbjp3RbXcKCYBeon/go-libp2p-routing"
notif
"gx/ipfs/QmRijoA6zGS98ELTDbGsLWPZbVotYsGbjp3RbXcKCYBeon/go-libp2p-routing/notifications"
b58
"gx/ipfs/Qm
T8rehPR3F6bmwL6zjUN8XpiDBFFpMP2myPdC6ApsWfJf/go-
base58"
b58
"gx/ipfs/Qm
WFAMPqsEyUX7gDUsRVmMWz59FxSpJ1b2v6bJ1yYzo7jY/go-base58-fast/
base58"
peer
"gx/ipfs/Qma7H6RW8wRrfZpNSXwxYGcd1E149s42FpWNpDNieSVrnU/go-libp2p-peer"
cid
"gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
"gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit"
...
...
@@ -69,9 +69,13 @@ var queryDhtCmd = &cmds.Command{
events
:=
make
(
chan
*
notif
.
QueryEvent
)
ctx
:=
notif
.
RegisterForQueryEvents
(
req
.
Context
(),
events
)
k
:=
string
(
b58
.
Decode
(
req
.
Arguments
()[
0
]))
id
,
err
:=
peer
.
IDB58Decode
(
req
.
Arguments
()[
0
])
if
err
!=
nil
{
res
.
SetError
(
cmds
.
ClientError
(
"invalid peer ID"
),
cmdkit
.
ErrClient
)
return
}
closestPeers
,
err
:=
dht
.
GetClosestPeers
(
ctx
,
k
)
closestPeers
,
err
:=
dht
.
GetClosestPeers
(
ctx
,
string
(
id
)
)
if
err
!=
nil
{
res
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
...
...
@@ -773,9 +777,16 @@ func escapeDhtKey(s string) (string, error) {
parts
:=
path
.
SplitList
(
s
)
switch
len
(
parts
)
{
case
1
:
return
string
(
b58
.
Decode
(
s
)),
nil
k
,
err
:=
b58
.
Decode
(
s
)
if
err
!=
nil
{
return
""
,
err
}
return
string
(
k
),
nil
case
3
:
k
:=
b58
.
Decode
(
parts
[
2
])
k
,
err
:=
b58
.
Decode
(
parts
[
2
])
if
err
!=
nil
{
return
""
,
err
}
return
path
.
Join
(
append
(
parts
[
:
2
],
string
(
k
))),
nil
default
:
return
""
,
errors
.
New
(
"invalid key"
)
...
...
core/commands/id.go
浏览文件 @
d82b5272
...
...
@@ -13,7 +13,6 @@ import (
e
"github.com/ipfs/go-ipfs/core/commands/e"
identify
"gx/ipfs/QmNRN4eZGmY89CRC4T5PC4xDYRx6GkDKEfRnvrT65fVeio/go-libp2p/p2p/protocol/identify"
b58
"gx/ipfs/QmT8rehPR3F6bmwL6zjUN8XpiDBFFpMP2myPdC6ApsWfJf/go-base58"
kb
"gx/ipfs/QmYe9YR9fibxCaExayDXUAN7eX7Q4N7jsMcPs8KgpGdiEV/go-libp2p-kbucket"
"gx/ipfs/Qma7H6RW8wRrfZpNSXwxYGcd1E149s42FpWNpDNieSVrnU/go-libp2p-peer"
ic
"gx/ipfs/QmaPbCnUMBohSGo3KnxEa2bHqyJVVeEEcwtqJAYxerieBo/go-libp2p-crypto"
...
...
@@ -72,8 +71,9 @@ EXAMPLE:
var
id
peer
.
ID
if
len
(
req
.
Arguments
())
>
0
{
id
=
peer
.
ID
(
b58
.
Decode
(
req
.
Arguments
()[
0
]))
if
len
(
id
)
==
0
{
var
err
error
id
,
err
=
peer
.
IDB58Decode
(
req
.
Arguments
()[
0
])
if
err
!=
nil
{
res
.
SetError
(
cmds
.
ClientError
(
"Invalid peer id"
),
cmdkit
.
ErrClient
)
return
}
...
...
core/core.go
浏览文件 @
d82b5272
...
...
@@ -59,7 +59,6 @@ import (
goprocess
"gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess"
mamask
"gx/ipfs/QmSMZwvs3n4GBikZ7hKzT17c3bk65FmyZo2JqtJ16swqCv/multiaddr-filter"
logging
"gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
b58
"gx/ipfs/QmT8rehPR3F6bmwL6zjUN8XpiDBFFpMP2myPdC6ApsWfJf/go-base58"
addrutil
"gx/ipfs/QmUBVwiWc4Xv1U8qky2eZab7UqfJ1WFmCKVGjFfdDkxr8W/go-addr-util"
pnet
"gx/ipfs/QmUvHSZFyrZSRDUKzfE2ASstVUKtSbUCK24TTkWK73iZfc/go-libp2p-pnet"
mssmux
"gx/ipfs/QmVniQJkdzLZaZwzwMdd3dJTvWiJ1DQEkreVy6hs6h7Vk5/go-smux-multistream"
...
...
@@ -672,7 +671,12 @@ func (n *IpfsNode) loadID() error {
return
errors
.
New
(
"no peer ID in config! (was 'ipfs init' run?)"
)
}
n
.
Identity
=
peer
.
ID
(
b58
.
Decode
(
cid
))
id
,
err
:=
peer
.
IDB58Decode
(
cid
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"peer ID invalid: %s"
,
err
)
}
n
.
Identity
=
id
return
nil
}
...
...
package.json
浏览文件 @
d82b5272
...
...
@@ -397,12 +397,6 @@
},
{
"author"
:
"whyrusleeping"
,
"hash"
:
"QmT8rehPR3F6bmwL6zjUN8XpiDBFFpMP2myPdC6ApsWfJf"
,
"name"
:
"go-base58"
,
"version"
:
"0.0.0"
},
{
"author"
:
"whyrusleeping"
,
"hash"
:
"QmfCtHMCd9xFvehvHeVxtKVXJTMVTuHhyPRVHEXetn87vL"
,
"name"
:
"go-libp2p-host"
,
"version"
:
"2.1.4"
...
...
@@ -515,6 +509,12 @@
"hash"
:
"QmWBug6eBS7AxRdCDVuSY5CnSit7cS2XnPFYJWqWDumhCG"
,
"name"
:
"go-msgio"
,
"version"
:
"0.0.3"
},
{
"author"
:
"mr-tron"
,
"hash"
:
"QmWFAMPqsEyUX7gDUsRVmMWz59FxSpJ1b2v6bJ1yYzo7jY"
,
"name"
:
"go-base58-fast"
,
"version"
:
"0.1.1"
}
],
"gxVersion"
:
"0.10.0"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论