service

package
v0.0.0-...-3596c24 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidConnectionType  error = errors.New("service: Invalid connection type")
	ErrInvalidSubscriber      error = errors.New("service: Invalid subscriber")
	ErrBufferNotReady         error = errors.New("service: buffer is not ready")
	ErrBufferInsufficientData error = errors.New("service: buffer has insufficient data.") //缓冲区数据不足。

)

Functions

func ExceededConnectionRateLimit

func ExceededConnectionRateLimit() bool

ExceededConnectionRateLimit 超出连接速率限制 CONNACK, DISCONNECT

func GetServerName

func GetServerName() string

func ServerBeingShutDown

func ServerBeingShutDown() bool

ServerBeingShutDown 服务端关闭中 DISCONNECT

func ServiceBusy

func ServiceBusy() bool

ServiceBusy 服务端正忙 CONNACK, DISCONNECT

func SetExceededConnectionRateLimit

func SetExceededConnectionRateLimit(ecrl bool)

func SetServerBeingShutDown

func SetServerBeingShutDown(sbsd bool)

func SetServiceBusy

func SetServiceBusy(sb bool)

func SetUnsupportedRetention

func SetUnsupportedRetention(ur bool)

func SetUnsupportedSharedSubscriptions

func SetUnsupportedSharedSubscriptions(uss bool)

func SetUnsupportedSubscriptionIdentifiers

func SetUnsupportedSubscriptionIdentifiers(sui bool)

func SetUnsupportedWildcardSubscriptions

func SetUnsupportedWildcardSubscriptions(uws bool)

func UnsupportedRetention

func UnsupportedRetention() bool

UnsupportedRetention 不支持保留 CONNACK, DISCONNECT

func UnsupportedSharedSubscriptions

func UnsupportedSharedSubscriptions() bool

UnsupportedSharedSubscriptions 不支持共享订阅 SUBACK, DISCONNECT

func UnsupportedSubscriptionIdentifiers

func UnsupportedSubscriptionIdentifiers() bool

UnsupportedSubscriptionIdentifiers 不支持订阅标识符 SUBACK, DISCONNECT

func UnsupportedWildcardSubscriptions

func UnsupportedWildcardSubscriptions() bool

UnsupportedWildcardSubscriptions 不支持通配符订阅 SUBACK, DISCONNECT

Types

type GCore

type GCore struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewGCore

func NewGCore(conn net.Conn, conMsg *message.ConnectMessage) *GCore

NewGCore 创建核心

func (*GCore) ClientId

func (core *GCore) ClientId() string

func (*GCore) Close

func (core *GCore) Close() error

func (*GCore) IsDone

func (core *GCore) IsDone() bool

type OnCompleteFunc

type OnCompleteFunc func(msg, ack message.Message, err error) error

OnCompleteFunc 完成的回调方法

type OnPublishFunc

type OnPublishFunc func(msg *message.PublishMessage, sub topic.Sub, sender string, shareMsg bool) error

OnPublishFunc 发布的func类型 sender表示当前发送消息的客户端是哪个,shareMsg=true表示是共享消息,不能被Local 操作

type Server

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

func NewServer

func NewServer(uri string) *Server

func (*Server) AddCloser

func (server *Server) AddCloser(close io.Closer)

func (*Server) ListenAndServe

func (server *Server) ListenAndServe() error

ListenAndServe 监听请求的URI上的连接,并处理任何连接 传入的MQTT客户机会话。 在调用Close()之前,它不应该返回 或者有一些关键的错误导致服务器停止运行。 URI 提供的格式应该是“protocol://host:port”,可以通过它进行解析 url.Parse ()。 例如,URI可以是“tcp://0.0.0.0:1883”。

func (*Server) Shutdown

func (server *Server) Shutdown() error

Shutdown terminates the server by shutting down all the client connections and closing the listener. It will, as best it can, clean up after itself.

func (*Server) Wait

func (server *Server) Wait()

type Sign

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

Sign 用于三个处理协程的通讯

func NewSign

func NewSign(quota int64, limit int) *Sign

func (*Sign) AddQuota

func (s *Sign) AddQuota()

AddQuota 新增一个配额 1. 每当收到一个PUBACK报文或PUBCOMP报文,不管PUBACK或PUBCOMP报文是否包含错误码。 2. 每次收到一个包含返回码大于等于0x80的PUBREC报文。 在初始发送配额之上尝试增加配额可能是由建立新的网络连接后重新发送PUBREL数据包引起的。

func (*Sign) BeyondQuota

func (s *Sign) BeyondQuota() bool

BeyondQuota 超过配额信号 CONNACK, PUBACK, PUBREC, SUBACK, DISCONNECT

func (*Sign) Limit

func (s *Sign) Limit() bool

Limit 限流了

func (*Sign) ReqQuota

func (s *Sign) ReqQuota() bool

ReqQuota 请求一个配额,发送端请求,因为是发送配额 只会在qos 1, 2处理

func (*Sign) TooManyMessages

func (s *Sign) TooManyMessages() bool

TooManyMessages 消息太过频繁 DISCONNECT

func (*Sign) UpLimit

func (s *Sign) UpLimit(limit int)

func (*Sign) UpQuota

func (s *Sign) UpQuota(quota int64, reset bool)

Jump to

Keyboard shortcuts

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