Documentation ¶
Index ¶
- Constants
- func AddConnInfo(id string, proto string, conn net.Conn, netWorker INetWorker) error
- func AllNodes() []string
- func AllNodesAndPeers() []string
- func AllPeers() []string
- func AutoPing()
- func CombineOriginInfo(id string, url string, sig string) string
- func EOF(err error) bool
- func GetInfoIdByConn(conn net.Conn) (string, bool)
- func IsLocalIPv4(ip string) error
- func IsPeer(id string) bool
- func Label(id string) string
- func LocalIPv4s() ([]string, error)
- func NodeConned(id string) bool
- func Nodes(label string) []string
- func ParserOriginInfo(origin string) (string, string, string, error)
- func RanPeerId() string
- func RemoveConnInfo(id string)
- func ResetConnState(id string, msg []byte) bool
- type ConnInfos
- type ConnState
- type INetEventListener
- type INetWorker
- type KcpNetWorker
- func (k *KcpNetWorker) BindEventListener(eventListener INetEventListener) error
- func (k *KcpNetWorker) Close(id string, conn net.Conn) error
- func (k *KcpNetWorker) Connect(id string, url string, origin string) error
- func (k *KcpNetWorker) Listen(url string) error
- func (k *KcpNetWorker) Send(conn net.Conn, msg []byte) error
- func (k *KcpNetWorker) SendText(conn net.Conn, str string) error
- type TcpBuffer
- func (t *TcpBuffer) AddDataLen(count int)
- func (t *TcpBuffer) Buffer() []byte
- func (t *TcpBuffer) Capcity() int
- func (t *TcpBuffer) Clear()
- func (t *TcpBuffer) Count() int
- func (t *TcpBuffer) DeleteData(count int)
- func (t *TcpBuffer) Dispose()
- func (t *TcpBuffer) Offset() int
- func (t *TcpBuffer) Reset()
- func (t *TcpBuffer) Slice() []byte
- type TcpNetWorker
- func (t *TcpNetWorker) BindEventListener(eventListener INetEventListener) error
- func (t *TcpNetWorker) Close(id string, conn net.Conn) error
- func (t *TcpNetWorker) Connect(id string, url string, origin string) error
- func (t *TcpNetWorker) Listen(url string) error
- func (t *TcpNetWorker) Send(conn net.Conn, msg []byte) error
- func (t *TcpNetWorker) SendText(conn net.Conn, str string) error
- type WSNetWorker
- func (w *WSNetWorker) BindEventListener(eventListener INetEventListener) error
- func (w *WSNetWorker) Close(id string, conn net.Conn) error
- func (w *WSNetWorker) Connect(id string, url string, origin string) error
- func (w *WSNetWorker) Listen(url string) error
- func (w *WSNetWorker) Send(conn net.Conn, msg []byte) error
- func (w *WSNetWorker) SendText(conn net.Conn, str string) error
Constants ¶
View Source
const ( None string = "none" WS string = "ws" TCP string = "tcp" KCP string = "kcp" HTTP string = "http" )
View Source
const ( PCK_MIN_SIZE int = 6 // |--- header 4bytes ---|--- length 2 bytes ---|--- other datas --- .... PCK_HEADER int32 = 0x2123676f // !#go )
Variables ¶
This section is empty.
Functions ¶
func AddConnInfo ¶
func AllNodesAndPeers ¶
func AllNodesAndPeers() []string
func IsLocalIPv4 ¶
func LocalIPv4s ¶
func NodeConned ¶
func RemoveConnInfo ¶
func RemoveConnInfo(id string)
func ResetConnState ¶
Types ¶
type INetEventListener ¶
type INetWorker ¶
type INetWorker interface { Listen(url string) error Connect(id string, url string, origin string) error Send(conn net.Conn, msg []byte) error SendText(conn net.Conn, str string) error Close(id string, conn net.Conn) error BindEventListener(eventListener INetEventListener) error }
func GetInfoConnById ¶
type KcpNetWorker ¶
type KcpNetWorker struct {
// contains filtered or unexported fields
}
func NewKcpNetWorker ¶
func NewKcpNetWorker() *KcpNetWorker
func (*KcpNetWorker) BindEventListener ¶
func (k *KcpNetWorker) BindEventListener(eventListener INetEventListener) error
func (*KcpNetWorker) Connect ¶
func (k *KcpNetWorker) Connect(id string, url string, origin string) error
func (*KcpNetWorker) Listen ¶
func (k *KcpNetWorker) Listen(url string) error
type TcpBuffer ¶
type TcpBuffer struct {
// contains filtered or unexported fields
}
func NewTcpBuffer ¶
func (*TcpBuffer) AddDataLen ¶
func (*TcpBuffer) DeleteData ¶
type TcpNetWorker ¶
type TcpNetWorker struct {
// contains filtered or unexported fields
}
func NewTcpNetWorker ¶
func NewTcpNetWorker() *TcpNetWorker
func (*TcpNetWorker) BindEventListener ¶
func (t *TcpNetWorker) BindEventListener(eventListener INetEventListener) error
func (*TcpNetWorker) Connect ¶
func (t *TcpNetWorker) Connect(id string, url string, origin string) error
func (*TcpNetWorker) Listen ¶
func (t *TcpNetWorker) Listen(url string) error
type WSNetWorker ¶
type WSNetWorker struct {
// contains filtered or unexported fields
}
func NewWSNetWorker ¶
func NewWSNetWorker() *WSNetWorker
func (*WSNetWorker) BindEventListener ¶
func (w *WSNetWorker) BindEventListener(eventListener INetEventListener) error
func (*WSNetWorker) Connect ¶
func (w *WSNetWorker) Connect(id string, url string, origin string) error
func (*WSNetWorker) Listen ¶
func (w *WSNetWorker) Listen(url string) error
Click to show internal directories.
Click to hide internal directories.