Documentation ¶
Index ¶
- Constants
- Variables
- func GetOffsetN(page, pageSize uint) (offset, n uint)
- type Admin
- func (a *Admin) CloseClient(clientId string) (err error)
- func (a *Admin) GetClient(clientId string) (client *ClientInfo, err error)
- func (a *Admin) GetClients(limit, offset uint) (list []*ClientInfo, total uint32, err error)
- func (a *Admin) GetSession(clientId string) (session *SessionInfo, err error)
- func (a *Admin) GetSessions(limit, offset uint) (list []*SessionInfo, total int, err error)
- func (a *Admin) GetSubscriptions(clientId string, limit, offset uint) (list []*SubscriptionInfo, total int, err error)
- func (a *Admin) HookWrapper() server.HookWrapper
- func (a *Admin) Load(service server.Server) error
- func (a *Admin) Name() string
- func (a *Admin) OnClosedWrapper(pre server.OnClosed) server.OnClosed
- func (a *Admin) OnSessionCreatedWrapper(pre server.OnSessionCreated) server.OnSessionCreated
- func (a *Admin) OnSessionResumedWrapper(pre server.OnSessionResumed) server.OnSessionResumed
- func (a *Admin) OnSessionTerminatedWrapper(pre server.OnSessionTerminated) server.OnSessionTerminated
- func (a *Admin) OnSubscribedWrapper(pre server.OnSubscribed) server.OnSubscribed
- func (a *Admin) OnUnsubscribedWrapper(pre server.OnUnsubscribed) server.OnUnsubscribed
- func (a *Admin) Publish(topic string, qos int, payload []byte, retain bool) (err error)
- func (a *Admin) SearchTopic(query string) (result []*SubscriptionInfo, err error)
- func (a *Admin) Subscribe(clientId, topic string, qos int) (err error)
- func (a *Admin) Unload() error
- func (a *Admin) Unsubscribe(clientId, topic string) (err error)
- type ClientInfo
- type Indexer
- type SessionInfo
- type SubscriptionInfo
Constants ¶
const ( // Online ... Online = "online" // Offline ... Offline = "offline" )
const Name = "admin"
Name ...
Variables ¶
var ( // ErrInvalidTopicFilter ... ErrInvalidTopicFilter = errors.New("invalid topic filter") // ErrInvalidQos ... ErrInvalidQos = errors.New("invalid Qos") // ErrInvalidClientID ... ErrInvalidClientID = errors.New("invalid clientID") // ErrInvalidUtf8String ... ErrInvalidUtf8String = errors.New("invalid utf-8 string") // ErrNotFound ... ErrNotFound = errors.New("not found") )
Functions ¶
Types ¶
type Admin ¶
type Admin struct {
// contains filtered or unexported fields
}
Admin ...
func (*Admin) CloseClient ¶
CloseClient ...
func (*Admin) GetClient ¶
func (a *Admin) GetClient(clientId string) (client *ClientInfo, err error)
GetClient ...
func (*Admin) GetClients ¶
func (a *Admin) GetClients(limit, offset uint) (list []*ClientInfo, total uint32, err error)
GetClients ...
func (*Admin) GetSession ¶
func (a *Admin) GetSession(clientId string) (session *SessionInfo, err error)
GetSession ...
func (*Admin) GetSessions ¶
func (a *Admin) GetSessions(limit, offset uint) (list []*SessionInfo, total int, err error)
GetSessions ...
func (*Admin) GetSubscriptions ¶
func (a *Admin) GetSubscriptions(clientId string, limit, offset uint) (list []*SubscriptionInfo, total int, err error)
GetSubscriptions ...
func (*Admin) OnClosedWrapper ¶
OnClosedWrapper refresh the client when session resumed
func (*Admin) OnSessionCreatedWrapper ¶
func (a *Admin) OnSessionCreatedWrapper(pre server.OnSessionCreated) server.OnSessionCreated
OnSessionCreatedWrapper store the client when session created
func (*Admin) OnSessionResumedWrapper ¶
func (a *Admin) OnSessionResumedWrapper(pre server.OnSessionResumed) server.OnSessionResumed
OnSessionResumedWrapper refresh the client when session resumed
func (*Admin) OnSessionTerminatedWrapper ¶
func (a *Admin) OnSessionTerminatedWrapper(pre server.OnSessionTerminated) server.OnSessionTerminated
OnSessionTerminated remove the client when session terminated
func (*Admin) OnSubscribedWrapper ¶
func (a *Admin) OnSubscribedWrapper(pre server.OnSubscribed) server.OnSubscribed
OnSubscribedWrapper store the subscription
func (*Admin) OnUnsubscribedWrapper ¶
func (a *Admin) OnUnsubscribedWrapper(pre server.OnUnsubscribed) server.OnUnsubscribed
OnUnsubscribedWrapper remove the subscription
func (*Admin) SearchTopic ¶
func (a *Admin) SearchTopic(query string) (result []*SubscriptionInfo, err error)
SearchTopic ...
func (*Admin) Unsubscribe ¶
Unsubscribe ...
type ClientInfo ¶
type ClientInfo struct { ClientID string `json:"client_id"` Username string `json:"username"` KeepAlive uint16 `json:"keep_alive"` Version int32 `json:"version"` WillRetain bool `json:"will_retain"` WillQos uint8 `json:"will_qos"` WillTopic string `json:"will_topic"` WillPayload string `json:"will_payload"` RemoteAddr string `json:"remote_addr"` LocalAddr string `json:"local_addr"` SubscriptionsCurrent uint32 `json:"subscriptions_current"` SubscriptionsTotal uint32 `json:"subscriptions_total"` PacketsReceivedBytes uint64 `json:"packets_received_bytes"` PacketsReceivedNums uint64 `json:"packets_received_nums"` PacketsSendBytes uint64 `json:"packets_send_bytes"` PacketsSendNums uint64 `json:"packets_send_nums"` MessageDropped uint64 `json:"message_dropped"` InflightLen uint32 `json:"inflight_len"` QueueLen uint32 `json:"queue_len"` ConnectedAt time.Time `json:"connected_at"` DisconnectedAt *time.Time `json:"disconnected_at"` }
ClientInfo represents the client information
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer provides a index for a ordered list that supports queries in O(1). All methods are not concurrency-safe.
func (*Indexer) GetByID ¶
GetByID returns the value for the given id. Return nil if not found. Notice: Any access to the return *list.Element also require the mutex, because the Set method can modify the Value for *list.Element when updating the Value for the same id. If the caller needs the Value in *list.Element, it must get the Value before the next Set is called.
func (*Indexer) Iterate ¶
Iterate iterates at most n elements in the list begin from offset. Notice: Any access to the *list.Element in fn also require the mutex, because the Set method can modify the Value for *list.Element when updating the Value for the same id. If the caller needs the Value in *list.Element, it must get the Value before the next Set is called.
type SessionInfo ¶
type SessionInfo struct { ClientID string `json:"client_id"` Status string `json:"status"` CleanSession bool `json:"clean_session"` Subscriptions uint64 `json:"subscriptions"` MaxInflight uint16 `json:"max_inflight"` InflightLen uint64 `json:"inflight_len"` MaxMsgQueue int `json:"max_msg_queue"` MsgQueueLen uint64 `json:"msg_queue_len"` AwaitRelLen uint64 `json:"await_rel_len"` Qos0MsgDroppedTotal uint64 `json:"qos0_msg_dropped_total"` Qos1MsgDroppedTotal uint64 `json:"qos1_msg_dropped_total"` Qos2MsgDroppedTotal uint64 `json:"qos2_msg_dropped_total"` Qos0MsgDeliveredTotal uint64 `json:"qos0_msg_delivered_total"` Qos1MsgDeliveredTotal uint64 `json:"qos1_msg_delivered_total"` Qos2MsgDeliveredTotal uint64 `json:"qos2_msg_delivered_total"` ConnectedAt *time.Time `json:"connected_at"` DisconnectedAt *time.Time `json:"disconnected_at"` }
SessionInfo represents the session information
type SubscriptionInfo ¶
type SubscriptionInfo struct { Id uint32 `json:"id"` ClientID string `json:"client_id"` TopicName string `json:"topic_name"` Name string `json:"name"` Qos uint32 `json:"qos"` NoLocal bool `json:"no_local"` RetainAsPublished bool `json:"retain_as_published"` RetainHandling uint32 `json:"retain_handling"` }
SubscriptionInfo represents the subscription information