aplugin

package
v0.0.0-...-68b20d9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Auth = iota + 1 // 连接鉴权
	Sub             // 设备订阅校验
	Pub             // 设备发布校验
	UnSub
	Connected
	Closed
)
View Source
const Name = "aplugin"

Variables

View Source
var DefaultConfig = Config{}

DefaultConfig is the default configuration.

Functions

func New

func New(config config.Config) (server.Plugin, error)

Types

type APlugin

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

func (*APlugin) HookWrapper

func (t *APlugin) HookWrapper() server.HookWrapper

func (*APlugin) Load

func (t *APlugin) Load(service server.Server) error

func (*APlugin) Name

func (t *APlugin) Name() string

func (*APlugin) OnBasicAuthWrapper

func (t *APlugin) OnBasicAuthWrapper(pre server.OnBasicAuth) server.OnBasicAuth

func (*APlugin) OnClosedWrapper

func (t *APlugin) OnClosedWrapper(pre server.OnClosed) server.OnClosed

func (*APlugin) OnConnectedWrapper

func (t *APlugin) OnConnectedWrapper(pre server.OnConnected) server.OnConnected

func (*APlugin) OnMsgArrivedWrapper

func (t *APlugin) OnMsgArrivedWrapper(pre server.OnMsgArrived) server.OnMsgArrived

func (*APlugin) OnSubscribeWrapper

func (t *APlugin) OnSubscribeWrapper(pre server.OnSubscribe) server.OnSubscribe

func (*APlugin) OnUnsubscribeWrapper

func (t *APlugin) OnUnsubscribeWrapper(pre server.OnUnsubscribe) server.OnUnsubscribe

func (*APlugin) Unload

func (t *APlugin) Unload() error

type AsyncMsg

type AsyncMsg struct {
	Id   int64
	Type int             // 1:连接鉴权,2:设备订阅校验,3:设备发布校验,4:unsub,6:closed
	Data json.RawMessage // auth ack sub ack pub ack
}

AsyncMsg 异步消息统一收发

type AuthCheck

type AuthCheck struct {
	ClientId string
	Username string
	Password string
	Pass     bool
	Msg      string
}

type ClosedNotify

type ClosedNotify struct {
	ClientId string
	Username string
}

ClosedNotify 三方设备或服务断开连接后通知对应驱动

type Config

type Config struct {
}

Config is the configuration for the aplugin plugin.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration, and return an error if it is invalid.

type ConnectedNotify

type ConnectedNotify struct {
	ClientId string
	Username string
	IP       string
	Port     string
}

ConnectedNotify 三方设备或服务连接成功后通知对应驱动

type DriverClient

type DriverClient struct {
	ClientId  string
	Username  string
	PubTopic  string
	SubTopic  string
	ClientMap map[string]*ThirdClient // key is clientId
	// contains filtered or unexported fields
}

func (*DriverClient) AddThirdClient

func (dc *DriverClient) AddThirdClient(client server.Client)

func (*DriverClient) DeleteThirdClient

func (dc *DriverClient) DeleteThirdClient(clientId string)

type MsgAckChan

type MsgAckChan struct {
	Mu       sync.Mutex
	Id       int64
	IsClosed bool
	DataChan chan interface{} // auth ack, device sub ack, device pub ack
}

type PubTopic

type PubTopic struct {
	ClientId string
	Username string
	Topic    string
	QoS      byte
	Retained bool
	Pass     bool
	Msg      string
}

type PublishInfo

type PublishInfo struct {
	Topic   string
	Payload []byte
}

type SubTopic

type SubTopic struct {
	Topic string
	QoS   byte
	Pass  bool
	Msg   string
}

SubTopic 三方设备或服务订阅topic校验

type SubTopics

type SubTopics struct {
	ClientId string
	Username string
	Topics   []SubTopic
}

SubTopic 三方设备或服务订阅topic校验

type ThirdClient

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

func (*ThirdClient) AddTopics

func (tc *ThirdClient) AddTopics(topics []string, t int)

func (*ThirdClient) CheckTopic

func (tc *ThirdClient) CheckTopic(topic string, t int) bool

func (*ThirdClient) DeleteTopics

func (tc *ThirdClient) DeleteTopics(topics []string, t int)

type UnSubNotify

type UnSubNotify struct {
	ClientId string
	Username string
	Topics   []string
}

Directories

Path Synopsis
Package snowflake provides a very simple Twitter snowflake generator and parser.
Package snowflake provides a very simple Twitter snowflake generator and parser.

Jump to

Keyboard shortcuts

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