From 1386205f7ad6f645f7cb78a33dc03cd4916b3813 Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Sat, 13 Sep 2014 01:34:26 -0700 Subject: [PATCH] chore(identify) move private func to bottom of file --- identify/identify.go | 48 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/identify/identify.go b/identify/identify.go index bb11686e2..01e629baf 100644 --- a/identify/identify.go +++ b/identify/identify.go @@ -31,30 +31,6 @@ var SupportedHashes = "SHA256,SHA512,SHA1" // ErrUnsupportedKeyType is returned when a private key cast/type switch fails. var ErrUnsupportedKeyType = errors.New("unsupported key type") -func genRandHello(self *peer.Peer) (*Hello, error) { - hello := new(Hello) - - // Generate and send Hello packet. - // Hello = (rand, PublicKey, Supported) - nonce := make([]byte, 16) - _, err := rand.Read(nonce) - if err != nil { - return nil, err - } - - myPubKey, err := self.PubKey.Bytes() - if err != nil { - return nil, err - } - - hello.Rand = nonce - hello.Pubkey = myPubKey - hello.Exchanges = &SupportedExchanges - hello.Ciphers = &SupportedCiphers - hello.Hashes = &SupportedHashes - return hello, nil -} - // Performs initial communication with this peer to share node ID's and // initiate communication. (secureIn, secureOut, error) func Handshake(self, remote *peer.Peer, in <-chan []byte, out chan<- []byte) (<-chan []byte, chan<- []byte, error) { @@ -322,3 +298,27 @@ func selectBest(myPrefs, theirPrefs string) (string, error) { return "", errors.New("No algorithms in common!") } + +func genRandHello(self *peer.Peer) (*Hello, error) { + hello := new(Hello) + + // Generate and send Hello packet. + // Hello = (rand, PublicKey, Supported) + nonce := make([]byte, 16) + _, err := rand.Read(nonce) + if err != nil { + return nil, err + } + + myPubKey, err := self.PubKey.Bytes() + if err != nil { + return nil, err + } + + hello.Rand = nonce + hello.Pubkey = myPubKey + hello.Exchanges = &SupportedExchanges + hello.Ciphers = &SupportedCiphers + hello.Hashes = &SupportedHashes + return hello, nil +}