Documentation ¶
Index ¶
- func DisableTracing()
- func EnableTracing()
- func HandshakeClient(conn io.ReadWriter) error
- func HandshakeServer(conn io.ReadWriter) error
- func ReadAtLeastN(conn io.ReadWriter, buffer []byte, l int) ([]byte, error)
- type HandshakeError
- type NamedReadChannel
- type NamedWriteChannel
- type RawAddr
- type RawConn
- func NewFileConn(file *os.File) (*RawConn, error)
- func NewHalfDuplexFileConn(read *os.File, write *os.File, name string, net string) (*RawConn, error)
- func NewRawConn(fd uintptr, name string, net string) (*RawConn, error)
- func NewTypedConn(r NamedReadChannel, w NamedWriteChannel, net string) (*RawConn, error)
- func (conn *RawConn) Close() error
- func (conn *RawConn) LocalAddr() net.Addr
- func (conn *RawConn) Read(b []byte) (int, error)
- func (conn *RawConn) RemoteAddr() net.Addr
- func (conn *RawConn) SetDeadline(t time.Time) error
- func (conn *RawConn) SetReadDeadline(t time.Time) error
- func (conn *RawConn) SetWriteDeadline(t time.Time) error
- func (conn *RawConn) Write(b []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableTracing ¶
func DisableTracing()
DisableTracing disables trace output for the serial package
func HandshakeClient ¶
func HandshakeClient(conn io.ReadWriter) error
HandshakeClient establishes connection with the server making sure they both are in sync.
func HandshakeServer ¶
func HandshakeServer(conn io.ReadWriter) error
HandshakeServer establishes connection with the client making sure they both are in sync.
func ReadAtLeastN ¶
ReadAtLeastN reads at least l bytes and returns those l bytes or errors We get lots of garbage data when we get the initial connection which handshake supposed to clear them and leave the connection in a known state so that the real ssh handshake can start. Client and server is looping with different frequencies so client could send multiple requests before server even had a chance to read. By getting the last l bytes we are saying that we are not interested with garbage data and also eliminating duplicated flags by only using the last one
Types ¶
type HandshakeError ¶
type HandshakeError struct {
// contains filtered or unexported fields
}
HandshakeError should only occure if the protocol between HandshakeServer and HandshakeClient was violated.
func (*HandshakeError) Error ¶
func (he *HandshakeError) Error() string
type NamedReadChannel ¶
type NamedReadChannel interface { io.ReadCloser Name() string Fd() uintptr }
type NamedWriteChannel ¶
type NamedWriteChannel interface { io.WriteCloser Name() string Fd() uintptr }
type RawAddr ¶
func NewRawAddr ¶
type RawConn ¶
type RawConn struct {
// contains filtered or unexported fields
}
func NewFileConn ¶
NewFileConn creates a connection of the provided file - assumes file is a full duplex comm mechanism
func NewHalfDuplexFileConn ¶
func NewHalfDuplexFileConn(read *os.File, write *os.File, name string, net string) (*RawConn, error)
NewHalfDuplexFileConn creates a connection via the provided files - this assumes that each file is a half-duplex mechanism, such as a linux fifo pipe
func NewRawConn ¶
NewRawConn creates a connection via the provided file descriptor - assumes file is a full duplex comm mechanism
func NewTypedConn ¶
func NewTypedConn(r NamedReadChannel, w NamedWriteChannel, net string) (*RawConn, error)
func (*RawConn) RemoteAddr ¶
RemoteAddr returns the remote network address.
func (*RawConn) SetDeadline ¶
SetDeadline sets the read and write deadlines associated with the connection
func (*RawConn) SetReadDeadline ¶
SetReadDeadline sets the deadline for future Read calls.
func (*RawConn) SetWriteDeadline ¶
SetWriteDeadline sets the deadline for future Write calls.