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 OnHandleOption(cb func(context.Context, *msg.RelayMsgBuf)) ClientOption
- func OnReadOption(cb func(*msg.RelayMsgBuf)) ClientOption
- func OnWriteOption(cb func(context.Context, *msg.RelayMsgBuf)) ClientOption
- func P2pAddressOption(p2pAddress string) ClientOption
- func ReadDeadlineOption(timeout int64) 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 ¶
func SetMaxDownloadRate(rate uint64)
func SetMaxUploadRate ¶
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 ¶
func (cc *ClientConn) GetInboundAndReset() int64
func (*ClientConn) GetIsActive ¶
func (cc *ClientConn) GetIsActive() bool
func (*ClientConn) GetLocalAddr ¶
func (cc *ClientConn) GetLocalAddr() string
func (*ClientConn) GetLocalP2pAddress ¶
func (cc *ClientConn) GetLocalP2pAddress() string
func (*ClientConn) GetName ¶
func (cc *ClientConn) GetName() string
func (*ClientConn) GetNetID ¶
func (cc *ClientConn) GetNetID() int64
func (*ClientConn) GetOutboundAndReset ¶
func (cc *ClientConn) GetOutboundAndReset() int64
func (*ClientConn) GetPort ¶
func (cc *ClientConn) GetPort() string
func (*ClientConn) GetRemoteAddr ¶
func (cc *ClientConn) GetRemoteAddr() string
func (*ClientConn) GetRemoteP2pAddress ¶
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 ¶
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 ¶
func ContextKVOption(kv []ContextKV) ClientOption
func HeartCloseOption ¶
func HeartCloseOption(b bool) ClientOption
func LogOpenOption ¶
func LogOpenOption(b bool) ClientOption
func MinAppVersionOption ¶
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 OnHandleOption ¶
func OnHandleOption(cb func(context.Context, *msg.RelayMsgBuf)) ClientOption
func OnReadOption ¶
func OnReadOption(cb func(*msg.RelayMsgBuf)) ClientOption
func OnWriteOption ¶
func OnWriteOption(cb func(context.Context, *msg.RelayMsgBuf)) ClientOption
func P2pAddressOption ¶
func P2pAddressOption(p2pAddress string) ClientOption
P2pAddressOption sets the local P2P address for this conn
func ReadDeadlineOption ¶
func ReadDeadlineOption(timeout int64) ClientOption
func ReconnectOption ¶
func ReconnectOption(rec bool) ClientOption
func ServerIpOption ¶
func ServerIpOption(serverIp net.IP) ClientOption
ServerIpOption sets the IP used by the server conn when establishing the handshake
func ServerPortOption ¶
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 ¶
type WriteHook struct { MessageId uint8 Fn core.WriteHookFunc }
Click to show internal directories.
Click to hide internal directories.