mq_util

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CLIENT_CMD_ADD string = "ADD"
	CLIENT_CMD_DEL string = "DEL"
)
View Source
const (
	CHANNEL_PREFIX string = "sdp-wg-channel"
)

Variables

This section is empty.

Functions

func GetPopPubSubChannel

func GetPopPubSubChannel(popId string) string

Types

type CLIENT_OP_CMD

type CLIENT_OP_CMD string

type ClientCacheInfo

type ClientCacheInfo struct {
	IP        string // CIDR format?
	PublicKey string
	PSK       string
	ClientId  string // 可以是client-id/pop-id/connector-id
	Type      uint8  // pop/connector/client, pop service订阅消息,需要知道对端是什么类型,他没有访问数据库的权限

}

Client can be pop/connector/client 对pop而言,连接到当前pop的所有设备(包括client/pop/connector)都可以看做是pop的client 对client而言,一个client id同时只能有一个client在线,多个uid也不行, 需要UID的话,可以从db里面获取,而不是从cache里,handlerClientLogin 发生在登录的时候,可以拿到client对应的user的info

func GetClientDelCmd

func GetClientDelCmd(b64 string) (fullCmd string, clientCacheInfo *ClientCacheInfo, err error)

func ParseClientB64

func ParseClientB64(b64 string) (decoded string, clientCacheInfo *ClientCacheInfo, err error)

func ParseClientCmd

func ParseClientCmd(fullCmd string) (string, *ClientCacheInfo)

func (*ClientCacheInfo) GetClientAddCmd

func (c *ClientCacheInfo) GetClientAddCmd() (fullCmd, b64 string)

func (*ClientCacheInfo) GetClientB64

func (c *ClientCacheInfo) GetClientB64() (raw, b64 string)

func (*ClientCacheInfo) GetClientWgPeer

func (c *ClientCacheInfo) GetClientWgPeer(toRemove bool) (peerConfig *wg_core.WgPeer, err error)

peer is client

type MqPubSub

type MqPubSub struct {
	// contains filtered or unexported fields
}

func NewMqPubSub

func NewMqPubSub(cache cache.Cache) *MqPubSub

func (*MqPubSub) PublishCmd

func (c *MqPubSub) PublishCmd(popId, fullCmd string) error

type PopCacheInfo

type PopCacheInfo struct {
	LastActive time.Time // check status

}

pop info can get from db

Jump to

Keyboard shortcuts

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