diff options
| author | Ondřej Surý <ondrej@sury.org> | 2012-01-30 15:38:19 +0100 | 
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2012-01-30 16:31:40 +0100 | 
| commit | 3e609a8872e69b2df7447de5f308a5d4340f1cbf (patch) | |
| tree | f49969bc8ba81dd1d3869bd6747ca8b8b7d403fc /src/pkg/exp/ssh/doc.go | |
| parent | e0329b098725bc398083bfb04691a257d8ee6a25 (diff) | |
| download | golang-3e609a8872e69b2df7447de5f308a5d4340f1cbf.tar.gz | |
Imported Upstream version 2012.01.27
Diffstat (limited to 'src/pkg/exp/ssh/doc.go')
| -rw-r--r-- | src/pkg/exp/ssh/doc.go | 79 | 
1 files changed, 0 insertions, 79 deletions
| diff --git a/src/pkg/exp/ssh/doc.go b/src/pkg/exp/ssh/doc.go deleted file mode 100644 index 54a7ba9fd..000000000 --- a/src/pkg/exp/ssh/doc.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Package ssh implements an SSH server. - -SSH is a transport security protocol, an authentication protocol and a -family of application protocols. The most typical application level -protocol is a remote shell and this is specifically implemented.  However, -the multiplexed nature of SSH is exposed to users that wish to support -others. - -An SSH server is represented by a Server, which manages a number of -ServerConnections and handles authentication. - -	var s Server -	s.PubKeyCallback = pubKeyAuth -	s.PasswordCallback = passwordAuth - -	pemBytes, err := ioutil.ReadFile("id_rsa") -	if err != nil { -		panic("Failed to load private key") -	} -	err = s.SetRSAPrivateKey(pemBytes) -	if err != nil { -		panic("Failed to parse private key") -	} - -Once a Server has been set up, connections can be attached. - -	var sConn ServerConnection -	sConn.Server = &s -	err = sConn.Handshake(conn) -	if err != nil { -		panic("failed to handshake") -	} - -An SSH connection multiplexes several channels, which must be accepted themselves: - - -	for { -		channel, err := sConn.Accept() -		if err != nil { -			panic("error from Accept") -		} - -		... -	} - -Accept reads from the connection, demultiplexes packets to their corresponding -channels and returns when a new channel request is seen. Some goroutine must -always be calling Accept; otherwise no messages will be forwarded to the -channels. - -Channels have a type, depending on the application level protocol intended. In -the case of a shell, the type is "session" and ServerShell may be used to -present a simple terminal interface. - -	if channel.ChannelType() != "session" { -		c.Reject(UnknownChannelType, "unknown channel type") -		return -	} -	channel.Accept() - -	shell := NewServerShell(channel, "> ") -	go func() { -		defer channel.Close() -		for { -			line, err := shell.ReadLine() -			if err != nil { -				break -			} -			println(line) -		} -		return -	}() -*/ -package ssh | 
