Documentation ¶
Overview ¶
Package versionhandshake wraps a transport.{Connecter,AuthenticatedListener} to add an exchange of protocol version information on connection establishment.
The protocol version information (banner) is plain text, thus making it easy to diagnose issues with standard tools.
Index ¶
Constants ¶
const HandshakeMessageMaxLen = 16 * 4096
const MaxProtocolVersion = 9999
MaxProtocolVersion is the maximum allowed protocol version. This is a protocol constant, changing it may break the wire format.
Variables ¶
This section is empty.
Functions ¶
func Listener ¶
func Listener(l transport.AuthenticatedListener, timeout time.Duration) transport.AuthenticatedListener
Types ¶
type HandshakeConnecter ¶
type HandshakeConnecter struct {
// contains filtered or unexported fields
}
type HandshakeError ¶
type HandshakeError struct { // If not nil, the underlying IO error that caused the handshake to fail. IOError error // contains filtered or unexported fields }
A HandshakeError describes what went wrong during the handshake. It implements net.Error and is always temporary.
func DoHandshakeCurrentVersion ¶
func DoHandshakeCurrentVersion(conn net.Conn, deadline time.Time) *HandshakeError
func DoHandshakeVersion ¶
func (HandshakeError) Error ¶
func (e HandshakeError) Error() string
func (HandshakeError) Temporary ¶
func (e HandshakeError) Temporary() bool
Like with net.OpErr (Go issue 6163), a client failing to handshake should be a temporary Accept error toward the Listener .
func (HandshakeError) Timeout ¶
func (e HandshakeError) Timeout() bool
If the underlying IOError was net.Error.Timeout(), Timeout() returns that value. Otherwise false.
type HandshakeListener ¶
type HandshakeListener struct {
// contains filtered or unexported fields
}
wrapper type that performs a a protocol version handshake before returning the connection
func (HandshakeListener) Addr ¶
func (l HandshakeListener) Addr() net.Addr
func (HandshakeListener) Close ¶
func (l HandshakeListener) Close() error
type HandshakeMessage ¶
func (*HandshakeMessage) DecodeReader ¶
func (m *HandshakeMessage) DecodeReader(r io.Reader, maxLen int) error
func (*HandshakeMessage) Encode ¶
func (m *HandshakeMessage) Encode() ([]byte, error)
Only returns *HandshakeError as error.