]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/cypherpunks.ru/govpn/handshake.go
Various stylistic and grammar fixes
[govpn.git] / src / cypherpunks.ru / govpn / handshake.go
index a824acef902629fcb16515eb8011f6294e00519f..27057708f9149f6c236643b9344ff3f5060e19f7 100644 (file)
@@ -33,10 +33,13 @@ import (
 )
 
 const (
+       // RSize is size in bytes of channel binding random value
        RSize = 8
+       // SSize is size in bytes of shared secret half
        SSize = 32
 )
 
+// Handshake is state of a handshake/negotiation between client and server
 type Handshake struct {
        addr     string
        conn     io.Writer
@@ -116,7 +119,7 @@ func dhKeyGen(priv, pub *[32]byte) *[32]byte {
        return &hashed
 }
 
-// Create new handshake state.
+// NewHandshake creates new handshake state.
 func NewHandshake(addr string, conn io.Writer, conf *PeerConf) *Handshake {
        state := Handshake{
                addr:     addr,
@@ -145,8 +148,8 @@ func idTag(id *PeerID, timeSync int, data []byte) []byte {
        return sum[len(sum)-8:]
 }
 
-// Start handshake's procedure from the client. It is the entry point
-// for starting the handshake procedure.
+// HandshakeStarts start handshake's procedure from the client.
+// It is the entry point for starting the handshake procedure.
 // First handshake packet will be sent immediately.
 func HandshakeStart(addr string, conn io.Writer, conf *PeerConf) *Handshake {
        state := NewHandshake(addr, conn, conf)
@@ -179,7 +182,7 @@ func HandshakeStart(addr string, conn io.Writer, conf *PeerConf) *Handshake {
        return state
 }
 
-// Process handshake message on the server side.
+// Server processes handshake message on the server side.
 // This function is intended to be called on server's side.
 // If this is the final handshake message, then new Peer object
 // will be created and used as a transport. If no mutually
@@ -333,7 +336,7 @@ func (h *Handshake) Server(data []byte) *Peer {
        return nil
 }
 
-// Process handshake message on the client side.
+// Client processes handshake message on the client side.
 // This function is intended to be called on client's side.
 // If this is the final handshake message, then new Peer object
 // will be created and used as a transport. If no mutually