mtcp

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2019 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MaxReceivePacketSize = 1452 // MTU(1500) - IPv6 - UDP
	HeaderSize           = 32
	MaxSegmentSize       = MaxReceivePacketSize - HeaderSize
	DefaultRcvWnd        = 4096
)

Variables

View Source
var (
	ErrTimeout           = errors.New("operation timed out")
	ErrConnectionAborted = errors.New("connection aborted")
	ErrConnectionClosed  = errors.New("connection closed")
	ErrClosedForSend     = errors.New("connection is closed for send")
	ErrClosedForReceive  = errors.New("connection is closed for receive")
	ErrConnectionReset   = errors.New("connection reset by peer")
	ErrNoCipher          = errors.New("cipher is nil")
	ErrIllegalSegment    = errors.New("illegal segment")
)

Functions

This section is empty.

Types

type BytesPool

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

func NewBytesPool

func NewBytesPool(space int) *BytesPool

func (*BytesPool) Get

func (p *BytesPool) Get() []byte

func (*BytesPool) Put

func (p *BytesPool) Put(b []byte)

type Cipher

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

func NewCipher

func NewCipher(key []byte) (c *Cipher, err error)

func (*Cipher) Clone

func (c *Cipher) Clone(flag CipherFlag) *Cipher

func (*Cipher) Decrypt

func (c *Cipher) Decrypt(out []byte, input []byte)

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(out []byte, input []byte)

type CipherFlag

type CipherFlag int
const (
	FlagEncrypt CipherFlag = 1 << iota
	FlagDecrypt
)

type Conn

type Conn = endpoint

func Dial

func Dial(address string, cipher *Cipher) (c *Conn, err error)

type Listener

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

func Listen

func Listen(address string, cipher *Cipher, backlog int) (l *Listener, err error)

func (*Listener) Accept

func (l *Listener) Accept() (c *Conn, err error)

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

func (*Listener) Close

func (l *Listener) Close() error

func (*Listener) Remove

func (l *Listener) Remove(conn *Conn)

func (*Listener) SetReadBuffer

func (l *Listener) SetReadBuffer(bytes int) error

func (*Listener) SetWriteBuffer

func (l *Listener) SetWriteBuffer(bytes int) error

Jump to

Keyboard shortcuts

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