Documentation ¶
Index ¶
- Variables
- func B2S(b []byte) string
- func ChineseLength(str string, limit int) int
- func ChunkString(s string, chunkSize int) []string
- func ComputeMd5AndLength(r io.Reader) ([]byte, int64)
- func HTTPGetReadCloser(url string, cookie string) (io.ReadCloser, error)
- func HttpGetBytes(url, cookie string) ([]byte, error)
- func HttpPostBytes(url string, data []byte) ([]byte, error)
- func HttpPostBytesWithCookie(url string, data []byte, cookie string, contentType ...string) ([]byte, error)
- func IsChanClosed(ch interface{}) bool
- func MultiReadSeeker(r ...io.ReadSeeker) io.ReadSeeker
- func NewGzipReadCloser(reader io.ReadCloser) (io.ReadCloser, error)
- func RandomString(len int) string
- func RandomStringRange(len int, str string) string
- func S2B(s string) (b []byte)
- func Select(a, b []byte) []byte
- func ToGroupCode(groupUin int64) int64
- func ToGroupUin(groupCode int64) int64
- type Cache
- type TCPListener
- func (t *TCPListener) Close()
- func (t *TCPListener) Connect(addr *net.TCPAddr) error
- func (t *TCPListener) PlanedDisconnect(f func(*TCPListener))
- func (t *TCPListener) ReadBytes(len int) ([]byte, error)
- func (t *TCPListener) ReadInt32() (int32, error)
- func (t *TCPListener) UnexpectedDisconnect(f func(*TCPListener, error))
- func (t *TCPListener) Write(buf []byte) error
Constants ¶
This section is empty.
Variables ¶
var ErrConnectionClosed = errors.New("connection closed")
Functions ¶
func B2S ¶
B2S converts byte slice to a string without memory allocation. See https://groups.google.com/forum/#!msg/Golang-Nuts/ENgbUzYvCuU/90yGx7GUAgAJ . from github.com/savsgio/gotils/strconv
func ChineseLength ¶
func ChunkString ¶
func HTTPGetReadCloser ¶
func HTTPGetReadCloser(url string, cookie string) (io.ReadCloser, error)
HTTPGetReadCloser 从 Http url 获取 io.ReadCloser
func HttpGetBytes ¶
HttpGetBytes 带 cookie 的 GET 请求
func HttpPostBytesWithCookie ¶
func IsChanClosed ¶
func IsChanClosed(ch interface{}) bool
func MultiReadSeeker ¶
func MultiReadSeeker(r ...io.ReadSeeker) io.ReadSeeker
func NewGzipReadCloser ¶
func NewGzipReadCloser(reader io.ReadCloser) (io.ReadCloser, error)
NewGzipReadCloser 从 io.ReadCloser 创建 gunzip io.ReadCloser
func RandomString ¶
func RandomStringRange ¶
func S2B ¶
S2B converts string to a byte slice without memory allocation.
Note it may break if string and/or slice header will change in the future go versions.
func ToGroupCode ¶
func ToGroupUin ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache - simple implementation of cache More information: https://en.wikipedia.org/wiki/Time_to_live
func NewCache ¶
NewCache - initialization of new cache. For avoid mistake - minimal time to live is 1 minute. For simplification, - key is string and cache haven`t stop method
func (*Cache) GetAndUpdate ¶
type TCPListener ¶
type TCPListener struct {
// contains filtered or unexported fields
}
func (*TCPListener) Close ¶
func (t *TCPListener) Close()
func (*TCPListener) PlanedDisconnect ¶
func (t *TCPListener) PlanedDisconnect(f func(*TCPListener))
PlanedDisconnect 预料中的断开连接 如调用 Close() Connect()
func (*TCPListener) ReadInt32 ¶
func (t *TCPListener) ReadInt32() (int32, error)
func (*TCPListener) UnexpectedDisconnect ¶
func (t *TCPListener) UnexpectedDisconnect(f func(*TCPListener, error))
UnexpectedDisconnect 未预料钟的断开连接
func (*TCPListener) Write ¶
func (t *TCPListener) Write(buf []byte) error