Commit b88ee287 authored by Siraj Ravel's avatar Siraj Ravel

golint cleanup

parent c370fc50
......@@ -68,7 +68,7 @@ func initCmd(c *commander.Command, inp []string) error {
}
cfg.Identity.PrivKey = base64.StdEncoding.EncodeToString(skbytes)
id, err := identify.IdFromPubKey(pk)
id, err := identify.IDFromPubKey(pk)
if err != nil {
return err
}
......
// The identify package handles how peers identify with eachother upon
// Package 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
// Performs 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 = IdFromPubKey(remote.PubKey)
remote.ID, err = IDFromPubKey(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 IdFromPubKey(pk ci.PubKey) (peer.ID, error) {
// IDFromPubKey returns Nodes ID given its public key
func IDFromPubKey(pk ci.PubKey) (peer.ID, error) {
b, err := pk.Bytes()
if err != nil {
return nil, err
......
......@@ -20,7 +20,7 @@ func TestHandshake(t *testing.T) {
cha := make(chan []byte, 5)
chb := make(chan []byte, 5)
ida, err := IdFromPubKey(pka)
ida, err := IDFromPubKey(pka)
if err != nil {
t.Fatal(err)
}
......@@ -30,7 +30,7 @@ func TestHandshake(t *testing.T) {
PrivKey: ska,
}
idb, err := IdFromPubKey(pkb)
idb, err := IDFromPubKey(pkb)
if err != nil {
t.Fatal(err)
}
......
......@@ -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.IdFromPubKey(pk)
id, err := identify.IDFromPubKey(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.IdFromPubKey(pk)
id, err := identify.IDFromPubKey(pk)
if err != nil {
panic(err)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment