debug

package
v2.6.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

type Hook struct {
	mqtt.HookBase

	Log *slog.Logger
	// contains filtered or unexported fields
}

Hook is a debugging hook which logs additional low-level information from the server.

func (*Hook) ID

func (h *Hook) ID() string

ID returns the ID of the hook.

func (*Hook) Init

func (h *Hook) Init(config any) error

Init is called when the hook is initialized.

func (*Hook) OnClientExpired

func (h *Hook) OnClientExpired(cl *mqtt.Client)

OnClientExpired is called when the server clears an expired client.

func (*Hook) OnLWTSent

func (h *Hook) OnLWTSent(cl *mqtt.Client, pk packets.Packet)

OnLWTSent is called when a Will Message has been issued from a disconnecting client.

func (*Hook) OnPacketRead

func (h *Hook) OnPacketRead(cl *mqtt.Client, pk packets.Packet) (packets.Packet, error)

OnPacketRead is called when a new packet is received from a client.

func (*Hook) OnPacketSent

func (h *Hook) OnPacketSent(cl *mqtt.Client, pk packets.Packet, b []byte)

OnPacketSent is called when a packet is sent to a client.

func (*Hook) OnQosComplete

func (h *Hook) OnQosComplete(cl *mqtt.Client, pk packets.Packet)

OnQosComplete is called when the Qos flow for a message has been completed.

func (*Hook) OnQosDropped

func (h *Hook) OnQosDropped(cl *mqtt.Client, pk packets.Packet)

OnQosDropped is called the Qos flow for a message expires.

func (*Hook) OnQosPublish

func (h *Hook) OnQosPublish(cl *mqtt.Client, pk packets.Packet, sent int64, resends int)

OnQosPublish is called when a publish packet with Qos is issued to a subscriber.

func (*Hook) OnRetainMessage

func (h *Hook) OnRetainMessage(cl *mqtt.Client, pk packets.Packet, r int64)

OnRetainMessage is called when a published message is retained (or retain deleted/modified).

func (*Hook) OnRetainedExpired

func (h *Hook) OnRetainedExpired(filter string)

OnRetainedExpired is called when the server clears expired retained messages.

func (*Hook) OnStarted

func (h *Hook) OnStarted()

OnStarted is called when the server starts.

func (*Hook) OnStopped

func (h *Hook) OnStopped()

OnStopped is called when the server stops.

func (*Hook) Provides

func (h *Hook) Provides(b byte) bool

Provides indicates that this hook provides all methods.

func (*Hook) SetOpts

func (h *Hook) SetOpts(l *slog.Logger, opts *mqtt.HookOptions)

SetOpts is called when the hook receives inheritable server parameters.

func (*Hook) Stop

func (h *Hook) Stop() error

Stop is called when the hook is stopped.

func (*Hook) StoredClients

func (h *Hook) StoredClients() (v []storage.Client, err error)

StoredClients is called when the server restores clients from a store.

func (*Hook) StoredInflightMessages

func (h *Hook) StoredInflightMessages() (v []storage.Message, err error)

StoredInflightMessages is called when the server restores inflight messages from a store.

func (*Hook) StoredRetainedMessages

func (h *Hook) StoredRetainedMessages() (v []storage.Message, err error)

StoredRetainedMessages is called when the server restores retained messages from a store.

func (*Hook) StoredSubscriptions

func (h *Hook) StoredSubscriptions() (v []storage.Subscription, err error)

StoredSubscriptions is called when the server restores subscriptions from a store.

func (*Hook) StoredSysInfo

func (h *Hook) StoredSysInfo() (v storage.SystemInfo, err error)

StoredSysInfo is called when the server restores system info from a store.

type Options

type Options struct {
	Enable         bool `yaml:"enable" json:"enable"`                     // non-zero field for enabling hook using file-based config
	ShowPacketData bool `yaml:"show_packet_data" json:"show_packet_data"` // include decoded packet data (default false)
	ShowPings      bool `yaml:"show_pings" json:"show_pings"`             // show ping requests and responses (default false)
	ShowPasswords  bool `yaml:"show_passwords" json:"show_passwords"`     // show connecting user passwords (default false)
}

Options contains configuration settings for the debug output.

Jump to

Keyboard shortcuts

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