Documentation ¶
Index ¶
- Constants
- Variables
- type Connection
- func (c *Connection) Close() error
- func (c *Connection) LocalAddr() net.Addr
- func (c *Connection) Open(src net.IP, dst net.IP, port int) error
- func (conn *Connection) Read(b []byte) (n int, err error)
- func (c *Connection) Receive() chan []byte
- func (c *Connection) RemoteAddr() net.Addr
- func (c *Connection) SetDeadline(t time.Time) error
- func (c *Connection) SetReadDeadline(t time.Time) error
- func (c *Connection) SetWriteDeadline(t time.Time) error
- func (c *Connection) Write(b []byte) (n int, err error)
- type SocketState
- type Stack
- type State
- type StateTable
Constants ¶
const ( MaxEpollEvents = 64 DefaultBufferSize = 65535 )
Variables ¶
var ErrNoState = errors.New("No state for packet.")
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { Connected chan bool Src, Dst net.IP SourcePort, DestinationPort uint16 Recv chan []byte Stack *Stack // contains filtered or unexported fields }
func (*Connection) Close ¶
func (c *Connection) Close() error
Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.
func (*Connection) LocalAddr ¶
func (c *Connection) LocalAddr() net.Addr
LocalAddr returns the local network address.
func (*Connection) Read ¶
func (conn *Connection) Read(b []byte) (n int, err error)
Read reads data from the connection. Read can be made to time out and return a Error with Timeout() == true after a fixed time limit; see SetDeadline and SetReadDeadline.
func (*Connection) Receive ¶
func (c *Connection) Receive() chan []byte
func (*Connection) RemoteAddr ¶
func (c *Connection) RemoteAddr() net.Addr
RemoteAddr returns the remote network address.
func (*Connection) SetDeadline ¶
func (c *Connection) SetDeadline(t time.Time) error
SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.
A deadline is an absolute time after which I/O operations fail with a timeout (see type Error) instead of blocking. The deadline applies to all future I/O, not just the immediately following call to Read or Write.
An idle timeout can be implemented by repeatedly extending the deadline after successful Read or Write calls.
A zero value for t means I/O operations will not time out.
func (*Connection) SetReadDeadline ¶
func (c *Connection) SetReadDeadline(t time.Time) error
SetReadDeadline sets the deadline for future Read calls. A zero value for t means Read will not time out.
func (*Connection) SetWriteDeadline ¶
func (c *Connection) SetWriteDeadline(t time.Time) error
SetWriteDeadline sets the deadline for future Write calls. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.
type SocketState ¶
type SocketState int
const ( SocketClosed SocketState = iota SocketListen SocketSynReceived SocketSynSent SocketEstablished SocketFinWait1 SocketFinWait2 SocketClosing SocketTimeWait SocketCloseWait SocketLastAck )
func (SocketState) String ¶
func (ss SocketState) String() string
type StateTable ¶
type StateTable []*State
func (*StateTable) Add ¶
func (st *StateTable) Add(state *State)