Documentation ¶
Index ¶
- Constants
- Variables
- func GetPCPRPCPool(getAddress GetAddress, generateSandbox GenerateSandbox, poolSize int, ...) *gopool.Pool
- func GetPCPRPCServer(port int, generateSandbox GenerateSandbox, cer func() *ConnectionEvent) (*goaio.TcpServer, error)
- func JSONMarshal(t interface{}) ([]byte, error)
- func TextToPkt(text string) []byte
- type CallChannel
- type CommandData
- type CommandPkt
- type ConnectionEvent
- type GenerateSandbox
- type GetAddress
- type GetTcpConn
- type OnConnectedHandler
- type PCPConnectionHandler
- func (p *PCPConnectionHandler) Call(list gopcp.CallResult, timeout time.Duration) (interface{}, error)
- func (p *PCPConnectionHandler) CallRemote(command string, timeout time.Duration) (interface{}, error)
- func (p *PCPConnectionHandler) Clean()
- func (p *PCPConnectionHandler) Close()
- func (p *PCPConnectionHandler) OnData(chunk []byte)
- type PackageProtocol
Constants ¶
View Source
const STREAM_ACCEPT_NAME = "__stream_accept"
Variables ¶
View Source
var REQUEST_C_TYPE = "purecall-request"
View Source
var RESPONSE_C_TYPE = "purecall-response"
Functions ¶
func GetPCPRPCPool ¶
func GetPCPRPCPool(getAddress GetAddress, generateSandbox GenerateSandbox, poolSize int, duration time.Duration, retryDuration time.Duration) *gopool.Pool
build pcp pool based on the tcp client
func GetPCPRPCServer ¶
func GetPCPRPCServer(port int, generateSandbox GenerateSandbox, cer func() *ConnectionEvent) (*goaio.TcpServer, error)
build pcp rpc server based on the tcp server itself
func JSONMarshal ¶
Types ¶
type CallChannel ¶
type CallChannel struct {
// contains filtered or unexported fields
}
type CommandData ¶
type CommandPkt ¶
type CommandPkt struct { Id string `json:"id"` Ctype string `json:"ctype"` Data CommandData `json:"data"` }
type ConnectionEvent ¶
type ConnectionEvent struct { OnClose goaio.OnCloseHandler OnConnected OnConnectedHandler }
connection onConnected, onClose
type GenerateSandbox ¶
type GenerateSandbox = func(*gopcp_stream.StreamServer) *gopcp.Sandbox
type GetTcpConn ¶
type GetTcpConn = func(goaio.BytesReadHandler, goaio.OnCloseHandler) (goaio.ConnectionHandler, error)
generic connection interface for tcp client and server both
type OnConnectedHandler ¶
type OnConnectedHandler = func(*PCPConnectionHandler)
type PCPConnectionHandler ¶
type PCPConnectionHandler struct { PcpClient gopcp.PcpClient ConnHandler *goaio.ConnectionHandler StreamClient *gopcp_stream.StreamClient // contains filtered or unexported fields }
func GetPCPRPCClient ¶
func GetPCPRPCClient(host string, port int, generateSandbox GenerateSandbox, onClose goaio.OnCloseHandler) (*PCPConnectionHandler, error)
build pcp client based on the tcp client itself
func GetPcpConnectionHandlerFromTcpConn ¶
func GetPcpConnectionHandlerFromTcpConn(t int, generateSandbox GenerateSandbox, getTcpConn GetTcpConn) (*PCPConnectionHandler, error)
func (*PCPConnectionHandler) Call ¶
func (p *PCPConnectionHandler) Call(list gopcp.CallResult, timeout time.Duration) (interface{}, error)
func (*PCPConnectionHandler) CallRemote ¶
func (p *PCPConnectionHandler) CallRemote(command string, timeout time.Duration) (interface{}, error)
func (*PCPConnectionHandler) Clean ¶
func (p *PCPConnectionHandler) Clean()
func (*PCPConnectionHandler) Close ¶
func (p *PCPConnectionHandler) Close()
func (*PCPConnectionHandler) OnData ¶
func (p *PCPConnectionHandler) OnData(chunk []byte)
type PackageProtocol ¶
type PackageProtocol struct {
// contains filtered or unexported fields
}
func GetPackageProtocol ¶
func GetPackageProtocol() *PackageProtocol
func (*PackageProtocol) GetPktText ¶
func (p *PackageProtocol) GetPktText(data []byte) []string
func (*PackageProtocol) Reset ¶
func (p *PackageProtocol) Reset()
func (*PackageProtocol) SendPackage ¶
func (p *PackageProtocol) SendPackage(connHandler *goaio.ConnectionHandler, text string) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.