ukcp

package module
v0.0.0-...-2197508 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2015 License: Apache-2.0, MIT Imports: 6 Imported by: 0

README

ukcp

kcp协议的udp封装

Documentation

Index

Constants

View Source
const (
	Reset     byte = 0
	FirstSYN  byte = 6
	FirstACK  byte = 1
	SndSYN    byte = 2
	SndACK    byte = 2
	Data      byte = 4
	Ping      byte = 5
	Close     byte = 7
	CloseBack byte = 8
	ResetAck  byte = 9
)
View Source
const ReadBufferSize = 7000 //so reader must be larger
View Source
const WriteBufferSize = 5000 //udp writer will add some data for checksum or encrypt

Variables

This section is empty.

Functions

func GetId

func GetId(name string) int

func RmId

func RmId(name string, id int)

Types

type Action

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

type Listener

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

func Listen

func Listen(addr string) (*Listener, error)

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

func (*Listener) Addr

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

func (*Listener) Close

func (l *Listener) Close() error

func (*Listener) Dump

func (l *Listener) Dump()

type UDPMakeSession

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

func Dial

func Dial(addr string) (*UDPMakeSession, error)

func DialTimeout

func DialTimeout(addr string, timeout int) (*UDPMakeSession, error)

func (*UDPMakeSession) Close

func (session *UDPMakeSession) Close() error

func (*UDPMakeSession) DoAction

func (session *UDPMakeSession) DoAction(action string, args ...interface{})

func (*UDPMakeSession) DoAction2

func (session *UDPMakeSession) DoAction2(action string, args ...interface{})

func (*UDPMakeSession) DoWrite

func (session *UDPMakeSession) DoWrite(s []byte) bool

func (*UDPMakeSession) LocalAddr

func (session *UDPMakeSession) LocalAddr() net.Addr

func (*UDPMakeSession) Read

func (session *UDPMakeSession) Read(p []byte) (n int, err error)

udp read does not relay on the len(p), please make a big enough array to cache data

func (*UDPMakeSession) RemoteAddr

func (session *UDPMakeSession) RemoteAddr() net.Addr

func (*UDPMakeSession) SetDeadline

func (session *UDPMakeSession) SetDeadline(t time.Time) error

func (*UDPMakeSession) SetReadDeadline

func (session *UDPMakeSession) SetReadDeadline(t time.Time) error

func (*UDPMakeSession) SetWriteDeadline

func (session *UDPMakeSession) SetWriteDeadline(t time.Time) error

func (*UDPMakeSession) Write

func (session *UDPMakeSession) Write(b []byte) (n int, err error)

Directories

Path Synopsis
===================================================================== KCP - A Better ARQ Protocol Implementation skywind3000 (at) gmail.com, 2010-2011 Features: + Average RTT reduce 30% - 40% vs traditional ARQ like tcp.
===================================================================== KCP - A Better ARQ Protocol Implementation skywind3000 (at) gmail.com, 2010-2011 Features: + Average RTT reduce 30% - 40% vs traditional ARQ like tcp.

Jump to

Keyboard shortcuts

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