Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
76d9d89a
提交
76d9d89a
authored
1月 24, 2015
作者:
Juan Batiz-Benet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
user friendliness in logs + output
上级
2c019b54
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
15 行增加
和
15 行删除
+15
-15
daemon.go
cmd/ipfs/daemon.go
+1
-0
init.go
cmd/ipfs/init.go
+0
-1
bootstrap.go
core/bootstrap.go
+2
-2
core.go
core/core.go
+1
-1
swarm_dial.go
p2p/net/swarm/swarm_dial.go
+2
-2
id.go
p2p/protocol/identify/id.go
+3
-3
t0020-init.sh
test/sharness/t0020-init.sh
+1
-1
t0060-daemon.sh
test/sharness/t0060-daemon.sh
+1
-1
t0080-repo.sh
test/sharness/t0080-repo.sh
+4
-4
没有找到文件。
cmd/ipfs/daemon.go
浏览文件 @
76d9d89a
...
@@ -49,6 +49,7 @@ the daemon.
...
@@ -49,6 +49,7 @@ the daemon.
func
daemonFunc
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
func
daemonFunc
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
fmt
.
Println
(
"Initializing daemon..."
)
// first, whether user has provided the initialization flag. we may be
// first, whether user has provided the initialization flag. we may be
// running in an uninitialized state.
// running in an uninitialized state.
initialize
,
_
,
err
:=
req
.
Option
(
initOptionKwd
)
.
Bool
()
initialize
,
_
,
err
:=
req
.
Option
(
initOptionKwd
)
.
Bool
()
...
...
cmd/ipfs/init.go
浏览文件 @
76d9d89a
...
@@ -80,7 +80,6 @@ var welcomeMsg = `Hello and Welcome to IPFS!
...
@@ -80,7 +80,6 @@ var welcomeMsg = `Hello and Welcome to IPFS!
If you're seeing this, you have successfully installed
If you're seeing this, you have successfully installed
IPFS and are now interfacing with the ipfs merkledag!
IPFS and are now interfacing with the ipfs merkledag!
For a short demo of what you can do, enter 'ipfs tour'
`
`
func
initWithDefaults
(
repoRoot
string
)
error
{
func
initWithDefaults
(
repoRoot
string
)
error
{
...
...
core/bootstrap.go
浏览文件 @
76d9d89a
...
@@ -92,7 +92,7 @@ func Bootstrap(n *IpfsNode, cfg BootstrapConfig) (io.Closer, error) {
...
@@ -92,7 +92,7 @@ func Bootstrap(n *IpfsNode, cfg BootstrapConfig) (io.Closer, error) {
if
err
:=
bootstrapRound
(
ctx
,
n
.
PeerHost
,
thedht
,
n
.
Peerstore
,
cfg
);
err
!=
nil
{
if
err
:=
bootstrapRound
(
ctx
,
n
.
PeerHost
,
thedht
,
n
.
Peerstore
,
cfg
);
err
!=
nil
{
log
.
Event
(
ctx
,
"bootstrapError"
,
n
.
Identity
,
lgbl
.
Error
(
err
))
log
.
Event
(
ctx
,
"bootstrapError"
,
n
.
Identity
,
lgbl
.
Error
(
err
))
log
.
Error
f
(
"%s bootstrap error: %s"
,
n
.
Identity
,
err
)
log
.
Debug
f
(
"%s bootstrap error: %s"
,
n
.
Identity
,
err
)
}
}
}
}
...
@@ -187,7 +187,7 @@ func bootstrapConnect(ctx context.Context,
...
@@ -187,7 +187,7 @@ func bootstrapConnect(ctx context.Context,
err
:=
route
.
Connect
(
ctx
,
p
.
ID
)
err
:=
route
.
Connect
(
ctx
,
p
.
ID
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Event
(
ctx
,
"bootstrapDialFailed"
,
p
.
ID
)
log
.
Event
(
ctx
,
"bootstrapDialFailed"
,
p
.
ID
)
log
.
Error
f
(
"failed to bootstrap with %v: %s"
,
p
.
ID
,
err
)
log
.
Debug
f
(
"failed to bootstrap with %v: %s"
,
p
.
ID
,
err
)
errs
<-
err
errs
<-
err
return
return
}
}
...
...
core/core.go
浏览文件 @
76d9d89a
...
@@ -308,7 +308,7 @@ func (n *IpfsNode) Bootstrap(cfg BootstrapConfig) error {
...
@@ -308,7 +308,7 @@ func (n *IpfsNode) Bootstrap(cfg BootstrapConfig) error {
bpeers
:=
n
.
Repo
.
Config
()
.
Bootstrap
bpeers
:=
n
.
Repo
.
Config
()
.
Bootstrap
ps
,
err
:=
toPeerInfos
(
bpeers
)
ps
,
err
:=
toPeerInfos
(
bpeers
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
"failed to parse bootstrap peers from config: %s"
,
bpeers
)
log
.
Warningf
(
"failed to parse bootstrap peers from config: %s"
,
bpeers
)
return
nil
return
nil
}
}
return
ps
return
ps
...
...
p2p/net/swarm/swarm_dial.go
浏览文件 @
76d9d89a
...
@@ -293,7 +293,7 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
...
@@ -293,7 +293,7 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
// ok try to setup the new connection.
// ok try to setup the new connection.
swarmC
,
err
:=
dialConnSetup
(
ctx
,
s
,
connC
)
swarmC
,
err
:=
dialConnSetup
(
ctx
,
s
,
connC
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
"Dial newConnSetup failed. disconnecting."
)
log
.
Debug
(
"Dial newConnSetup failed. disconnecting."
)
log
.
Event
(
ctx
,
"dialFailureDisconnect"
,
lgbl
.
NetConn
(
connC
),
lgbl
.
Error
(
err
))
log
.
Event
(
ctx
,
"dialFailureDisconnect"
,
lgbl
.
NetConn
(
connC
),
lgbl
.
Error
(
err
))
connC
.
Close
()
// close the connection. didn't work out :(
connC
.
Close
()
// close the connection. didn't work out :(
return
nil
,
err
return
nil
,
err
...
@@ -398,7 +398,7 @@ func dialConnSetup(ctx context.Context, s *Swarm, connC conn.Conn) (*Conn, error
...
@@ -398,7 +398,7 @@ func dialConnSetup(ctx context.Context, s *Swarm, connC conn.Conn) (*Conn, error
// ok try to setup the new connection. (newConnSetup will add to group)
// ok try to setup the new connection. (newConnSetup will add to group)
swarmC
,
err
:=
s
.
newConnSetup
(
ctx
,
psC
)
swarmC
,
err
:=
s
.
newConnSetup
(
ctx
,
psC
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
"Dial newConnSetup failed. disconnecting."
)
log
.
Debug
(
"Dial newConnSetup failed. disconnecting."
)
log
.
Event
(
ctx
,
"dialFailureDisconnect"
,
lgbl
.
NetConn
(
connC
),
lgbl
.
Error
(
err
))
log
.
Event
(
ctx
,
"dialFailureDisconnect"
,
lgbl
.
NetConn
(
connC
),
lgbl
.
Error
(
err
))
psC
.
Close
()
// we need to make sure psC is Closed.
psC
.
Close
()
// we need to make sure psC is Closed.
return
nil
,
err
return
nil
,
err
...
...
p2p/protocol/identify/id.go
浏览文件 @
76d9d89a
...
@@ -79,7 +79,7 @@ func (ids *IDService) IdentifyConn(c inet.Conn) {
...
@@ -79,7 +79,7 @@ func (ids *IDService) IdentifyConn(c inet.Conn) {
// ok give the response to our handler.
// ok give the response to our handler.
if
err
:=
protocol
.
WriteHeader
(
s
,
ID
);
err
!=
nil
{
if
err
:=
protocol
.
WriteHeader
(
s
,
ID
);
err
!=
nil
{
log
.
Error
(
"error writing stream header for %s"
,
ID
)
log
.
Debugf
(
"error writing stream header for %s"
,
ID
)
log
.
Event
(
context
.
TODO
(),
"IdentifyOpenFailed"
,
c
.
RemotePeer
())
log
.
Event
(
context
.
TODO
(),
"IdentifyOpenFailed"
,
c
.
RemotePeer
())
}
}
ids
.
ResponseHandler
(
s
)
ids
.
ResponseHandler
(
s
)
...
@@ -118,7 +118,7 @@ func (ids *IDService) ResponseHandler(s inet.Stream) {
...
@@ -118,7 +118,7 @@ func (ids *IDService) ResponseHandler(s inet.Stream) {
r
:=
ggio
.
NewDelimitedReader
(
s
,
2048
)
r
:=
ggio
.
NewDelimitedReader
(
s
,
2048
)
mes
:=
pb
.
Identify
{}
mes
:=
pb
.
Identify
{}
if
err
:=
r
.
ReadMsg
(
&
mes
);
err
!=
nil
{
if
err
:=
r
.
ReadMsg
(
&
mes
);
err
!=
nil
{
log
.
Error
f
(
"%s error receiving message from %s %s %s"
,
ID
,
log
.
Debug
f
(
"%s error receiving message from %s %s %s"
,
ID
,
c
.
RemotePeer
(),
c
.
RemoteMultiaddr
(),
err
)
c
.
RemotePeer
(),
c
.
RemoteMultiaddr
(),
err
)
return
return
}
}
...
@@ -169,7 +169,7 @@ func (ids *IDService) consumeMessage(mes *pb.Identify, c inet.Conn) {
...
@@ -169,7 +169,7 @@ func (ids *IDService) consumeMessage(mes *pb.Identify, c inet.Conn) {
for
_
,
addr
:=
range
laddrs
{
for
_
,
addr
:=
range
laddrs
{
maddr
,
err
:=
ma
.
NewMultiaddrBytes
(
addr
)
maddr
,
err
:=
ma
.
NewMultiaddrBytes
(
addr
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
f
(
"%s failed to parse multiaddr from %s %s"
,
ID
,
log
.
Debug
f
(
"%s failed to parse multiaddr from %s %s"
,
ID
,
p
,
c
.
RemoteMultiaddr
())
p
,
c
.
RemoteMultiaddr
())
continue
continue
}
}
...
...
test/sharness/t0020-init.sh
浏览文件 @
76d9d89a
...
@@ -34,7 +34,7 @@ test_expect_success "ipfs peer id looks good" '
...
@@ -34,7 +34,7 @@ test_expect_success "ipfs peer id looks good" '
'
'
test_expect_success
"ipfs init output looks good"
'
test_expect_success
"ipfs init output looks good"
'
STARTHASH="Qm
Ypv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB
" &&
STARTHASH="Qm
TTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ
" &&
echo "initializing ipfs node at $IPFS_PATH" >expected &&
echo "initializing ipfs node at $IPFS_PATH" >expected &&
echo "generating 4096-bit RSA keypair...done" >>expected &&
echo "generating 4096-bit RSA keypair...done" >>expected &&
echo "peer identity: $PEERID" >>expected &&
echo "peer identity: $PEERID" >>expected &&
...
...
test/sharness/t0060-daemon.sh
浏览文件 @
76d9d89a
...
@@ -34,7 +34,7 @@ test_expect_success "ipfs peer id looks good" '
...
@@ -34,7 +34,7 @@ test_expect_success "ipfs peer id looks good" '
# note this is almost the same as t0020-init.sh "ipfs init output looks good"
# note this is almost the same as t0020-init.sh "ipfs init output looks good"
test_expect_success
"ipfs daemon output looks good"
'
test_expect_success
"ipfs daemon output looks good"
'
STARTHASH="Qm
Ypv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB
" &&
STARTHASH="Qm
TTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ
" &&
echo "initializing ipfs node at $IPFS_PATH" >expected &&
echo "initializing ipfs node at $IPFS_PATH" >expected &&
echo "generating key pair...done" >>expected &&
echo "generating key pair...done" >>expected &&
echo "peer identity: $PEERID" >>expected &&
echo "peer identity: $PEERID" >>expected &&
...
...
test/sharness/t0080-repo.sh
浏览文件 @
76d9d89a
...
@@ -43,7 +43,7 @@ test_expect_success "'ipfs pin rm' succeeds" '
...
@@ -43,7 +43,7 @@ test_expect_success "'ipfs pin rm' succeeds" '
test_expect_success
"file no longer pinned"
'
test_expect_success
"file no longer pinned"
'
# we expect the welcome file to show up here
# we expect the welcome file to show up here
echo Qm
Ypv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB
> expected2
echo Qm
TTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ
> expected2
ipfs pin ls -type=recursive > actual2
ipfs pin ls -type=recursive > actual2
test_cmp expected2 actual2
test_cmp expected2 actual2
'
'
...
@@ -84,8 +84,8 @@ test_expect_success "'ipfs repo gc' removes file" '
...
@@ -84,8 +84,8 @@ test_expect_success "'ipfs repo gc' removes file" '
'
'
test_expect_success
"'ipfs refs local' no longer shows file"
'
test_expect_success
"'ipfs refs local' no longer shows file"
'
echo Qm
UNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn
> expected8
echo Qm
TTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ
> expected8
echo Qm
Ypv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB
>> expected8
echo Qm
UNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn
>> expected8
ipfs refs local > actual8
ipfs refs local > actual8
test_cmp expected8 actual8
test_cmp expected8 actual8
'
'
...
@@ -123,7 +123,7 @@ test_expect_success "'ipfs pin ls -type=direct' is correct" '
...
@@ -123,7 +123,7 @@ test_expect_success "'ipfs pin ls -type=direct' is correct" '
test_expect_success
"'ipfs pin ls -type=recursive' is correct"
'
test_expect_success
"'ipfs pin ls -type=recursive' is correct"
'
echo $MBLOCKHASH > rp_expected
echo $MBLOCKHASH > rp_expected
echo Qm
Ypv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB
>> rp_expected
echo Qm
TTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ
>> rp_expected
cat rp_expected | sort > rp_exp_sorted
cat rp_expected | sort > rp_exp_sorted
ipfs pin ls -type=recursive | sort > rp_actual
ipfs pin ls -type=recursive | sort > rp_actual
test_cmp rp_exp_sorted rp_actual
test_cmp rp_exp_sorted rp_actual
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论