Documentation ¶
Index ¶
- Constants
- func Mylog(b bool, module string, v ...interface{})
- func SetMaxDownloadRate(rate uint64)
- func SetMaxUploadRate(rate uint64)
- type ClientConn
- func (cc *ClientConn) ClientClose(closeLowLayerConn bool)
- func (cc *ClientConn) Close()
- func (cc *ClientConn) ContextValue(k interface{}) interface{}
- func (cc *ClientConn) GetIP() string
- func (cc *ClientConn) GetInboundAndReset() int64
- func (cc *ClientConn) GetIsActive() bool
- func (cc *ClientConn) GetLocalAddr() string
- func (cc *ClientConn) GetLocalP2pAddress() string
- func (cc *ClientConn) GetName() string
- func (cc *ClientConn) GetNetID() int64
- func (cc *ClientConn) GetOutboundAndReset() int64
- func (cc *ClientConn) GetPort() string
- func (cc *ClientConn) GetRemoteAddr() string
- func (cc *ClientConn) GetRemoteP2pAddress() string
- func (cc *ClientConn) GetSecondReadFlow() int64
- func (cc *ClientConn) GetSecondWriteFlow() int64
- func (cc *ClientConn) SetConnName(name string)
- func (cc *ClientConn) SetContextValue(k, v interface{})
- func (cc *ClientConn) SetWriteHook(h []WriteHook)
- func (cc *ClientConn) Start()
- func (cc *ClientConn) Write(message *msg.RelayMsgBuf, ctx context.Context) error
- type ClientOption
- func BufferSizeOption(indicator int) ClientOption
- func ContextKVOption(kv []ContextKV) ClientOption
- func HeartCloseOption(b bool) ClientOption
- func LogOpenOption(b bool) ClientOption
- func MinAppVersionOption(b uint16) ClientOption
- func OnCloseOption(cb func(core.WriteCloser)) ClientOption
- func OnConnectOption(cb func(core.WriteCloser) bool) ClientOption
- func OnErrorOption(cb func(core.WriteCloser)) ClientOption
- func OnMessageOption(cb func(msg.RelayMsgBuf, core.WriteCloser)) ClientOption
- func P2pAddressOption(p2pAddress string) ClientOption
- func ReconnectOption(rec bool) ClientOption
- func ServerIpOption(serverIp net.IP) ClientOption
- func ServerPortOption(serverPort uint16) ClientOption
- type ContextKV
- type MsgHandler
- type WriteHook
Constants ¶
View Source
const ( LOG_MODULE_START = "start: " LOG_MODULE_WRITELOOP = "writeLoop: " LOG_MODULE_READLOOP = "readLoop: " LOG_MODULE_HANDLELOOP = "handleLoop: " LOG_MODULE_CLOSE = "close: " )
Variables ¶
This section is empty.
Functions ¶
func SetMaxDownloadRate ¶ added in v0.10.0
func SetMaxDownloadRate(rate uint64)
func SetMaxUploadRate ¶ added in v0.10.0
func SetMaxUploadRate(rate uint64)
Types ¶
type ClientConn ¶
type ClientConn struct {
// contains filtered or unexported fields
}
func CreateClientConn ¶
func CreateClientConn(netid int64, addr string, opt ...ClientOption) *ClientConn
func (*ClientConn) ClientClose ¶
func (cc *ClientConn) ClientClose(closeLowLayerConn bool)
ClientClose Actively closes the client connection
func (*ClientConn) Close ¶
func (cc *ClientConn) Close()
func (*ClientConn) ContextValue ¶
func (cc *ClientConn) ContextValue(k interface{}) interface{}
func (*ClientConn) GetInboundAndReset ¶ added in v0.5.0
func (cc *ClientConn) GetInboundAndReset() int64
func (*ClientConn) GetIsActive ¶ added in v0.9.0
func (cc *ClientConn) GetIsActive() bool
func (*ClientConn) GetLocalAddr ¶ added in v0.5.0
func (cc *ClientConn) GetLocalAddr() string
func (*ClientConn) GetLocalP2pAddress ¶ added in v0.8.0
func (cc *ClientConn) GetLocalP2pAddress() string
func (*ClientConn) GetName ¶
func (cc *ClientConn) GetName() string
func (*ClientConn) GetNetID ¶
func (cc *ClientConn) GetNetID() int64
func (*ClientConn) GetOutboundAndReset ¶ added in v0.5.0
func (cc *ClientConn) GetOutboundAndReset() int64
func (*ClientConn) GetPort ¶
func (cc *ClientConn) GetPort() string
func (*ClientConn) GetRemoteAddr ¶ added in v0.5.0
func (cc *ClientConn) GetRemoteAddr() string
func (*ClientConn) GetRemoteP2pAddress ¶ added in v0.8.0
func (cc *ClientConn) GetRemoteP2pAddress() string
func (*ClientConn) GetSecondReadFlow ¶
func (cc *ClientConn) GetSecondReadFlow() int64
func (*ClientConn) GetSecondWriteFlow ¶
func (cc *ClientConn) GetSecondWriteFlow() int64
func (*ClientConn) SetConnName ¶
func (cc *ClientConn) SetConnName(name string)
func (*ClientConn) SetContextValue ¶
func (cc *ClientConn) SetContextValue(k, v interface{})
func (*ClientConn) SetWriteHook ¶ added in v0.9.0
func (cc *ClientConn) SetWriteHook(h []WriteHook)
func (*ClientConn) Start ¶
func (cc *ClientConn) Start()
Start client starts readLoop, writeLoop, handleLoop
func (*ClientConn) Write ¶
func (cc *ClientConn) Write(message *msg.RelayMsgBuf, ctx context.Context) error
type ClientOption ¶
type ClientOption func(*options)
ClientOption client configuration
func BufferSizeOption ¶
func BufferSizeOption(indicator int) ClientOption
func ContextKVOption ¶ added in v0.9.0
func ContextKVOption(kv []ContextKV) ClientOption
func HeartCloseOption ¶
func HeartCloseOption(b bool) ClientOption
func LogOpenOption ¶
func LogOpenOption(b bool) ClientOption
func MinAppVersionOption ¶ added in v0.7.0
func MinAppVersionOption(b uint16) ClientOption
func OnCloseOption ¶
func OnCloseOption(cb func(core.WriteCloser)) ClientOption
func OnConnectOption ¶
func OnConnectOption(cb func(core.WriteCloser) bool) ClientOption
func OnErrorOption ¶
func OnErrorOption(cb func(core.WriteCloser)) ClientOption
func OnMessageOption ¶
func OnMessageOption(cb func(msg.RelayMsgBuf, core.WriteCloser)) ClientOption
func P2pAddressOption ¶ added in v0.8.0
func P2pAddressOption(p2pAddress string) ClientOption
P2pAddressOption sets the local P2P address for this conn
func ReconnectOption ¶
func ReconnectOption(rec bool) ClientOption
func ServerIpOption ¶ added in v0.11.0
func ServerIpOption(serverIp net.IP) ClientOption
ServerIpOption sets the IP used by the server conn when establishing the handshake
func ServerPortOption ¶ added in v0.8.0
func ServerPortOption(serverPort uint16) ClientOption
ServerPortOption sets the port used by the local p2p server
type MsgHandler ¶
type MsgHandler struct {
// contains filtered or unexported fields
}
type WriteHook ¶ added in v0.9.0
type WriteHook struct { MessageId uint8 Fn core.WriteHookFunc }
Click to show internal directories.
Click to hide internal directories.