util

package
v0.0.0-...-b8dc67f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const BINARY_VERSION = "0.2.15"

Variables

This section is empty.

Functions

func ApiResponse

func ApiResponse(w http.ResponseWriter, statusCode int, statusTxt string, data interface{})

func GetChannelsForTopic

func GetChannelsForTopic(topic string, lookupdHTTPAddrs []string) ([]string, error)

func GetTopicChannelArgs

func GetTopicChannelArgs(rp *ReqParams) (string, string, error)

func StringAdd

func StringAdd(s []string, a string) []string

func StringUnion

func StringUnion(s []string, a []interface{}) []string

func TcpServer

func TcpServer(listener net.Listener, handler TcpHandler)

监听并连接不同的 handle

Types

type MockConn

type MockConn struct {
	io.ReadWriter
}

func (MockConn) Close

func (c MockConn) Close() error

func (MockConn) LocalAddr

func (c MockConn) LocalAddr() net.Addr

func (MockConn) RemoteAddr

func (c MockConn) RemoteAddr() net.Addr

func (MockConn) SetDeadline

func (c MockConn) SetDeadline(t time.Time) error

func (MockConn) SetReadDeadline

func (c MockConn) SetReadDeadline(t time.Time) error

func (MockConn) SetWriteDeadline

func (c MockConn) SetWriteDeadline(t time.Time) error

type ReqParams

type ReqParams struct {
	Body []byte
	// contains filtered or unexported fields
}

func NewReqParams

func NewReqParams(req *http.Request) (*ReqParams, error)

func (*ReqParams) Query

func (r *ReqParams) Query(key string) (string, error)

type StringArray

type StringArray []string

func (*StringArray) Set

func (a *StringArray) Set(s string) error

func (*StringArray) String

func (a *StringArray) String() string

type TcpHandler

type TcpHandler interface {
	Handle(net.Conn)
}

type WaitGroupWrapper

type WaitGroupWrapper struct {
	sync.WaitGroup
}

func (*WaitGroupWrapper) Wrap

func (w *WaitGroupWrapper) Wrap(cb func())

作用是异步的执行 cb

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL