rest

package
v2.6.4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthUsersPath         = "/api/v1/auth/users"
	AuthUserPath          = "/api/v1/auth/users/{username}"
	AuthUserAclPath       = "/api/v1/auth/users/{username}/acl"
	AuthUserAclFilterPath = "/api/v1/auth/users/{username}/acl/{filter...}"
)
View Source
const (
	MqttGetOverallPath       = "/api/v1/mqtt/stat/overall"
	MqttGetOnlinePath        = "/api/v1/mqtt/stat/online"
	MqttGetClientPath        = "/api/v1/mqtt/clients/{id}"
	MqttGetClientsPath       = "/api/v1/mqtt/clients"
	MqttGetSubscriptionsPath = "/api/v1/mqtt/subscriptions"
	MqttGetTopicsPath        = "/api/v1/mqtt/topics"
	MqttGetRetainedPath      = "/api/v1/mqtt/retained"
	MqttDelRetainedPath      = "/api/v1/mqtt/retained/{topic...}"
	MqttDisconnectClientPath = "/api/v1/mqtt/clients/{id}/disconnect"
	MqttGetBlacklistPath     = "/api/v1/mqtt/blacklist"
	MqttAddBlacklistPath     = "/api/v1/mqtt/blacklist/{id}"
	MqttDelBlacklistPath     = "/api/v1/mqtt/blacklist/{id}"
	MqttPublishMessagePath   = "/api/v1/mqtt/message"
	MqttGetConfigPath        = "/api/v1/mqtt/config"
	PrometheusMetrics        = "/metrics"
)

Variables

This section is empty.

Functions

func Error

func Error(w http.ResponseWriter, code int, err string)

func Ok

func Ok(w http.ResponseWriter, data any)

Types

type AclEntry added in v2.6.3

type AclEntry struct {
	Topic  string `json:"topic"`
	Access int    `json:"access"`
}

type AclUpdate added in v2.6.3

type AclUpdate struct {
	Topic  string `json:"topic"`
	Access int    `json:"access"`
}

type AuthEntry added in v2.6.3

type AuthEntry struct {
	Username string `json:"username"`
	Password string `json:"password,omitempty"`
	Allow    bool   `json:"allow"`
}

type AuthManager added in v2.6.3

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

func NewAuthManager added in v2.6.3

func NewAuthManager(rdb redis.UniversalClient, authKey, aclPrefix string) *AuthManager

func (*AuthManager) GenHandlers added in v2.6.3

func (m *AuthManager) GenHandlers() map[string]Handler

type Handler

type Handler = func(http.ResponseWriter, *http.Request)

type PagedRequest added in v2.6.3

type PagedRequest struct {
	Page     int    `json:"page"`
	PageSize int    `json:"page_size"`
	Search   string `json:"search"`
}

type PagedResponse added in v2.6.3

type PagedResponse[T any] struct {
	Items    []T `json:"items"`
	Total    int `json:"total"`
	Page     int `json:"page"`
	PageSize int `json:"page_size"`
}

func Paginate added in v2.6.3

func Paginate[T any](items []T, req PagedRequest) PagedResponse[T]

type Rest

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

func New

func New(server *mqtt.Server) *Rest

func (*Rest) GenHandlers

func (s *Rest) GenHandlers() map[string]Handler

type RetainedMsg added in v2.6.3

type RetainedMsg struct {
	Topic    string `json:"topic"`
	Payload  string `json:"payload"`
	Qos      byte   `json:"qos"`
	ClientID string `json:"client_id"`
	Created  int64  `json:"created"`
}

Jump to

Keyboard shortcuts

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