Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
b88ee287
提交
b88ee287
authored
9月 11, 2014
作者:
Siraj Ravel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
golint cleanup
上级
c370fc50
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
init.go
cmd/ipfs/init.go
+1
-1
identify.go
identify/identify.go
+5
-5
identify_test.go
identify/identify_test.go
+2
-2
dht_test.go
routing/dht/dht_test.go
+2
-2
没有找到文件。
cmd/ipfs/init.go
浏览文件 @
b88ee287
...
@@ -68,7 +68,7 @@ func initCmd(c *commander.Command, inp []string) error {
...
@@ -68,7 +68,7 @@ func initCmd(c *commander.Command, inp []string) error {
}
}
cfg
.
Identity
.
PrivKey
=
base64
.
StdEncoding
.
EncodeToString
(
skbytes
)
cfg
.
Identity
.
PrivKey
=
base64
.
StdEncoding
.
EncodeToString
(
skbytes
)
id
,
err
:=
identify
.
I
d
FromPubKey
(
pk
)
id
,
err
:=
identify
.
I
D
FromPubKey
(
pk
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
identify/identify.go
浏览文件 @
b88ee287
//
The identify package
handles how peers identify with eachother upon
//
Package identify
handles how peers identify with eachother upon
// connection to the network
// connection to the network
package
identify
package
identify
...
@@ -31,7 +31,7 @@ var SupportedHashes = "SHA256,SHA512,SHA1"
...
@@ -31,7 +31,7 @@ var SupportedHashes = "SHA256,SHA512,SHA1"
// ErrUnsupportedKeyType is returned when a private key cast/type switch fails.
// ErrUnsupportedKeyType is returned when a private key cast/type switch fails.
var
ErrUnsupportedKeyType
=
errors
.
New
(
"unsupported key type"
)
var
ErrUnsupportedKeyType
=
errors
.
New
(
"unsupported key type"
)
// Perform initial communication with this peer to share node ID's and
// Perform
s
initial communication with this peer to share node ID's and
// initiate communication. (secureIn, secureOut, error)
// initiate communication. (secureIn, secureOut, error)
func
Handshake
(
self
,
remote
*
peer
.
Peer
,
in
,
out
chan
[]
byte
)
(
chan
[]
byte
,
chan
[]
byte
,
error
)
{
func
Handshake
(
self
,
remote
*
peer
.
Peer
,
in
,
out
chan
[]
byte
)
(
chan
[]
byte
,
chan
[]
byte
,
error
)
{
// Generate and send Hello packet.
// Generate and send Hello packet.
...
@@ -74,7 +74,7 @@ func Handshake(self, remote *peer.Peer, in, out chan []byte) (chan []byte, chan
...
@@ -74,7 +74,7 @@ func Handshake(self, remote *peer.Peer, in, out chan []byte) (chan []byte, chan
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
remote
.
ID
,
err
=
I
d
FromPubKey
(
remote
.
PubKey
)
remote
.
ID
,
err
=
I
D
FromPubKey
(
remote
.
PubKey
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
...
@@ -238,8 +238,8 @@ func secureOutProxy(out, secureOut chan []byte, hashType string, mIV, mCKey, mMK
...
@@ -238,8 +238,8 @@ func secureOutProxy(out, secureOut chan []byte, hashType string, mIV, mCKey, mMK
out
<-
buff
out
<-
buff
}
}
}
}
// IDFromPubKey returns Nodes ID given its public key
func
I
d
FromPubKey
(
pk
ci
.
PubKey
)
(
peer
.
ID
,
error
)
{
func
I
D
FromPubKey
(
pk
ci
.
PubKey
)
(
peer
.
ID
,
error
)
{
b
,
err
:=
pk
.
Bytes
()
b
,
err
:=
pk
.
Bytes
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
identify/identify_test.go
浏览文件 @
b88ee287
...
@@ -20,7 +20,7 @@ func TestHandshake(t *testing.T) {
...
@@ -20,7 +20,7 @@ func TestHandshake(t *testing.T) {
cha
:=
make
(
chan
[]
byte
,
5
)
cha
:=
make
(
chan
[]
byte
,
5
)
chb
:=
make
(
chan
[]
byte
,
5
)
chb
:=
make
(
chan
[]
byte
,
5
)
ida
,
err
:=
I
d
FromPubKey
(
pka
)
ida
,
err
:=
I
D
FromPubKey
(
pka
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -30,7 +30,7 @@ func TestHandshake(t *testing.T) {
...
@@ -30,7 +30,7 @@ func TestHandshake(t *testing.T) {
PrivKey
:
ska
,
PrivKey
:
ska
,
}
}
idb
,
err
:=
I
d
FromPubKey
(
pkb
)
idb
,
err
:=
I
D
FromPubKey
(
pkb
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
...
routing/dht/dht_test.go
浏览文件 @
b88ee287
...
@@ -35,7 +35,7 @@ func setupDHTS(n int, t *testing.T) ([]*ma.Multiaddr, []*peer.Peer, []*IpfsDHT)
...
@@ -35,7 +35,7 @@ func setupDHTS(n int, t *testing.T) ([]*ma.Multiaddr, []*peer.Peer, []*IpfsDHT)
}
}
p
.
PubKey
=
pk
p
.
PubKey
=
pk
p
.
PrivKey
=
sk
p
.
PrivKey
=
sk
id
,
err
:=
identify
.
I
d
FromPubKey
(
pk
)
id
,
err
:=
identify
.
I
D
FromPubKey
(
pk
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
...
@@ -67,7 +67,7 @@ func makePeer(addr *ma.Multiaddr) *peer.Peer {
...
@@ -67,7 +67,7 @@ func makePeer(addr *ma.Multiaddr) *peer.Peer {
}
}
p
.
PrivKey
=
sk
p
.
PrivKey
=
sk
p
.
PubKey
=
pk
p
.
PubKey
=
pk
id
,
err
:=
identify
.
I
d
FromPubKey
(
pk
)
id
,
err
:=
identify
.
I
D
FromPubKey
(
pk
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论