conn

package
v0.0.0-...-e95cdce Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 30 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ProtoConnnect = "connect"
	ProtoData     = "data"
	ProtoClose    = "close"

	ProtoCodeOK   = 200
	ProtoCodeFull = 403
	ProtoCodeFail = 404
)

Variables

View Source
var IcmpMsg_TYPE_name = map[int32]string{
	0:     "PONG_PROTO",
	8:     "PING_PROTO",
	1:     "CLIENT_SEND_FLAG",
	2:     "SERVER_SEND_FLAG",
	47837: "MAGIC",
}
View Source
var IcmpMsg_TYPE_value = map[string]int32{
	"PONG_PROTO":       0,
	"PING_PROTO":       8,
	"CLIENT_SEND_FLAG": 1,
	"SERVER_SEND_FLAG": 2,
	"MAGIC":            47837,
}

Functions

func HasProto

func HasProto(proto string) bool

func HasReliableProto

func HasReliableProto(proto string) bool

func RegisterDialerController

func RegisterDialerController(fn func(network, address string, c syscall.RawConn) error)

func SupportProtos

func SupportProtos() []string

func SupportReliableProtos

func SupportReliableProtos() []string

Types

type Conn

type Conn interface {
	io.ReadWriteCloser

	Name() string

	Info() string

	Dial(dst string) (Conn, error)

	Listen(dst string) (Conn, error)
	Accept() (Conn, error)
}

func NewConn

func NewConn(proto string) (Conn, error)

type HttpConfig

type HttpConfig struct {
	MaxPacketSize       int
	RecvChanLen         int
	AcceptChanLen       int
	RecvChanPushTimeout int
	BufferSize          int
	MaxRetryNum         int
	CloseWaitTimeoutMs  int
	HBTimeoutMs         int
	MaxMsgIndex         int
}

func DefaultHttpConfig

func DefaultHttpConfig() *HttpConfig

type IcmpMsg

