Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
1bcf51e0
提交
1bcf51e0
authored
8月 02, 2019
作者:
Cole Brown
提交者:
Steven Allen
8月 23, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update go-libp2p, fix tests with weak RSA keys
上级
76b00150
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
31 行增加
和
61 行删除
+31
-61
api_test.go
core/coreapi/test/api_test.go
+1
-1
builder.go
core/node/builder.go
+1
-1
go.mod
go.mod
+9
-10
go.sum
go.sum
+0
-0
ipns_resolver_validation_test.go
namesys/ipns_resolver_validation_test.go
+5
-8
namesys_test.go
namesys/namesys_test.go
+1
-1
resolve_test.go
namesys/resolve_test.go
+14
-40
没有找到文件。
core/coreapi/test/api_test.go
浏览文件 @
1bcf51e0
...
...
@@ -39,7 +39,7 @@ func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int)
for
i
:=
0
;
i
<
n
;
i
++
{
var
ident
config
.
Identity
if
fullIdentity
{
sk
,
pk
,
err
:=
ci
.
GenerateKeyPair
(
ci
.
RSA
,
512
)
sk
,
pk
,
err
:=
ci
.
GenerateKeyPair
(
ci
.
RSA
,
2048
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
core/node/builder.go
浏览文件 @
1bcf51e0
...
...
@@ -124,7 +124,7 @@ func (cfg *BuildCfg) options(ctx context.Context) (fx.Option, *cfg.Config) {
func
defaultRepo
(
dstore
repo
.
Datastore
)
(
repo
.
Repo
,
error
)
{
c
:=
cfg
.
Config
{}
priv
,
pub
,
err
:=
ci
.
GenerateKeyPairWithReader
(
ci
.
RSA
,
1024
,
rand
.
Reader
)
priv
,
pub
,
err
:=
ci
.
GenerateKeyPairWithReader
(
ci
.
RSA
,
2048
,
rand
.
Reader
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
go.mod
浏览文件 @
1bcf51e0
...
...
@@ -61,31 +61,30 @@ require (
github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2
github.com/jbenet/goprocess v0.1.3
github.com/libp2p/go-eventbus v0.0.3 // indirect
github.com/libp2p/go-libp2p v0.
2
.0
github.com/libp2p/go-libp2p v0.
3
.0
github.com/libp2p/go-libp2p-autonat-svc v0.1.0
github.com/libp2p/go-libp2p-circuit v0.1.
0
github.com/libp2p/go-libp2p-circuit v0.1.
1
github.com/libp2p/go-libp2p-connmgr v0.1.1
github.com/libp2p/go-libp2p-core v0.
0.6
github.com/libp2p/go-libp2p-core v0.
2.0
github.com/libp2p/go-libp2p-http v0.1.2
github.com/libp2p/go-libp2p-kad-dht v0.
1.1
github.com/libp2p/go-libp2p-kad-dht v0.
2.0
github.com/libp2p/go-libp2p-kbucket v0.2.0
github.com/libp2p/go-libp2p-loggables v0.1.0
github.com/libp2p/go-libp2p-mplex v0.2.1
github.com/libp2p/go-libp2p-peerstore v0.1.
2-0.20190621130618-cfa9bb890c1a
github.com/libp2p/go-libp2p-peerstore v0.1.
3
github.com/libp2p/go-libp2p-pnet v0.1.0
github.com/libp2p/go-libp2p-pubsub v0.1.0
github.com/libp2p/go-libp2p-pubsub-router v0.1.0
github.com/libp2p/go-libp2p-quic-transport v0.1.1
github.com/libp2p/go-libp2p-record v0.1.
0
github.com/libp2p/go-libp2p-record v0.1.
1
github.com/libp2p/go-libp2p-routing-helpers v0.1.0
github.com/libp2p/go-libp2p-secio v0.
1
.0
github.com/libp2p/go-libp2p-swarm v0.
1.1
github.com/libp2p/go-libp2p-testing v0.
0.4
github.com/libp2p/go-libp2p-secio v0.
2
.0
github.com/libp2p/go-libp2p-swarm v0.
2.0
github.com/libp2p/go-libp2p-testing v0.
1.0
github.com/libp2p/go-libp2p-tls v0.1.0
github.com/libp2p/go-libp2p-yamux v0.2.1
github.com/libp2p/go-maddr-filter v0.0.5
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/mr-tron/base58 v1.1.2
github.com/multiformats/go-multiaddr v0.0.4
...
...
go.sum
浏览文件 @
1bcf51e0
差异被折叠。
点击展开。
namesys/ipns_resolver_validation_test.go
浏览文件 @
1bcf51e0
...
...
@@ -5,11 +5,12 @@ import (
"testing"
"time"
"github.com/libp2p/go-libp2p-core/test"
ds
"github.com/ipfs/go-datastore"
dssync
"github.com/ipfs/go-datastore/sync"
mockrouting
"github.com/ipfs/go-ipfs-routing/mock"
offline
"github.com/ipfs/go-ipfs-routing/offline"
u
"github.com/ipfs/go-ipfs-util"
ipns
"github.com/ipfs/go-ipns"
path
"github.com/ipfs/go-path"
opts
"github.com/ipfs/interface-go-ipfs-core/options/namesys"
...
...
@@ -137,19 +138,15 @@ func TestResolverValidation(t *testing.T) {
}
func
genKeys
(
t
*
testing
.
T
)
(
ci
.
PrivKey
,
peer
.
ID
,
string
,
string
)
{
sr
:=
u
.
NewTimeSeededRand
()
priv
,
_
,
err
:=
ci
.
GenerateKeyPairWithReader
(
ci
.
RSA
,
1024
,
sr
)
sk
,
pk
,
err
:=
test
.
RandTestKeyPair
(
ci
.
RSA
,
2048
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
// Create entry with expiry in one hour
pid
,
err
:=
peer
.
IDFromPrivateKey
(
priv
)
id
,
err
:=
peer
.
IDFromPublicKey
(
pk
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
return
priv
,
pid
,
PkKeyForID
(
pid
),
ipns
.
RecordKey
(
pid
)
return
sk
,
id
,
PkKeyForID
(
id
),
ipns
.
RecordKey
(
id
)
}
type
mockValueStore
struct
{
...
...
namesys/namesys_test.go
浏览文件 @
1bcf51e0
...
...
@@ -88,7 +88,7 @@ func TestNamesysResolution(t *testing.T) {
func
TestPublishWithCache0
(
t
*
testing
.
T
)
{
dst
:=
dssync
.
MutexWrap
(
ds
.
NewMapDatastore
())
priv
,
_
,
err
:=
ci
.
GenerateKeyPair
(
ci
.
RSA
,
1024
)
priv
,
_
,
err
:=
ci
.
GenerateKeyPair
(
ci
.
RSA
,
2048
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
namesys/resolve_test.go
浏览文件 @
1bcf51e0
...
...
@@ -11,10 +11,8 @@ import (
mockrouting
"github.com/ipfs/go-ipfs-routing/mock"
ipns
"github.com/ipfs/go-ipns"
path
"github.com/ipfs/go-path"
ci
"github.com/libp2p/go-libp2p-core/crypto"
peer
"github.com/libp2p/go-libp2p-core/peer"
test
"github.com/libp2p/go-libp2p-core/test"
testutil
"github.com/libp2p/go-libp2p-testing/net"
tnet
"github.com/libp2p/go-libp2p-testing/net"
)
func
TestRoutingResolve
(
t
*
testing
.
T
)
{
...
...
@@ -26,23 +24,15 @@ func TestRoutingResolve(t *testing.T) {
resolver
:=
NewIpnsResolver
(
d
)
publisher
:=
NewIpnsPublisher
(
d
,
dstore
)
privk
,
pubk
,
err
:=
test
.
RandTestKeyPair
(
ci
.
RSA
,
512
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
identity
:=
tnet
.
RandIdentityOrFatal
(
t
)
h
:=
path
.
FromString
(
"/ipfs/QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN"
)
err
=
publisher
.
Publish
(
context
.
Background
(),
privk
,
h
)
err
:=
publisher
.
Publish
(
context
.
Background
(),
identity
.
PrivateKey
()
,
h
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
pid
,
err
:=
peer
.
IDFromPublicKey
(
pubk
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
res
,
err
:=
resolver
.
Resolve
(
context
.
Background
(),
pid
.
Pretty
())
res
,
err
:=
resolver
.
Resolve
(
context
.
Background
(),
identity
.
ID
()
.
Pretty
())
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
@@ -59,36 +49,28 @@ func TestPrexistingExpiredRecord(t *testing.T) {
resolver
:=
NewIpnsResolver
(
d
)
publisher
:=
NewIpnsPublisher
(
d
,
dstore
)
privk
,
pubk
,
err
:=
test
.
RandTestKeyPair
(
ci
.
RSA
,
512
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
id
,
err
:=
peer
.
IDFromPublicKey
(
pubk
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
identity
:=
tnet
.
RandIdentityOrFatal
(
t
)
// Make an expired record and put it in the datastore
h
:=
path
.
FromString
(
"/ipfs/QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN"
)
eol
:=
time
.
Now
()
.
Add
(
time
.
Hour
*
-
1
)
entry
,
err
:=
ipns
.
Create
(
privk
,
[]
byte
(
h
),
0
,
eol
)
entry
,
err
:=
ipns
.
Create
(
identity
.
PrivateKey
()
,
[]
byte
(
h
),
0
,
eol
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
err
=
PutRecordToRouting
(
context
.
Background
(),
d
,
pubk
,
entry
)
err
=
PutRecordToRouting
(
context
.
Background
(),
d
,
identity
.
PublicKey
()
,
entry
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
// Now, with an old record in the system already, try and publish a new one
err
=
publisher
.
Publish
(
context
.
Background
(),
privk
,
h
)
err
=
publisher
.
Publish
(
context
.
Background
(),
identity
.
PrivateKey
()
,
h
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
err
=
verifyCanResolve
(
resolver
,
id
.
Pretty
(),
h
)
err
=
verifyCanResolve
(
resolver
,
id
entity
.
ID
()
.
Pretty
(),
h
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
@@ -101,35 +83,27 @@ func TestPrexistingRecord(t *testing.T) {
resolver
:=
NewIpnsResolver
(
d
)
publisher
:=
NewIpnsPublisher
(
d
,
dstore
)
privk
,
pubk
,
err
:=
test
.
RandTestKeyPair
(
ci
.
RSA
,
512
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
id
,
err
:=
peer
.
IDFromPublicKey
(
pubk
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
identity
:=
tnet
.
RandIdentityOrFatal
(
t
)
// Make a good record and put it in the datastore
h
:=
path
.
FromString
(
"/ipfs/QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN"
)
eol
:=
time
.
Now
()
.
Add
(
time
.
Hour
)
entry
,
err
:=
ipns
.
Create
(
privk
,
[]
byte
(
h
),
0
,
eol
)
entry
,
err
:=
ipns
.
Create
(
identity
.
PrivateKey
()
,
[]
byte
(
h
),
0
,
eol
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
err
=
PutRecordToRouting
(
context
.
Background
(),
d
,
pubk
,
entry
)
err
=
PutRecordToRouting
(
context
.
Background
(),
d
,
identity
.
PublicKey
()
,
entry
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
// Now, with an old record in the system already, try and publish a new one
err
=
publisher
.
Publish
(
context
.
Background
(),
privk
,
h
)
err
=
publisher
.
Publish
(
context
.
Background
(),
identity
.
PrivateKey
()
,
h
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
err
=
verifyCanResolve
(
resolver
,
id
.
Pretty
(),
h
)
err
=
verifyCanResolve
(
resolver
,
id
entity
.
ID
()
.
Pretty
(),
h
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论