Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
b88ee287
Commit
b88ee287
authored
Sep 11, 2014
by
Siraj Ravel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
golint cleanup
parent
c370fc50
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
cmd/ipfs/init.go
cmd/ipfs/init.go
+1
-1
identify/identify.go
identify/identify.go
+5
-5
identify/identify_test.go
identify/identify_test.go
+2
-2
routing/dht/dht_test.go
routing/dht/dht_test.go
+2
-2
No files found.
cmd/ipfs/init.go
View file @
b88ee287
...
...
@@ -68,7 +68,7 @@ func initCmd(c *commander.Command, inp []string) error {
}
cfg
.
Identity
.
PrivKey
=
base64
.
StdEncoding
.
EncodeToString
(
skbytes
)
id
,
err
:=
identify
.
I
d
FromPubKey
(
pk
)
id
,
err
:=
identify
.
I
D
FromPubKey
(
pk
)
if
err
!=
nil
{
return
err
}
...
...
identify/identify.go
View file @
b88ee287
//
Th
e identify
package
handles how peers identify with eachother upon
//
Packag
e identify handles how peers identify with eachother upon
// connection to the network
package
identify
...
...
@@ -31,7 +31,7 @@ var SupportedHashes = "SHA256,SHA512,SHA1"
// ErrUnsupportedKeyType is returned when a private key cast/type switch fails.
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)
func
Handshake
(
self
,
remote
*
peer
.
Peer
,
in
,
out
chan
[]
byte
)
(
chan
[]
byte
,
chan
[]
byte
,
error
)
{
// Generate and send Hello packet.
...
...
@@ -74,7 +74,7 @@ func Handshake(self, remote *peer.Peer, in, out chan []byte) (chan []byte, chan
return
nil
,
nil
,
err
}
remote
.
ID
,
err
=
I
d
FromPubKey
(
remote
.
PubKey
)
remote
.
ID
,
err
=
I
D
FromPubKey
(
remote
.
PubKey
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
@@ -238,8 +238,8 @@ func secureOutProxy(out, secureOut chan []byte, hashType string, mIV, mCKey, mMK
out
<-
buff
}
}
func
I
d
FromPubKey
(
pk
ci
.
PubKey
)
(
peer
.
ID
,
error
)
{
// IDFromPubKey returns Nodes ID given its public key
func
I
D
FromPubKey
(
pk
ci
.
PubKey
)
(
peer
.
ID
,
error
)
{
b
,
err
:=
pk
.
Bytes
()
if
err
!=
nil
{
return
nil
,
err
...
...
identify/identify_test.go
View file @
b88ee287
...
...
@@ -20,7 +20,7 @@ func TestHandshake(t *testing.T) {
cha
:=
make
(
chan
[]
byte
,
5
)
chb
:=
make
(
chan
[]
byte
,
5
)
ida
,
err
:=
I
d
FromPubKey
(
pka
)
ida
,
err
:=
I
D
FromPubKey
(
pka
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
@@ -30,7 +30,7 @@ func TestHandshake(t *testing.T) {
PrivKey
:
ska
,
}
idb
,
err
:=
I
d
FromPubKey
(
pkb
)
idb
,
err
:=
I
D
FromPubKey
(
pkb
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
routing/dht/dht_test.go
View file @
b88ee287
...
...
@@ -35,7 +35,7 @@ func setupDHTS(n int, t *testing.T) ([]*ma.Multiaddr, []*peer.Peer, []*IpfsDHT)
}
p
.
PubKey
=
pk
p
.
PrivKey
=
sk
id
,
err
:=
identify
.
I
d
FromPubKey
(
pk
)
id
,
err
:=
identify
.
I
D
FromPubKey
(
pk
)
if
err
!=
nil
{
panic
(
err
)
}
...
...
@@ -67,7 +67,7 @@ func makePeer(addr *ma.Multiaddr) *peer.Peer {
}
p
.
PrivKey
=
sk
p
.
PubKey
=
pk
id
,
err
:=
identify
.
I
d
FromPubKey
(
pk
)
id
,
err
:=
identify
.
I
D
FromPubKey
(
pk
)
if
err
!=
nil
{
panic
(
err
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment