Documentation
¶
Overview ¶
Package network 网络代理器
Package network tcp网络控制器 ¶
Package network tcp服务器 ¶
Package network websocket连接器
Index ¶
- type Addr
- type Client
- type Conn
- type ConnSet
- type TCPConn
- func (tcpConn *TCPConn) Close() error
- func (tcpConn *TCPConn) LocalAddr() net.Addr
- func (tcpConn *TCPConn) Read(b []byte) (int, error)
- func (tcpConn *TCPConn) ReadMessage() (messageType int, p []byte, err error)
- func (tcpConn *TCPConn) RemoteAddr() net.Addr
- func (tcpConn *TCPConn) SetDeadline(t time.Time) error
- func (tcpConn *TCPConn) SetReadDeadline(t time.Time) error
- func (tcpConn *TCPConn) SetWriteDeadline(t time.Time) error
- func (tcpConn *TCPConn) Write(b []byte) (n int, err error)
- type TCPServer
- type WSConn
- func (wsConn *WSConn) Close() error
- func (wsConn *WSConn) Conn() *websocket.Conn
- func (wsConn *WSConn) LocalAddr() net.Addr
- func (wsConn *WSConn) Read(p []byte) (n int, err error)
- func (wsConn *WSConn) ReadMessage() (messageType int, p []byte, err error)
- func (wsConn *WSConn) RemoteAddr() net.Addr
- func (wsConn *WSConn) SetDeadline(t time.Time) error
- func (wsConn *WSConn) SetReadDeadline(t time.Time) error
- func (wsConn *WSConn) SetWriteDeadline(t time.Time) error
- func (wsConn *WSConn) Write(p []byte) (int, error)
- type WSHandler
- type WSServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Addr ¶
type Addr struct {
// contains filtered or unexported fields
}
Addr is an implementation of net.Addr for WebSocket.
type Conn ¶
type Conn interface {
// Read 和 Write 方法处理的数据必须是一个完整的数据包
net.Conn
ReadMessage() (messageType int, p []byte, err error)
}
Conn 网络代理接口
type TCPConn ¶
type TCPConn struct {
io.Reader //Read(p []byte) (n int, err error)
io.Writer //Write(p []byte) (n int, err error)
sync.Mutex
// contains filtered or unexported fields
}
TCPConn tcp连接
func (*TCPConn) ReadMessage ¶
func (*TCPConn) SetDeadline ¶
SetDeadline A zero value for t means I/O operations will not time out.
func (*TCPConn) SetReadDeadline ¶
SetReadDeadline sets the deadline for future Read calls. A zero value for t means Read will not time out.
func (*TCPConn) SetWriteDeadline ¶
SetWriteDeadline sets the deadline for future Write calls. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.
type TCPServer ¶
type TCPServer struct {
Addr string
TLS bool //是否支持tls
CertFile string
KeyFile string
MaxConnNum int
// mutexConns sync.Mutex
NewAgent func(*TCPConn) Client
// contains filtered or unexported fields
}
TCPServer tcp服务器
type WSConn ¶
type WSConn struct {
io.Reader //Read(p []byte) (n int, err error)
io.Writer //Write(p []byte) (n int, err error)
sync.Mutex
// contains filtered or unexported fields
}
WSConn websocket连接
func (*WSConn) ReadMessage ¶
func (*WSConn) SetDeadline ¶
SetDeadline A zero value for t means I/O operations will not time out.
func (*WSConn) SetReadDeadline ¶
SetReadDeadline sets the deadline for future Read calls. A zero value for t means Read will not time out.
func (*WSConn) SetWriteDeadline ¶
SetWriteDeadline sets the deadline for future Write calls. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.
type WSHandler ¶
type WSHandler struct {
// contains filtered or unexported fields
}
WSHandler websocket 处理器