Documentation ¶
Index ¶
- Constants
- Variables
- type DataCallback
- type ErrCallback
- type HTTPService
- type HTTPServiceConfig
- type NewSessionCallback
- type TCPService
- type TCPSession
- func (object *TCPSession) AddCallback(dataCallback DataCallback, errorCallback ErrCallback) *TCPSession
- func (object *TCPSession) CloseRead()
- func (object *TCPSession) CloseWrite()
- func (object *TCPSession) Connect(addr string) (err error)
- func (object *TCPSession) IsStopped() bool
- func (object *TCPSession) NeedClose() bool
- func (object *TCPSession) SetConn(c net.Conn) *TCPSession
- func (object *TCPSession) SetDebug() *TCPSession
- func (object *TCPSession) SetMode(mode TCPSessionMode) *TCPSession
- func (object *TCPSession) SetName(name string) *TCPSession
- func (object *TCPSession) Start()
- func (object *TCPSession) Stop()
- func (object *TCPSession) Write(raw []byte)
- type TCPSessionMode
- type TCPSessionPool
Constants ¶
View Source
const ( TCPSessionModeChunk = TCPSessionMode(iota) // 块模式 TCPSessionModeStream // 流模式 )
Variables ¶
View Source
var (
ErrServerAddress = errors.New("server address error") // 服务器地址错误
)
错误定义
Functions ¶
This section is empty.
Types ¶
type HTTPService ¶
type HTTPService struct { *HTTPServiceConfig Router *fasthttprouter.Router // contains filtered or unexported fields }
HTTPService HTTP服务
func NewHTTPService ¶
func NewHTTPService(config *HTTPServiceConfig) *HTTPService
NewHTTPService 工厂方法
type HTTPServiceConfig ¶
type HTTPServiceConfig struct { HTTPAddr string // HTTP地址 HTTPStaticLocation string // HTTP静态文件路径(URL) HTTPStaticPath string // HTTP静态文件本地路径 HTTPSAddr string // HTTPS地址 HTTPSCertPath string // HTTP证书 HTTPSKeyPath string // HTTP Key }
HTTPServiceConfig HTTP服务器配置
type TCPService ¶
type TCPService struct {
// contains filtered or unexported fields
}
TCPService TCP服务
func NewTCPServiceWithCallback ¶
func NewTCPServiceWithCallback(newSessionCallback NewSessionCallback) *TCPService
工厂方法
func (*TCPService) StartWithAddr ¶
func (object *TCPService) StartWithAddr(addr string) (err error)
StartWithAddr 启动
type TCPSession ¶
type TCPSession struct { auto_lock.AutoLock ID int // 会话id Mode TCPSessionMode // 模式 C net.Conn // TCP连接 // contains filtered or unexported fields }
TCPSession TCP会话
func (*TCPSession) AddCallback ¶
func (object *TCPSession) AddCallback(dataCallback DataCallback, errorCallback ErrCallback) *TCPSession
AddCallback 添加回调
func (*TCPSession) SetMode ¶
func (object *TCPSession) SetMode(mode TCPSessionMode) *TCPSession
设置模式
type TCPSessionPool ¶
type TCPSessionPool struct {
// contains filtered or unexported fields
}
TCPSessionPool TCP会话池
func GetTCPSessionPoolInstance ¶
func GetTCPSessionPoolInstance() *TCPSessionPool
GetTCPSessionPoolInstance 获取单实例
func (*TCPSessionPool) Return ¶
func (object *TCPSessionPool) Return(tcpSession *TCPSession)
Return 退还TCP会话
Click to show internal directories.
Click to hide internal directories.