go.crypto/ssh: run gofmt

gofmt got better at removing trailing whitespace.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6929044
This commit is contained in:
Adam Langley
2012-12-10 18:12:36 -05:00
parent 887809b6be
commit 4002be2701
12 changed files with 29 additions and 29 deletions
+2 -2
View File
@@ -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) {
+2 -2
View File
@@ -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) {
+1 -1
View File
@@ -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 {
+2 -2
View File
@@ -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)
+4 -4
View File
@@ -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()
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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"}
+3 -3
View File
@@ -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()
+1 -1
View File
@@ -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,
+2 -2
View File
@@ -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)
+7 -7
View File
@@ -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
+2 -2
View File
@@ -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
)