代码拉取完成,页面将自动刷新
package net
import "net"
const (
StatusIdle = iota
StatusRunning
StatusShutdown
StatusStopped
)
// NetEventQueue event channel type
type NetEventQueue chan *EventData
// IBoxConn box net connection wrapper !
type IBoxConn interface {
// LocalAddr is the connection's local socket address.
LocalAddr() (addr net.Addr)
// RemoteAddr is the connection's remote peer address.
RemoteAddr() (addr net.Addr)
// Read reads data from the connection.
Read(b []byte) (n int, err error)
// Write writes one byte slice to peer asynchronously, usually you would call it in individual goroutines
Write(buf []byte) error
// Close closes the current connection.
Close() error
// IsClose will return ture if connection has been closed
IsClose() bool
OnClose()
}
// IBoxConnector connector wrapper
type IBoxConnector interface {
//Start connector logic
Start() error
//ConnectTo connect to address
ConnectTo(network, address string) (IBoxConn, error)
//Stop all connect
Stop() error
}
// IBoxNetLoop box network loop
type IBoxNetLoop interface {
//Start create network loop
Start() error
//Shutdown will set closed all connections and refuse new connections, it will not stop network loop
Shutdown() error
//Stop all network loop
Stop() error
//Tick network goroutine tick func
Tick()
//Notify logic goroutine net event
Notify(data *EventData)
//SendToLoop send event to network goroutine, deal by tick function
SendToLoop(data *EventData)
//ConnectTo connect to remote server
ConnectTo(network, address string) (IBoxConn, error)
//ListenAt listen at address
ListenAt(network, address string) error
}
// BoxConn create new box conn, param: gnet.Conn
var BoxConn = makeGnetConn
// BoxConnector client connector, param: serverEH
var BoxConnector = makeConnector
// BoxLoop box network loop, listen or connect, param: NetEventQueue
var BoxLoop = makeGnetLoop
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。