Documentation
¶
Index ¶
- Constants
- Variables
- func HasProto(proto string) bool
- func HasReliableProto(proto string) bool
- func RegisterDialerController(fn func(network, address string, c syscall.RawConn) error)
- func Sock5GetRequest(conn io.ReadWriter) (rawaddr []byte, host string, err error)
- func Sock5Handshake(conn *net.TCPConn, timeoutms int, username string, password string) (err error)
- func Sock5HandshakeBy(conn io.ReadWriter, username string, password string) (err error)
- func Sock5SetRequest(conn *net.TCPConn, host string, port int, timeoutms int) (err error)
- func SupportProtos() []string
- func SupportReliableProtos() []string
- type BBCongestion
- type Congestion
- type Conn
- type Frame
- func (*Frame) Descriptor() ([]byte, []int)deprecated
- func (x *Frame) GetAcked() bool
- func (x *Frame) GetData() *FrameData
- func (x *Frame) GetDataid() []int32
- func (x *Frame) GetId() int32
- func (x *Frame) GetResend() bool
- func (x *Frame) GetSendtime() int64
- func (x *Frame) GetType() int32
- func (*Frame) ProtoMessage()
- func (x *Frame) ProtoReflect() protoreflect.Message
- func (x *Frame) Reset()
- func (x *Frame) String() string
- type FrameData
- func (*FrameData) Descriptor() ([]byte, []int)deprecated
- func (x *FrameData) GetCompress() bool
- func (x *FrameData) GetData() []byte
- func (x *FrameData) GetType() int32
- func (*FrameData) ProtoMessage()
- func (x *FrameData) ProtoReflect() protoreflect.Message
- func (x *FrameData) Reset()
- func (x *FrameData) String() string
- type FrameData_TYPE
- func (FrameData_TYPE) Descriptor() protoreflect.EnumDescriptor
- func (x FrameData_TYPE) Enum() *FrameData_TYPE
- func (FrameData_TYPE) EnumDescriptor() ([]byte, []int)deprecated
- func (x FrameData_TYPE) Number() protoreflect.EnumNumber
- func (x FrameData_TYPE) String() string
- func (FrameData_TYPE) Type() protoreflect.EnumType
- type FrameMgr
- func (fm *FrameMgr) Close()
- func (fm *FrameMgr) Connect()
- func (fm *FrameMgr) GetRecvBufferSize() int
- func (fm *FrameMgr) GetRecvReadLineBuffer() []byte
- func (fm *FrameMgr) GetSendBufferLeft() int
- func (fm *FrameMgr) GetSendList() *list.List
- func (fm *FrameMgr) IsConnected() bool
- func (fm *FrameMgr) IsHBTimeout() bool
- func (fm *FrameMgr) IsRemoteClosed() bool
- func (fm *FrameMgr) MarshalFrame(f *Frame) ([]byte, error)
- func (fm *FrameMgr) OnRecvFrame(f *Frame)
- func (fm *FrameMgr) SetCongestion(ct Congestion)
- func (fm *FrameMgr) SetDebugid(debugid string)
- func (fm *FrameMgr) SkipRecvBuffer(size int)
- func (fm *FrameMgr) Update() bool
- func (fm *FrameMgr) WriteSendBuffer(data []byte)
- type FrameStat
- type Frame_TYPE
- type HttpConfig
- type IcmpMsg
- func (*IcmpMsg) Descriptor() ([]byte, []int)deprecated
- func (x *IcmpMsg) GetData() []byte
- func (x *IcmpMsg) GetFlag() IcmpMsg_TYPE
- func (x *IcmpMsg) GetId() string
- func (x *IcmpMsg) GetMagic() IcmpMsg_TYPE
- func (*IcmpMsg) ProtoMessage()
- func (x *IcmpMsg) ProtoReflect() protoreflect.Message
- func (x *IcmpMsg) Reset()
- func (x *IcmpMsg) String() string
- type IcmpMsg_TYPE
- func (IcmpMsg_TYPE) Descriptor() protoreflect.EnumDescriptor
- func (x IcmpMsg_TYPE) Enum() *IcmpMsg_TYPE
- func (IcmpMsg_TYPE) EnumDescriptor() ([]byte, []int)deprecated
- func (x IcmpMsg_TYPE) Number() protoreflect.EnumNumber
- func (x IcmpMsg_TYPE) String() string
- func (IcmpMsg_TYPE) Type() protoreflect.EnumType
- type KcpConn
- func (c *KcpConn) Accept() (Conn, error)
- func (c *KcpConn) Close() error
- func (c *KcpConn) Dial(dst string) (Conn, error)
- func (c *KcpConn) Info() string
- func (c *KcpConn) Listen(dst string) (Conn, error)
- func (c *KcpConn) Name() string
- func (c *KcpConn) Read(p []byte) (n int, err error)
- func (c *KcpConn) Write(p []byte) (n int, err error)
- type QuicConn
- func (c *QuicConn) Accept() (Conn, error)
- func (c *QuicConn) Close() error
- func (c *QuicConn) Dial(dst string) (Conn, error)
- func (c *QuicConn) Info() string
- func (c *QuicConn) Listen(dst string) (Conn, error)
- func (c *QuicConn) Name() string
- func (c *QuicConn) Read(p []byte) (n int, err error)
- func (c *QuicConn) Write(p []byte) (n int, err error)
- type RhttpConn
- func (c *RhttpConn) Accept() (Conn, error)
- func (c *RhttpConn) Close() error
- func (c *RhttpConn) Dial(dst string) (Conn, error)
- func (c *RhttpConn) GetConfig() *HttpConfig
- func (c *RhttpConn) Info() string
- func (c *RhttpConn) Listen(dst string) (Conn, error)
- func (c *RhttpConn) Name() string
- func (c *RhttpConn) Read(p []byte) (n int, err error)
- func (c *RhttpConn) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (c *RhttpConn) SetConfig(config *HttpConfig)
- func (c *RhttpConn) Write(p []byte) (n int, err error)
- type RicmpConfig
- type RicmpConn
- func (c *RicmpConn) Accept() (Conn, error)
- func (c *RicmpConn) Close() error
- func (c *RicmpConn) Dial(dst string) (Conn, error)
- func (c *RicmpConn) GetConfig() *RicmpConfig
- func (c *RicmpConn) Info() string
- func (c *RicmpConn) Listen(dst string) (Conn, error)
- func (c *RicmpConn) Name() string
- func (c *RicmpConn) Read(p []byte) (n int, err error)
- func (c *RicmpConn) SetConfig(config *RicmpConfig)
- func (c *RicmpConn) Write(p []byte) (n int, err error)
- type RudpConfig
- type RudpConn
- func (c *RudpConn) Accept() (Conn, error)
- func (c *RudpConn) Close() error
- func (c *RudpConn) Dial(dst string) (Conn, error)
- func (c *RudpConn) GetConfig() *RudpConfig
- func (c *RudpConn) Info() string
- func (c *RudpConn) Listen(dst string) (Conn, error)
- func (c *RudpConn) Name() string
- func (c *RudpConn) Read(p []byte) (n int, err error)
- func (c *RudpConn) SetConfig(config *RudpConfig)
- func (c *RudpConn) Write(p []byte) (n int, err error)
- type TcpConn
- func (c *TcpConn) Accept() (Conn, error)
- func (c *TcpConn) Close() error
- func (c *TcpConn) Dial(dst string) (Conn, error)
- func (c *TcpConn) Info() string
- func (c *TcpConn) Listen(dst string) (Conn, error)
- func (c *TcpConn) Name() string
- func (c *TcpConn) Read(p []byte) (n int, err error)
- func (c *TcpConn) Write(p []byte) (n int, err error)
- type UdpConfig
- type UdpConn
- func (c *UdpConn) Accept() (Conn, error)
- func (c *UdpConn) Close() error
- func (c *UdpConn) Dial(dst string) (Conn, error)
- func (c *UdpConn) GetConfig() *UdpConfig
- func (c *UdpConn) Info() string
- func (c *UdpConn) Listen(dst string) (Conn, error)
- func (c *UdpConn) Name() string
- func (c *UdpConn) Read(p []byte) (n int, err error)
- func (c *UdpConn) SetConfig(config *UdpConfig)
- func (c *UdpConn) Write(p []byte) (n int, err error)
Constants ¶
View Source
const ( ProtoConnnect = "connect" ProtoData = "data" ProtoClose = "close" ProtoCodeOK = 200 ProtoCodeFull = 403 ProtoCodeFail = 404 )
View Source
const ( Socks5AtypIP4 = 1 Socks5AtypDomain = 3 Socks5AtypIP6 = 4 )
View Source
const ( NoAuth = uint8(0) UserPassAuth = uint8(2) )
Variables ¶
View Source
var ( FrameData_TYPE_name = map[int32]string{ 0: "USER_DATA", 1: "CONN", 2: "CONNRSP", 3: "CLOSE", 4: "HB", } FrameData_TYPE_value = map[string]int32{ "USER_DATA": 0, "CONN": 1, "CONNRSP": 2, "CLOSE": 3, "HB": 4, } )
Enum value maps for FrameData_TYPE.
View Source
var ( Frame_TYPE_name = map[int32]string{ 0: "DATA", 1: "REQ", 2: "ACK", 3: "PING", 4: "PONG", } Frame_TYPE_value = map[string]int32{ "DATA": 0, "REQ": 1, "ACK": 2, "PING": 3, "PONG": 4, } )
Enum value maps for Frame_TYPE.
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", } IcmpMsg_TYPE_value = map[string]int32{ "PONG_PROTO": 0, "PING_PROTO": 8, "CLIENT_SEND_FLAG": 1, "SERVER_SEND_FLAG": 2, "MAGIC": 47837, } )
Enum value maps for IcmpMsg_TYPE.
View Source
var File_frame_proto protoreflect.FileDescriptor
View Source
var File_icmpmsg_proto protoreflect.FileDescriptor
Functions ¶
func HasReliableProto ¶
HasReliableProto 检查指定的协议是否为支持的可靠协议。
func RegisterDialerController ¶
RegisterDialerController 注册一个控制函数,允许在连接设置时执行额外操作。
func Sock5GetRequest ¶
func Sock5GetRequest(conn io.ReadWriter) (rawaddr []byte, host string, err error)
func Sock5Handshake ¶
func Sock5HandshakeBy ¶
func Sock5HandshakeBy(conn io.ReadWriter, username string, password string) (err error)
func Sock5SetRequest ¶
func SupportReliableProtos ¶
func SupportReliableProtos() []string
SupportReliableProtos 返回支持的可靠协议列表。
Types ¶
type BBCongestion ¶
type BBCongestion struct {
// contains filtered or unexported fields
}
func (*BBCongestion) Info ¶
func (bb *BBCongestion) Info() string
func (*BBCongestion) Init ¶
func (bb *BBCongestion) Init()
func (*BBCongestion) RecvAck ¶
func (bb *BBCongestion) RecvAck(id int, size int)
func (*BBCongestion) Update ¶
func (bb *BBCongestion) Update()
type Congestion ¶
type Conn ¶
type Conn interface {
io.ReadWriteCloser
Name() string
Info() string
Dial(dst string) (Conn, error)
Listen(dst string) (Conn, error)
Accept() (Conn, error)
}
Conn 接口定义了网络连接的基本操作。
type Frame ¶
type Frame struct {
Type int32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"`
Resend bool `protobuf:"varint,2,opt,name=resend,proto3" json:"resend,omitempty"`
Sendtime int64 `protobuf:"varint,3,opt,name=sendtime,proto3" json:"sendtime,omitempty"`
Id int32 `protobuf:"varint,4,opt,name=id,proto3" json:"id,omitempty"`
Data *FrameData `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
Dataid []int32 `protobuf:"varint,6,rep,packed,name=dataid,proto3" json:"dataid,omitempty"`
Acked bool `protobuf:"varint,7,opt,name=acked,proto3" json:"acked,omitempty"`
// contains filtered or unexported fields
}
func (*Frame) Descriptor
deprecated
func (*Frame) GetSendtime ¶
func (*Frame) ProtoMessage ¶
func (*Frame) ProtoMessage()
func (*Frame) ProtoReflect ¶
func (x *Frame) ProtoReflect() protoreflect.Message
type FrameData ¶
type FrameData struct {
Type int32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
Compress bool `protobuf:"varint,3,opt,name=compress,proto3" json:"compress,omitempty"`
// contains filtered or unexported fields
}
func (*FrameData) Descriptor
deprecated
func (*FrameData) GetCompress ¶
func (*FrameData) ProtoMessage ¶
func (*FrameData) ProtoMessage()
func (*FrameData) ProtoReflect ¶
func (x *FrameData) ProtoReflect() protoreflect.Message
type FrameData_TYPE ¶
type FrameData_TYPE int32
const ( FrameData_USER_DATA FrameData_TYPE = 0 FrameData_CONN FrameData_TYPE = 1 FrameData_CONNRSP FrameData_TYPE = 2 FrameData_CLOSE FrameData_TYPE = 3 FrameData_HB FrameData_TYPE = 4 )
func (FrameData_TYPE) Descriptor ¶
func (FrameData_TYPE) Descriptor() protoreflect.EnumDescriptor
func (FrameData_TYPE) Enum ¶
func (x FrameData_TYPE) Enum() *FrameData_TYPE
func (FrameData_TYPE) EnumDescriptor
deprecated
func (FrameData_TYPE) EnumDescriptor() ([]byte, []int)
Deprecated: Use FrameData_TYPE.Descriptor instead.
func (FrameData_TYPE) Number ¶
func (x FrameData_TYPE) Number() protoreflect.EnumNumber
func (FrameData_TYPE) String ¶
func (x FrameData_TYPE) String() string
func (FrameData_TYPE) Type ¶
func (FrameData_TYPE) Type() protoreflect.EnumType
type FrameMgr ¶
type FrameMgr struct {
// contains filtered or unexported fields
}
func NewFrameMgr ¶
func (*FrameMgr) GetRecvBufferSize ¶
func (*FrameMgr) GetRecvReadLineBuffer ¶
func (*FrameMgr) GetSendBufferLeft ¶
func (*FrameMgr) GetSendList ¶
func (*FrameMgr) IsConnected ¶
func (*FrameMgr) IsHBTimeout ¶
func (*FrameMgr) IsRemoteClosed ¶
func (*FrameMgr) OnRecvFrame ¶
func (*FrameMgr) SetCongestion ¶
func (fm *FrameMgr) SetCongestion(ct Congestion)
func (*FrameMgr) SetDebugid ¶
func (*FrameMgr) SkipRecvBuffer ¶
func (*FrameMgr) WriteSendBuffer ¶
type Frame_TYPE ¶
type Frame_TYPE int32
const ( Frame_DATA Frame_TYPE = 0 Frame_REQ Frame_TYPE = 1 Frame_ACK Frame_TYPE = 2 Frame_PING Frame_TYPE = 3 Frame_PONG Frame_TYPE = 4 )
func (Frame_TYPE) Descriptor ¶
func (Frame_TYPE) Descriptor() protoreflect.EnumDescriptor
func (Frame_TYPE) Enum ¶
func (x Frame_TYPE) Enum() *Frame_TYPE
func (Frame_TYPE) EnumDescriptor
deprecated
func (Frame_TYPE) EnumDescriptor() ([]byte, []int)
Deprecated: Use Frame_TYPE.Descriptor instead.
func (Frame_TYPE) Number ¶
func (x Frame_TYPE) Number() protoreflect.EnumNumber
func (Frame_TYPE) String ¶
func (x Frame_TYPE) String() string
func (Frame_TYPE) Type ¶
func (Frame_TYPE) Type() protoreflect.EnumType
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"`
// contains filtered or unexported fields
}
func (*IcmpMsg) Descriptor
deprecated
func (*IcmpMsg) GetFlag ¶
func (x *IcmpMsg) GetFlag() IcmpMsg_TYPE
func (*IcmpMsg) GetMagic ¶
func (x *IcmpMsg) GetMagic() IcmpMsg_TYPE
func (*IcmpMsg) ProtoMessage ¶
func (*IcmpMsg) ProtoMessage()
func (*IcmpMsg) ProtoReflect ¶
func (x *IcmpMsg) ProtoReflect() protoreflect.Message
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) Descriptor ¶
func (IcmpMsg_TYPE) Descriptor() protoreflect.EnumDescriptor
func (IcmpMsg_TYPE) Enum ¶
func (x IcmpMsg_TYPE) Enum() *IcmpMsg_TYPE
func (IcmpMsg_TYPE) EnumDescriptor
deprecated
func (IcmpMsg_TYPE) EnumDescriptor() ([]byte, []int)
Deprecated: Use IcmpMsg_TYPE.Descriptor instead.
func (IcmpMsg_TYPE) Number ¶
func (x IcmpMsg_TYPE) Number() protoreflect.EnumNumber
func (IcmpMsg_TYPE) String ¶
func (x IcmpMsg_TYPE) String() string
func (IcmpMsg_TYPE) Type ¶
func (IcmpMsg_TYPE) Type() protoreflect.EnumType
type RhttpConn ¶
type RhttpConn struct {
// contains filtered or unexported fields
}
func (*RhttpConn) GetConfig ¶
func (c *RhttpConn) GetConfig() *HttpConfig
func (*RhttpConn) SetConfig ¶
func (c *RhttpConn) SetConfig(config *HttpConfig)
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) GetConfig ¶
func (c *RicmpConn) GetConfig() *RicmpConfig
func (*RicmpConn) SetConfig ¶
func (c *RicmpConn) SetConfig(config *RicmpConfig)
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
BatchSendPkgs int
}
func DefaultRudpConfig ¶
func DefaultRudpConfig() *RudpConfig
type RudpConn ¶
type RudpConn struct {
// contains filtered or unexported fields
}
func (*RudpConn) GetConfig ¶
func (c *RudpConn) GetConfig() *RudpConfig
func (*RudpConn) SetConfig ¶
func (c *RudpConn) SetConfig(config *RudpConfig)
type UdpConfig ¶
type UdpConfig struct {
MaxPacketSize int
RecvChanLen int
AcceptChanLen int
RecvChanPushTimeout int
}
func DefaultUdpConfig ¶
func DefaultUdpConfig() *UdpConfig
Click to show internal directories.
Click to hide internal directories.