serial

package
v1.5.2-dev Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableTracing

func DisableTracing()

DisableTracing disables trace output for the serial package

func EnableTracing

func EnableTracing()

EnableTracing enables 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

func ReadAtLeastN(conn io.ReadWriter, buffer []byte, l int) ([]byte, error)

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

type RawAddr struct {
	Net  string
	Addr string
}

func NewRawAddr

func NewRawAddr(net string, addr string) *RawAddr

func (RawAddr) Network

func (addr RawAddr) Network() string

func (RawAddr) String

func (addr RawAddr) String() string

type RawConn

type RawConn struct {
	// contains filtered or unexported fields
}

func NewFileConn

func NewFileConn(file *os.File) (*RawConn, error)

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

func NewRawConn(fd uintptr, name string, net string) (*RawConn, error)

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) Close

func (conn *RawConn) Close() error

Close closes the connection.

func (*RawConn) LocalAddr

func (conn *RawConn) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (*RawConn) Read

func (conn *RawConn) Read(b []byte) (int, error)

Read reads data from the connection.

func (*RawConn) RemoteAddr

func (conn *RawConn) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (*RawConn) SetDeadline

func (conn *RawConn) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines associated with the connection

func (*RawConn) SetReadDeadline

func (conn *RawConn) SetReadDeadline(t time.Time) error

SetReadDeadline sets the deadline for future Read calls.

func (*RawConn) SetWriteDeadline

func (conn *RawConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the deadline for future Write calls.

func (*RawConn) Write

func (conn *RawConn) Write(b []byte) (int, error)

Write writes data to the connection

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL