diff --git a/ssh/buffer.go b/ssh/buffer.go index b089089..601dad3 100644 --- a/ssh/buffer.go +++ b/ssh/buffer.go @@ -50,7 +50,7 @@ func (b *buffer) write(buf []byte) { b.Cond.Signal() } -// eof closes the buffer. Reads from the buffer once all +// eof closes the buffer. Reads from the buffer once all // the data has been consumed will receive os.EOF. func (b *buffer) eof() error { b.Cond.L.Lock() @@ -60,7 +60,7 @@ func (b *buffer) eof() error { return nil } -// Read reads data from the internal buffer in buf. +// Read reads data from the internal buffer in buf. // Reads will block if no data is available, or until // the buffer is closed. func (b *buffer) Read(buf []byte) (n int, err error) { diff --git a/ssh/client.go b/ssh/client.go index 12e1bec..a4daa24 100644 --- a/ssh/client.go +++ b/ssh/client.go @@ -384,7 +384,7 @@ func (c *ClientConn) sendGlobalRequest(m interface{}) (*globalRequestSuccessMsg, return nil, errors.New("request failed") } -// sendConnectionFailed rejects an incoming channel identified +// sendConnectionFailed rejects an incoming channel identified // by remoteId. func (c *ClientConn) sendConnectionFailed(remoteId uint32) error { m := channelOpenFailureMsg{ @@ -396,7 +396,7 @@ func (c *ClientConn) sendConnectionFailed(remoteId uint32) error { return c.writePacket(marshal(msgChannelOpenFailure, m)) } -// parseTCPAddr parses the originating address from the remote into a *net.TCPAddr. +// parseTCPAddr parses the originating address from the remote into a *net.TCPAddr. // RFC 4254 section 7.2 is mute on what to do if parsing fails but the forwardlist // requires a valid *net.TCPAddr to operate, so we enforce that restriction here. func parseTCPAddr(b []byte) (*net.TCPAddr, []byte, bool) { diff --git a/ssh/client_auth.go b/ssh/client_auth.go index 21984a1..2422722 100644 --- a/ssh/client_auth.go +++ b/ssh/client_auth.go @@ -358,7 +358,7 @@ func (kr *agentKeyring) Sign(i int, rand io.Reader, data []byte) (sig []byte, er return } - // Unmarshal the signature. + // Unmarshal the signature. var ok bool if _, sig, ok = parseString(sig); !ok { diff --git a/ssh/client_auth_test.go b/ssh/client_auth_test.go index d4002c6..1613e75 100644 --- a/ssh/client_auth_test.go +++ b/ssh/client_auth_test.go @@ -149,8 +149,8 @@ func init() { dsakey.X, _ = new(big.Int).SetString("5078D4D29795CBE76D3AACFE48C9AF0BCDBEE91A", 16) } -// newMockAuthServer creates a new Server bound to -// the loopback interface. The server exits after +// newMockAuthServer creates a new Server bound to +// the loopback interface. The server exits after // processing one handshake. func newMockAuthServer(t *testing.T) string { l, err := Listen("tcp", "127.0.0.1:0", serverConfig) diff --git a/ssh/common.go b/ssh/common.go index f62b255..8709d2a 100644 --- a/ssh/common.go +++ b/ssh/common.go @@ -272,7 +272,7 @@ func buildDataSignedForAuth(sessionId []byte, req userAuthRequestMsg, algo, pubK return ret } -// safeString sanitises s according to RFC 4251, section 9.2. +// safeString sanitises s according to RFC 4251, section 9.2. // All control characters except tab, carriage return and newline are // replaced by 0x20. func safeString(s string) string { @@ -297,11 +297,11 @@ func appendInt(buf []byte, n int) []byte { return appendU32(buf, uint32(n)) } -// newCond is a helper to hide the fact that there is no usable zero +// newCond is a helper to hide the fact that there is no usable zero // value for sync.Cond. func newCond() *sync.Cond { return sync.NewCond(new(sync.Mutex)) } -// window represents the buffer available to clients +// window represents the buffer available to clients // wishing to write to a channel. type window struct { *sync.Cond @@ -322,7 +322,7 @@ func (w *window) add(win uint32) bool { } w.win += win // It is unusual that multiple goroutines would be attempting to reserve - // window space, but not guaranteed. Use broadcast to notify all waiters + // window space, but not guaranteed. Use broadcast to notify all waiters // that additional window is available. w.Broadcast() w.L.Unlock() diff --git a/ssh/example_test.go b/ssh/example_test.go index 54f3610..715afb3 100644 --- a/ssh/example_test.go +++ b/ssh/example_test.go @@ -45,7 +45,7 @@ func ExampleListen() { panic("failed to handshake") } - // A ServerConn multiplexes several channels, which must + // A ServerConn multiplexes several channels, which must // themselves be Accepted. for { // Accept reads from the connection, demultiplexes packets diff --git a/ssh/mac.go b/ssh/mac.go index 5b1922d..6862d3e 100644 --- a/ssh/mac.go +++ b/ssh/mac.go @@ -43,8 +43,8 @@ func (t truncatingMAC) Size() int { func (t truncatingMAC) BlockSize() int { return t.hmac.BlockSize() } -// Specifies a default set of MAC algorithms and a preference order. -// This is based on RFC 4253, section 6.4, with the removal of the +// Specifies a default set of MAC algorithms and a preference order. +// This is based on RFC 4253, section 6.4, with the removal of the // hmac-md5 variants as they have reached the end of their useful life. var DefaultMACOrder = []string{"hmac-sha1", "hmac-sha1-96"} diff --git a/ssh/server.go b/ssh/server.go index f359044..110fd12 100644 --- a/ssh/server.go +++ b/ssh/server.go @@ -23,8 +23,8 @@ type ServerConfig struct { rsa *rsa.PrivateKey rsaSerialized []byte - // Rand provides the source of entropy for key exchange. If Rand is - // nil, the cryptographic random reader in package crypto/rand will + // Rand provides the source of entropy for key exchange. If Rand is + // nil, the cryptographic random reader in package crypto/rand will // be used. Rand io.Reader @@ -674,7 +674,7 @@ func (l *Listener) Close() error { } // Accept waits for and returns the next incoming SSH connection. -// The receiver should call Handshake() in another goroutine +// The receiver should call Handshake() in another goroutine // to avoid blocking the accepter. func (l *Listener) Accept() (*ServerConn, error) { c, err := l.listener.Accept() diff --git a/ssh/session.go b/ssh/session.go index 5eb3cc3..ac96d52 100644 --- a/ssh/session.go +++ b/ssh/session.go @@ -210,7 +210,7 @@ func (s *Session) RequestPty(term string, h, w int, termmodes TerminalModes) err } // RequestSubsystem requests the association of a subsystem with the session on the remote host. -// A subsystem is a predefined command that runs in the background when the ssh session is initiated +// A subsystem is a predefined command that runs in the background when the ssh session is initiated func (s *Session) RequestSubsystem(subsystem string) error { req := subsystemRequestMsg{ PeersId: s.remoteId, diff --git a/ssh/session_test.go b/ssh/session_test.go index cfd8971..0c64ed2 100644 --- a/ssh/session_test.go +++ b/ssh/session_test.go @@ -301,7 +301,7 @@ func TestInvalidServerMessage(t *testing.T) { defer session.Close() } -// In the wild some clients (and servers) send zero sized window updates. +// In the wild some clients (and servers) send zero sized window updates. // Test that the client can continue after receiving a zero sized update. func TestClientZeroWindowAdjust(t *testing.T) { conn := dial(sendZeroWindowAdjust, t) @@ -321,7 +321,7 @@ func TestClientZeroWindowAdjust(t *testing.T) { } } -// In the wild some clients (and servers) send zero sized window updates. +// In the wild some clients (and servers) send zero sized window updates. // Test that the server can continue after receiving a zero size update. func TestServerZeroWindowAdjust(t *testing.T) { conn := dial(exitStatusZeroHandler, t) diff --git a/ssh/tcpip.go b/ssh/tcpip.go index 69619ac..c3f16b9 100644 --- a/ssh/tcpip.go +++ b/ssh/tcpip.go @@ -13,7 +13,7 @@ import ( "time" ) -// Listen requests the remote peer open a listening socket +// Listen requests the remote peer open a listening socket // on addr. Incoming connections will be available by calling // Accept on the returned net.Listener. func (c *ClientConn) Listen(n, addr string) (net.Listener, error) { @@ -32,7 +32,7 @@ type channelForwardMsg struct { rport uint32 } -// ListenTCP requests the remote peer open a listening socket +// ListenTCP requests the remote peer open a listening socket // on laddr. Incoming connections will be available by calling // Accept on the returned net.Listener. func (c *ClientConn) ListenTCP(laddr *net.TCPAddr) (net.Listener, error) { @@ -62,14 +62,14 @@ func (c *ClientConn) ListenTCP(laddr *net.TCPAddr) (net.Listener, error) { return &tcpListener{laddr, c, ch}, nil } -// forwardList stores a mapping between remote +// forwardList stores a mapping between remote // forward requests and the tcpListeners. type forwardList struct { sync.Mutex entries []forwardEntry } -// forwardEntry represents an established mapping of a laddr on a +// forwardEntry represents an established mapping of a laddr on a // remote ssh server to a channel connected to a tcpListener. type forwardEntry struct { laddr *net.TCPAddr @@ -159,8 +159,8 @@ func (l *tcpListener) Addr() net.Addr { } // Dial initiates a connection to the addr from the remote host. -// addr is resolved using net.ResolveTCPAddr before connection. -// This could allow an observer to observe the DNS name of the +// addr is resolved using net.ResolveTCPAddr before connection. +// This could allow an observer to observe the DNS name of the // remote host. Consider using ssh.DialTCP to avoid this. func (c *ClientConn) Dial(n, addr string) (net.Conn, error) { raddr, err := net.ResolveTCPAddr(n, addr) @@ -237,7 +237,7 @@ type tcpChan struct { io.Writer } -// tcpChanConn fulfills the net.Conn interface without +// tcpChanConn fulfills the net.Conn interface without // the tcpChan having to hold laddr or raddr directly. type tcpChanConn struct { *tcpChan diff --git a/ssh/transport.go b/ssh/transport.go index 5bdd6dc..c222caf 100644 --- a/ssh/transport.go +++ b/ssh/transport.go @@ -23,8 +23,8 @@ const ( // RFC 4253 section 6.1 defines a minimum packet size of 32768 that implementations // MUST be able to process (plus a few more kilobytes for padding and mac). The RFC // indicates implementations SHOULD be able to handle larger packet sizes, but then - // waffles on about reasonable limits. - // + // waffles on about reasonable limits. + // // OpenSSH caps their maxPacket at 256kb so we choose to do the same. maxPacket = 256 * 1024 )