Documentation ¶
Index ¶
- Variables
- func BytesMD5(data []byte) string
- func CompressBytes(data []byte) ([]byte, error)
- func DecompressBytes(data []byte) ([]byte, error)
- func DetectPort(addr string, fn func(a *Address, port int) (interface{}, error)) (interface{}, error)
- func FileExists(name string) bool
- func FileSize(name string) int64
- func GetLocalIP() string
- func GetPrivateIPv4() ([]*net.IPAddr, error)
- func GetPublicIPv6() ([]*net.IPAddr, error)
- func GetRemoteAddrss(ses cellnet.Session) (string, bool)
- func IsEOFOrNetReadError(err error) bool
- func JoinAddress(host string, port int) string
- func ReadFileLines(filename string, callback func(line string) bool) error
- func ReadKVFile(filename string, callback func(k, v string) bool) (ret error)
- func RecvLTVPacket(reader io.Reader, maxPacketSize int) (msg interface{}, err error)
- func SendLTVPacket(writer io.Writer, ctx cellnet.ContextSet, data interface{}) error
- func SpliteAddress(addr string) (host string, port int, err error)
- func StackToString(count int) string
- func StringHash(s string) (hash uint16)
- func StringMD5(str string) string
- func WriteFull(writer io.Writer, buf []byte) error
- type Address
- type KVPair
- type Queue
- type RemoteAddr
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMaxPacket = errors.New("packet over size") ErrMinPacket = errors.New("packet short size") ErrShortMsgID = errors.New("short msgid") )
View Source
var (
ErrInvalidPortRange = errors.New("invalid port range")
)
Functions ¶
func DetectPort ¶
func DetectPort(addr string, fn func(a *Address, port int) (interface{}, error)) (interface{}, error)
在给定的端口范围内找到一个能用的端口 addr格式参考ParseAddress函数
func ReadFileLines ¶
读取文本文件的所有行
func ReadKVFile ¶
读取=分割的配置文件
func RecvLTVPacket ¶
接收Length-Type-Value格式的封包流程
func SendLTVPacket ¶
func SendLTVPacket(writer io.Writer, ctx cellnet.ContextSet, data interface{}) error
发送Length-Type-Value格式的封包流程
func SpliteAddress ¶
将普通地址格式(host:port)拆分
Types ¶
type Address ¶
支持地址范围的格式
func ParseAddress ¶
cellnet专有的地址格式 scheme://host:minPort~maxPort/path 提供地址范围扩展
func (*Address) HostPortString ¶
返回(host:port)格式地址
type KVPair ¶
func ReadKVFileValues ¶
将=分割的文件按值读回
type RemoteAddr ¶
修复ws没有实现所有net.conn方法,导致无法获取客服端地址问题.
Click to show internal directories.
Click to hide internal directories.