brontide: fix typo

This commit is contained in:
yyforyongyu 2020-11-30 20:48:39 +08:00
parent eb1affd5da
commit e06768e4eb
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
3 changed files with 12 additions and 12 deletions

View File

@ -62,8 +62,8 @@ func Dial(local keychain.SingleKeyECDH, netAddr *lnwire.NetAddress,
} }
// We'll ensure that we get ActTwo from the remote peer in a timely // We'll ensure that we get ActTwo from the remote peer in a timely
// manner. If they don't respond within 1s, then we'll kill the // manner. If they don't respond within handshakeReadTimeout, then
// connection. // we'll kill the connection.
err = conn.SetReadDeadline(time.Now().Add(handshakeReadTimeout)) err = conn.SetReadDeadline(time.Now().Add(handshakeReadTimeout))
if err != nil { if err != nil {
b.conn.Close() b.conn.Close()
@ -229,7 +229,7 @@ func (c *Conn) Flush() (int, error) {
return c.noise.Flush(c.conn) return c.noise.Flush(c.conn)
} }
// Close closes the connection. Any blocked Read or Write operations will be // Close closes the connection. Any blocked Read or Write operations will be
// unblocked and return errors. // unblocked and return errors.
// //
// Part of the net.Conn interface. // Part of the net.Conn interface.
@ -261,7 +261,7 @@ func (c *Conn) SetDeadline(t time.Time) error {
return c.conn.SetDeadline(t) return c.conn.SetDeadline(t)
} }
// SetReadDeadline sets the deadline for future Read calls. A zero value for t // SetReadDeadline sets the deadline for future Read calls. A zero value for t
// means Read will not time out. // means Read will not time out.
// //
// Part of the net.Conn interface. // Part of the net.Conn interface.
@ -269,9 +269,9 @@ func (c *Conn) SetReadDeadline(t time.Time) error {
return c.conn.SetReadDeadline(t) return c.conn.SetReadDeadline(t)
} }
// SetWriteDeadline sets the deadline for future Write calls. Even if write // SetWriteDeadline sets the deadline for future Write calls. Even if write
// times out, it may return n > 0, indicating that some of the data was // times out, it may return n > 0, indicating that some of the data was
// successfully written. A zero value for t means Write will not time out. // successfully written. A zero value for t means Write will not time out.
// //
// Part of the net.Conn interface. // Part of the net.Conn interface.
func (c *Conn) SetWriteDeadline(t time.Time) error { func (c *Conn) SetWriteDeadline(t time.Time) error {

View File

@ -115,8 +115,8 @@ func (l *Listener) doHandshake(conn net.Conn) {
} }
// We'll ensure that we get ActOne from the remote peer in a timely // We'll ensure that we get ActOne from the remote peer in a timely
// manner. If they don't respond within 1s, then we'll kill the // manner. If they don't respond within handshakeReadTimeout, then
// connection. // we'll kill the connection.
err := conn.SetReadDeadline(time.Now().Add(handshakeReadTimeout)) err := conn.SetReadDeadline(time.Now().Add(handshakeReadTimeout))
if err != nil { if err != nil {
brontideConn.conn.Close() brontideConn.conn.Close()
@ -160,8 +160,8 @@ func (l *Listener) doHandshake(conn net.Conn) {
} }
// We'll ensure that we get ActTwo from the remote peer in a timely // We'll ensure that we get ActTwo from the remote peer in a timely
// manner. If they don't respond within 1 second, then we'll kill the // manner. If they don't respond within handshakeReadTimeout, then
// connection. // we'll kill the connection.
err = conn.SetReadDeadline(time.Now().Add(handshakeReadTimeout)) err = conn.SetReadDeadline(time.Now().Add(handshakeReadTimeout))
if err != nil { if err != nil {
brontideConn.conn.Close() brontideConn.conn.Close()

View File

@ -252,7 +252,7 @@ func (s *symmetricState) EncryptAndHash(plaintext []byte) []byte {
} }
// DecryptAndHash returns the authenticated decryption of the passed // DecryptAndHash returns the authenticated decryption of the passed
// ciphertext. When encrypting the handshake digest (h) is used as the // ciphertext. When encrypting the handshake digest (h) is used as the
// associated data to the AEAD cipher. // associated data to the AEAD cipher.
func (s *symmetricState) DecryptAndHash(ciphertext []byte) ([]byte, error) { func (s *symmetricState) DecryptAndHash(ciphertext []byte) ([]byte, error) {
plaintext, err := s.Decrypt(s.handshakeDigest[:], nil, ciphertext) plaintext, err := s.Decrypt(s.handshakeDigest[:], nil, ciphertext)
@ -870,7 +870,7 @@ func (b *Machine) ReadHeader(r io.Reader) (uint32, error) {
// ReadBody attempts to ready the next message body from the passed io.Reader. // ReadBody attempts to ready the next message body from the passed io.Reader.
// The provided buffer MUST be the length indicated by the packet length // The provided buffer MUST be the length indicated by the packet length
// returned by the preceding call to ReadHeader. In the case of an // returned by the preceding call to ReadHeader. In the case of an
// authentication eerror, a non-nil error is returned. // authentication error, a non-nil error is returned.
func (b *Machine) ReadBody(r io.Reader, buf []byte) ([]byte, error) { func (b *Machine) ReadBody(r io.Reader, buf []byte) ([]byte, error) {
// Next, using the length read from the packet header, read the // Next, using the length read from the packet header, read the
// encrypted packet itself into the buffer allocated by the read // encrypted packet itself into the buffer allocated by the read