util

package
v0.0.0-...-520fe4f Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Send pings to peer with this period. Must be less than pongWait.
	PingPeriod = (pongWait * 9) / 10

	// Maximum message size allowed from peer.
	MaxMessageSize = 1024
)
View Source
const Secret = "xxf223"

Variables

This section is empty.

Functions

func AESCBCEncrypt

func AESCBCEncrypt(plainText []byte, signalingKey string) (encryptPlainText []byte, err error)

func AuthorizationHeader

func AuthorizationHeader(key string, c echo.Context) (ok bool, err error)

func BytesCombine

func BytesCombine(pBytes ...[]byte) []byte

func BytesToInt

func BytesToInt(b []byte) int64

字节转换成整形

func GenerateAttachmentId

func GenerateAttachmentId() (int64, error)

生成附件ID

func GenerateHMAC

func GenerateHMAC(message, key []byte) []byte

func HeaderParams

func HeaderParams(c echo.Context) (hs *headerSort, checkSignStr string)

func IntToBytes

func IntToBytes(n int64) []byte

整形转换成字节

func IsValidNumber

func IsValidNumber(phone string) bool

验证手机号码格式

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

func SignAuth

func SignAuth(c echo.Context) (check bool, err error)

Types

type Client

type Client struct {
	Hub  *Hub
	Conn *websocket.Conn
	Send chan []byte
	Id   string
}

func (*Client) ReadPump

func (c *Client) ReadPump()

func (*Client) WritePump

func (c *Client) WritePump()

type Hub

type Hub struct {
	// Registered clients.
	Clients map[*Client]bool

	// Inbound messages from the clients.
	Broadcast chan []byte

	// Register requests from the clients.
	Register chan *Client

	// Unregister requests from clients.
	Unregister chan *Client

	// Unregister requests from clients.
	SendSingle chan *SingleMessage
}

hub maintains the set of active clients and broadcasts messages to the clients.

func NewHub

func NewHub() *Hub

func (*Hub) Run

func (h *Hub) Run()

type SingleMessage

type SingleMessage struct {
	Id      string
	Message []byte
}

Jump to

Keyboard shortcuts

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