X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Fhandshake.go;h=77b9365f5625b8083e87b5efb13085b7d54f3c25;hb=9f7abcad309afd709a1f16cdf961837bb9510036;hp=a824acef902629fcb16515eb8011f6294e00519f;hpb=0348b54d1c83feca398182e9a86a2a92ed428447;p=govpn.git diff --git a/src/cypherpunks.ru/govpn/handshake.go b/src/cypherpunks.ru/govpn/handshake.go index a824ace..77b9365 100644 --- a/src/cypherpunks.ru/govpn/handshake.go +++ b/src/cypherpunks.ru/govpn/handshake.go @@ -33,10 +33,13 @@ import ( ) const ( + // RSize TODO RSize = 8 + // SSize TODO 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 create new handshake state. func NewHandshake(addr string, conn io.Writer, conf *PeerConf) *Handshake { state := Handshake{ addr: addr, @@ -145,7 +148,7 @@ 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 +// HandshakeStart 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 { @@ -179,7 +182,7 @@ func HandshakeStart(addr string, conn io.Writer, conf *PeerConf) *Handshake { return state } -// Process handshake message on the server side. +// Server process 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 process 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