Documentation ¶
Index ¶
Constants ¶
View Source
const ( // MaxPayloadSize is the maximum size of a single TCP payload // before encryption. It may include a padding inside. MaxPayloadSize = 1024 * 16 // PayloadOverhead is the overhead of decrypted payload. // This overhead contains 2 bytes of useful payload length and 2 bytes of // useful + padding payload length. PayloadOverhead = 4 )
Variables ¶
View Source
var ( // Number of TCP receive errors. TCPReceiveErrors = metrics.RegisterMetric("errors", "TCPReceiveErrors") // Number of TCP send errors. TCPSendErrors = metrics.RegisterMetric("errors", "TCPSendErrors") )
Functions ¶
func DialWithOptionsReturnConn ¶
func DialWithOptionsReturnConn(ctx context.Context, network, laddr, raddr string, block cipher.BlockCipher) (net.Conn, error)
DialWithOptionsReturnConn calls DialWithOptions and returns a generic net.Conn.
Types ¶
type TCPSession ¶
type TCPSession struct { net.Conn // the network connection associated to the TCPSession // contains filtered or unexported fields }
TCPSession defines a TCP session.
func DialWithOptions ¶
func DialWithOptions(ctx context.Context, network, laddr, raddr string, block cipher.BlockCipher) (*TCPSession, error)
DialWithOptions connects to the remote address "raddr" on the network "tcp" with packet encryption. If "laddr" is empty, an automatic address is used. "block" is the block encryption algorithm to encrypt packets.
func (*TCPSession) Close ¶
func (s *TCPSession) Close() error
Close overrides the Close() method in the net.Conn interface.
type TCPSessionListener ¶
func ListenWithOptions ¶
ListenWithOptions creates a new TCPSession listener.
func (*TCPSessionListener) Accept ¶
func (l *TCPSessionListener) Accept() (net.Conn, error)
Accept implements the Accept() method in the net.Listener interface.
func (*TCPSessionListener) Addr ¶
func (l *TCPSessionListener) Addr() net.Addr
Addr returns the listener's network address.
func (*TCPSessionListener) Close ¶
func (l *TCPSessionListener) Close() error
Close closes the session manager.
func (*TCPSessionListener) Start ¶
func (l *TCPSessionListener) Start()
Start starts to accept incoming TCP connections.
Click to show internal directories.
Click to hide internal directories.