golwpush

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MIT Imports: 16 Imported by: 0

README

golwpush

Go Version Go Report Card

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConnAddCh chan<- *Conn = connAddCh0

	ConnRmCh chan<- *Conn = connRmCh0

	Broadcast chan<- string = broadcast0

	MultiPushCh chan<- *Contents = multiPushCh0

	PushCh chan<- Content = pushCh0

	BizCh chan<- BizReq = bizCh0
)

Functions

func AuthCli

func AuthCli(conn net.Conn) (uid uint64, err error)

func Handle

func Handle()

func InitConn

func InitConn(tcpConn net.Conn)

func LoadConnNum

func LoadConnNum() uint64

Types

type Adapter

type Adapter interface {
	SinglePush
	AllPush
	ConnManger
}
var (
	Default Adapter = defaultPush{/* contains filtered or unexported fields */}
)

type Addr

type Addr interface {
	net.Addr
	Uid() uint64
}

type AllPush

type AllPush interface {
	Broadcast(string) error
	MultiPush(cts *Contents) (error, uint64)
}

type BizReq

type BizReq struct {
	Res chan any
	Uid uint64
	Typ BizTyp
}

type BizTyp

type BizTyp int
const (
	Info BizTyp = iota
	Kick
)

type Conn

type Conn struct {
	Uid uint64

	Addr Addr
	// contains filtered or unexported fields
}

type ConnAddr

type ConnAddr struct {
	net.Addr
	// contains filtered or unexported fields
}

func (*ConnAddr) Uid

func (c *ConnAddr) Uid() uint64

type ConnInfo

type ConnInfo struct {
	UId      uint64 `json:"id"`
	Addr     string `json:"addr"`
	ConnTime string `json:"connectTime"`
}

type ConnManger

type ConnManger interface {
	Count() uint64
	Info(biz BizReq) (*ConnInfo, error)
}

type Content

type Content struct {
	Id  uint64
	Msg string
}

type Contents

type Contents struct {
	Ids []uint64 `json:"ids"`
	Msg string   `json:"msg"`
	Res chan uint64
}

type SinglePush

type SinglePush interface {
	Push(uint64, string) error
}

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

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