type IcmpMsg struct {
	Id                   string       `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Data                 []byte       `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	Magic                IcmpMsg_TYPE `protobuf:"varint,3,opt,name=magic,proto3,enum=IcmpMsg_TYPE" json:"magic,omitempty"`
	Flag                 IcmpMsg_TYPE `protobuf:"varint,4,opt,name=flag,proto3,enum=IcmpMsg_TYPE" json:"flag,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

func (*IcmpMsg) Descriptor

func (*IcmpMsg) Descriptor() ([]byte, []int)

func (*IcmpMsg) GetData

func (m *IcmpMsg) GetData() []byte

func (*IcmpMsg) GetFlag

func (m *IcmpMsg) GetFlag() IcmpMsg_TYPE

func (*IcmpMsg) GetId

func (m *IcmpMsg) GetId() string

func (*IcmpMsg) GetMagic

func (m *IcmpMsg) GetMagic() IcmpMsg_TYPE

func (*IcmpMsg) ProtoMessage

func (*IcmpMsg) ProtoMessage()

func (*IcmpMsg) Reset

func (m *IcmpMsg) Reset()

func (*IcmpMsg) String

func (m *IcmpMsg) String() string

func (*IcmpMsg) XXX_DiscardUnknown

func (m *IcmpMsg) XXX_DiscardUnknown()

func (*IcmpMsg) XXX_Marshal

func (m *IcmpMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IcmpMsg) XXX_Merge

func (m *IcmpMsg) XXX_Merge(src proto.Message)

func (*IcmpMsg) XXX_Size

func (m *IcmpMsg) XXX_Size() int

func (*IcmpMsg) XXX_Unmarshal

func (m *IcmpMsg) XXX_Unmarshal(b []byte) error

type IcmpMsg_TYPE

type IcmpMsg_TYPE int32
const (
	IcmpMsg_PONG_PROTO       IcmpMsg_TYPE = 0
	IcmpMsg_PING_PROTO       IcmpMsg_TYPE = 8
	IcmpMsg_CLIENT_SEND_FLAG IcmpMsg_TYPE = 1
	IcmpMsg_SERVER_SEND_FLAG IcmpMsg_TYPE = 2
	IcmpMsg_MAGIC            IcmpMsg_TYPE = 47837
)

func (IcmpMsg_TYPE) EnumDescriptor

func (IcmpMsg_TYPE) EnumDescriptor() ([]byte, []int)

func (IcmpMsg_TYPE) String

func (x IcmpMsg_TYPE) String() string

type KcpConn

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

func (*KcpConn) Accept

func (c *KcpConn) Accept() (Conn, error)

func (*KcpConn) Close

func (c *KcpConn) Close() error

func (*KcpConn) Dial

func (c *KcpConn) Dial(dst string) (Conn, error)

func (*KcpConn) Info

func (c *KcpConn) Info() string

func (*KcpConn) Listen

func (c *KcpConn) Listen(dst string) (Conn, error)

func (*KcpConn) Name

func (c *KcpConn) Name() string

func (*KcpConn) Read

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

func (*KcpConn) Write

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

type QuicConn

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

func (*QuicConn) Accept

func (c *QuicConn) Accept() (Conn, error)

func (*QuicConn) Close

func (c *QuicConn) Close() error

func (*QuicConn) Dial

func (c *QuicConn) Dial(dst string) (Conn, error)

func (*QuicConn) Info

func (c *QuicConn) Info() string

func (*QuicConn) Listen

func (c *QuicConn) Listen(dst string) (Conn, error)

func (*QuicConn) Name

func (c *QuicConn) Name() string

func (*QuicConn) Read

func (c *QuicConn) Read(p []byte) (n int, err error)

func (*QuicConn) Write

func (c *QuicConn) Write(p []byte) (n int, err error)

type RhttpConn

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

func (*RhttpConn) Accept

func (c *RhttpConn) Accept() (Conn, error)

func (*RhttpConn) Close

func (c *RhttpConn) Close() error

func (*RhttpConn) Dial

func (c *RhttpConn) Dial(dst string) (Conn, error)

func (*RhttpConn) GetConfig

func (c *RhttpConn) GetConfig() *HttpConfig

func (*RhttpConn) Info

func (c *RhttpConn) Info() string

func (*RhttpConn) Listen

func (c *RhttpConn) Listen(dst string) (Conn, error)

func (*RhttpConn) Name

func (c *RhttpConn) Name() string

func (*RhttpConn) Read

func (c *RhttpConn) Read(p []byte) (n int, err error)

func (*RhttpConn) ServeHTTP

func (c *RhttpConn) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*RhttpConn) SetConfig

func (c *RhttpConn) SetConfig(config *HttpConfig)

func (*RhttpConn) Write

func (c *RhttpConn) Write(p []byte) (n int, err error)

type RicmpConfig

type RicmpConfig struct {
	MaxPacketSize      int
	CutSize            int
	MaxId              int
	BufferSize         int
	MaxWin             int
	ResendTimems       int
	Compress           int
	Stat               int
	ConnectTimeoutMs   int
	CloseTimeoutMs     int
	CloseWaitTimeoutMs int
	AcceptChanLen      int
	Congestion         string
}

func DefaultRicmpConfig

func DefaultRicmpConfig() *RicmpConfig

type RicmpConn

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

func (*RicmpConn) Accept

func (c *RicmpConn) Accept() (Conn, error)

func (*RicmpConn) Close

func (c *RicmpConn) Close() error

func (*RicmpConn) Dial

func (c *RicmpConn) Dial(dst string) (Conn, error)

func (*RicmpConn) GetConfig

func (c *RicmpConn) GetConfig() *RicmpConfig

func (*RicmpConn) Info

func (c *RicmpConn) Info() string

func (*RicmpConn) Listen

func (c *RicmpConn) Listen(dst string) (Conn, error)

func (*RicmpConn) Name

func (c *RicmpConn) Name() string

func (*RicmpConn) Read

func (c *RicmpConn) Read(p []byte) (n int, err error)

func (*RicmpConn) SetConfig

func (c *RicmpConn) SetConfig(config *RicmpConfig)

func (*RicmpConn) Write

func (c *RicmpConn) Write(p []byte) (n int, err error)

type RudpConfig

type RudpConfig struct {
	MaxPacketSize      int
	CutSize            int
	MaxId              int
	BufferSize         int
	MaxWin             int
	ResendTimems       int
	Compress           int
	Stat               int
	ConnectTimeoutMs   int
	CloseTimeoutMs     int
	CloseWaitTimeoutMs int
	AcceptChanLen      int
	Congestion         string
}

func DefaultRudpConfig

func DefaultRudpConfig() *RudpConfig

type RudpConn

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

func (*RudpConn) Accept

func (c *RudpConn) Accept() (Conn, error)

func (*RudpConn) Close

func (c *RudpConn) Close() error

func (*RudpConn) Dial

func (c *RudpConn) Dial(dst string) (Conn, error)

func (*RudpConn) GetConfig

func (c *RudpConn) GetConfig() *RudpConfig

func (*RudpConn) Info

func (c *RudpConn) Info() string

func (*RudpConn) Listen

func (c *RudpConn) Listen(dst string) (Conn, error)

func (*RudpConn) Name

func (c *RudpConn) Name() string

func (*RudpConn) Read

func (c *RudpConn) Read(p []byte) (n int, err error)

func (*RudpConn) SetConfig

func (c *RudpConn) SetConfig(config *RudpConfig)

func (*RudpConn) Write

func (c *RudpConn) Write(p []byte) (n int, err error)

type TcpConn

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

func (*TcpConn) Accept

func (c *TcpConn) Accept() (Conn, error)

func (*TcpConn) Close

func (c *TcpConn) Close() error

func (*TcpConn) Dial

func (c *TcpConn) Dial(dst string) (Conn, error)

func (*TcpConn) Info

func (c *TcpConn) Info() string

func (*TcpConn) Listen

func (c *TcpConn) Listen(dst string) (Conn, error)

func (*TcpConn) Name

func (c *TcpConn) Name() string

func (*TcpConn) Read

func (c *TcpConn) Read(p []byte) (n int, err error)

func (*TcpConn) Write

func (c *TcpConn) Write(p []byte) (n int, err error)

type UdpConfig

type UdpConfig struct {
	MaxPacketSize       int
	RecvChanLen         int
	AcceptChanLen       int
	RecvChanPushTimeout int
}

func DefaultUdpConfig

func DefaultUdpConfig() *UdpConfig

type UdpConn

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

func (*UdpConn) Accept

func (c *UdpConn) Accept() (Conn, error)

func (*UdpConn) Close

func (c *UdpConn) Close() error

func (*UdpConn) Dial

func (c *UdpConn) Dial(dst string) (Conn, error)

func (*UdpConn) GetConfig

func (c *UdpConn) GetConfig() *UdpConfig

func (*UdpConn) Info

func (c *UdpConn) Info() string

func (*UdpConn) Listen

func (c *UdpConn) Listen(dst string) (Conn, error)

func (*UdpConn) Name

func (c *UdpConn) Name() string

func (*UdpConn) Read

func (c *UdpConn) Read(p []byte) (n int, err error)

func (*UdpConn) SetConfig

func (c *UdpConn) SetConfig(config *UdpConfig)

func (*UdpConn) Write

func (c *UdpConn) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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