Documentation ¶
Overview ¶
github.com/whatap/golib/net
Index ¶
- Constants
- func GetWhatapHosts(host string, portStr string) []string
- func UdpShutdown()
- type EmptyTcpClient
- type Initializer
- type TcpClient
- type TcpClientConfig
- type TcpClientOption
- type TcpSend
- type UdpClient
- func (this *UdpClient) AddCount(packCount, chanCount, sendCount, flushErrCount, errCount int, reset bool)
- func (this *UdpClient) Close()
- func (this *UdpClient) GetLocalAddr() net.Addr
- func (this *UdpClient) Send(p udp.UdpPack)
- func (this *UdpClient) SendRelay(p pack.Pack, flush bool)
- func (this *UdpClient) Shutdown()
- type UdpClientConfig
- type UdpData
- type WhatapTcpServerInfo
Constants ¶
View Source
const ( UDP_READ_MAX = 64 * 1024 UDP_PACKET_BUFFER = 64 * 1024 UDP_PACKET_BUFFER_CHUNKED_LIMIT = 63 * 1024 UDP_PACKET_CHANNEL_MAX = 1024 UDP_PACKET_FLUSH_TIMEOUT = 10 * 1000 UDP_PACKET_HEADER_SIZE = 9 // typ pos 0 UDP_PACKET_HEADER_TYPE_POS = 0 // ver pos 1 UDP_PACKET_HEADER_VER_POS = 1 // len pos 5 UDP_PACKET_HEADER_LEN_POS = 5 UDP_PACKET_SQL_MAX_SIZE = 32768 )
Variables ¶
This section is empty.
Functions ¶
func GetWhatapHosts ¶
func UdpShutdown ¶
func UdpShutdown()
Types ¶
type EmptyTcpClient ¶
type EmptyTcpClient struct{}
Emtyp TcpClient , use without nil check
func (*EmptyTcpClient) Close ¶
func (tc *EmptyTcpClient) Close() error
func (*EmptyTcpClient) Connect ¶
func (tc *EmptyTcpClient) Connect() error
func (*EmptyTcpClient) Send ¶
func (tc *EmptyTcpClient) Send(p pack.Pack, opts ...TcpClientOption) error
func (*EmptyTcpClient) SendFlush ¶
func (tc *EmptyTcpClient) SendFlush(p pack.Pack, flush bool, opts ...TcpClientOption) error
type Initializer ¶
type Initializer interface {
Init() error
}
type TcpClientConfig ¶ added in v0.0.15
type TcpClientOption ¶ added in v0.0.15
type TcpClientOption interface {
Apply(conf *TcpClientConfig)
}
func WithLicense ¶ added in v0.0.15
func WithLicense(license string) TcpClientOption
func WithPriority ¶ added in v0.0.15
func WithPriority(b bool) TcpClientOption
func WithSecureFlag ¶ added in v0.0.15
func WithSecureFlag(flag byte) TcpClientOption
type UdpClient ¶
type UdpClient struct {
// contains filtered or unexported fields
}
func GetUdpClient ¶
func GetUdpClient() *UdpClient
func (*UdpClient) GetLocalAddr ¶
type UdpClientConfig ¶ added in v0.0.15
type UdpClientConfig struct { Log logger.Logger Timeout time.Duration Debug bool NetUdpHost string NetUdpPort int Server string UseQueue bool ConfigObserver *config.ConfigObserver // contains filtered or unexported fields }
func (*UdpClientConfig) ApplyConfig ¶ added in v0.0.15
func (udpConfig *UdpClientConfig) ApplyConfig(m map[string]string)
type WhatapTcpServerInfo ¶
func NewWhatapTcpServerInfo ¶
func NewWhatapTcpServerInfo(license, host, portStr, pcode, oname string) *WhatapTcpServerInfo
Click to show internal directories.
Click to hide internal directories.