gkcp

package
v0.0.0-...-2bcc11b Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultSnmp

func DefaultSnmp() *kcp.Snmp

func Dial

func Dial(serverAddr string) (net.Conn, error)

Create new client connection and dial

func DialWithOptions

func DialWithOptions(serverAddr string, opt Option) (net.Conn, error)

Create new client connection and dial

Types

type Client

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

kcp client type

func (Client) Close

func (c Client) Close() error

func (Client) LocalAddr

func (c Client) LocalAddr() net.Addr

func (Client) Read

func (c Client) Read(buf []byte) (n int, err error)

func (Client) RemoteAddr

func (c Client) RemoteAddr() net.Addr

func (Client) SetDeadline

func (c Client) SetDeadline(t time.Time) error

func (Client) SetReadDeadline

func (c Client) SetReadDeadline(t time.Time) error

func (Client) SetWriteDeadline

func (c Client) SetWriteDeadline(t time.Time) error

func (Client) Write

func (c Client) Write(data []byte) (n int, err error)

type Dialer

type Dialer struct{}

func (Dialer) Dial

func (d Dialer) Dial(serverAddr string) (net.Conn, error)

type KcpConn

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

func (*KcpConn) Close

func (c *KcpConn) Close() error

func (*KcpConn) LocalAddr

func (c *KcpConn) LocalAddr() net.Addr

func (*KcpConn) Read

func (c *KcpConn) Read(buf []byte) (n int, err error)

func (*KcpConn) RemoteAddr

func (c *KcpConn) RemoteAddr() net.Addr

func (*KcpConn) SetDeadline

func (c *KcpConn) SetDeadline(t time.Time) error

func (*KcpConn) SetReadDeadline

func (c *KcpConn) SetReadDeadline(t time.Time) error

func (*KcpConn) SetWriteDeadline

func (c *KcpConn) SetWriteDeadline(t time.Time) error

func (*KcpConn) Write

func (c *KcpConn) Write(data []byte) (n int, err error)

type Listener

type Listener struct{}

func (Listener) Listen

func (l Listener) Listen(listenAddr string) (net.Listener, error)

type Option

type Option struct {
	Key         string `json:"key"`         /* Must be the same between c-s */
	Crypt       string `json:"crypt"`       /* Must be the same between c-s */
	DataShard   int    `json:"datashard"`   /* Must be the same between c-s */
	ParityShard int    `json:"parityshard"` /* Must be the same between c-s */
	MTU         int    `json:"mtu"`
	SndWnd      int    `json:"sndwnd"`
	RcvWnd      int    `json:"rcvwnd"`
	DSCP        int    `json:"dscp"`
	AckNodelay  bool   `json:"acknodelay"`
	SockBuf     int    `json:"sockbuf"` // Shared with smux session
	// mode params
	Mode         string `json:"mode"`
	NoDelay      int    `json:"nodelay"`
	Interval     int    `json:"interval"`
	Resend       int    `json:"resend"`
	NoCongestion int    `json:"nc"`
}

kcp options

func DefaultOption

func DefaultOption(clientSide bool) Option

Default is game/Live mode

func (*Option) CorrectByMode

func (opt *Option) CorrectByMode()

Fix no-delay by mode

type Server

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

kcp server type

func Listen

func Listen(listenAddr string) (*Server, error)

func ListenWithOptions

func ListenWithOptions(listenAddr string, opt Option) (*Server, error)

func (*Server) Accept

func (s *Server) Accept() (net.Conn, error)

func (*Server) Addr

func (s *Server) Addr() net.Addr

func (*Server) Close

func (s *Server) Close() error

Jump to

Keyboard shortcuts

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