Documentation ¶
Index ¶
- func AddMLI(mliType MliType, data []byte) []byte
- func HandleError(err error)
- type EchoServ
- type MliType
- type NetCatClient
- func (nt *NetCatClient) Close()
- func (nt *NetCatClient) IsConnected() bool
- func (nt *NetCatClient) OpenConnection() (err error)
- func (nt *NetCatClient) Read(opts *ReadOptions) ([]byte, error)
- func (nt *NetCatClient) ReadDirect(data []byte) (n int, err error)
- func (nt *NetCatClient) ReadNextPacket() ([]byte, error)deprecated
- func (nt *NetCatClient) Write(data []byte) (err error)
- type ReadOptions
- type TcpHost
- type TcpMessageHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleError ¶
func HandleError(err error)
Types ¶
type EchoServ ¶
func (*EchoServ) ListenAndAccept ¶
type NetCatClient ¶
type NetCatClient struct {
// contains filtered or unexported fields
}
NetCatClient is network TCP client that can be used to send/receive length-delimited messages like 2E,2I, 4E, 4I, 4AE, 4AI etc
func NewNetCatClient ¶
func NewNetCatClient(addr string, mliType MliType) *NetCatClient
NewNetCatClient returns a new netcat client associated with the given mli-type and connecting to the addr
func (*NetCatClient) Close ¶
func (nt *NetCatClient) Close()
Close closes the client side of the connection
func (*NetCatClient) IsConnected ¶
func (nt *NetCatClient) IsConnected() bool
func (*NetCatClient) OpenConnection ¶
func (nt *NetCatClient) OpenConnection() (err error)
OpenConnection opens a connection to the server
func (*NetCatClient) Read ¶
func (nt *NetCatClient) Read(opts *ReadOptions) ([]byte, error)
func (*NetCatClient) ReadDirect ¶ added in v1.0.3
func (nt *NetCatClient) ReadDirect(data []byte) (n int, err error)
ReadDirect reads requested data from the socket directly. Use this with caution because the caller is responsible for reading length prefix and knowing when one packet starts and ends
func (*NetCatClient) ReadNextPacket
deprecated
func (nt *NetCatClient) ReadNextPacket() ([]byte, error)
ReadNextPacket reads the next data segment (as per MLI type associated with nt)
Deprecated:: Please use Read(*ReadOptions)
func (*NetCatClient) Write ¶
func (nt *NetCatClient) Write(data []byte) (err error)
Write writes data into the socket after adding the necessary length prefix as per the MLI type set on the netcat client
type ReadOptions ¶ added in v1.0.3
ReadOptions are set of options that can be associated with a connection
type TcpHost ¶
type TcpHost struct {
// contains filtered or unexported fields
}
func (*TcpHost) SetHandler ¶
func (tcpHost *TcpHost) SetHandler(handler TcpMessageHandler)