rest

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RouterWithMumble

func RouterWithMumble(db *gorm.DB, cfg *config.Config, feFS fs.FS, userLister handler.ConnectedUserLister, userActioner handler.ConnectedUserActioner, channelCrypto handler.ChannelCryptoLister, getChanMgr GetChannelManager, onACLChange OnACLChange, onBanChange OnBanChange, onChannelMutated handler.OnChannelMutated, onConfigChange handler.OnConfigChange) http.Handler

RouterWithMumble sets up the REST API with optional Mumble connected-user listing.

Types

type ConnectedUser

type ConnectedUser struct {
	SessionID       uint32  `json:"session_id"`
	UserID          uint32  `json:"user_id"`
	Name            string  `json:"name"`
	ChannelID       uint32  `json:"channel_id"`
	Address         string  `json:"address"`
	Ping            float32 `json:"ping"`
	CertificateHash string  `json:"certificate_hash,omitempty"` // SHA-1 hex of client cert; empty if none
	CryptoMode      string  `json:"crypto_mode,omitempty"`      // Negotiated UDP crypto tier: lite, legacy, secure
	VoiceTransport  string  `json:"voice_transport,omitempty"`  // udp or tcp — whether client uses native UDP or TCP tunnel for voice
	SelfMute        bool    `json:"self_mute"`
	SelfDeaf        bool    `json:"self_deaf"`
	Mute            bool    `json:"mute"`
	Deaf            bool    `json:"deaf"`
	IsAdmin         bool    `json:"is_admin"`
}

ConnectedUser is a connected Mumble user for the REST API.

type GetChannelManager

type GetChannelManager func(serverID uint) *channel.Manager

GetChannelManager returns the channel manager for a server ID, or nil. When nil, channel CRUD uses DB only (no live Mumble sync for server 1).

type MumbleChannelCryptoAdapter

type MumbleChannelCryptoAdapter struct {
	Server   *mumble.Server
	ServerID uint
}

MumbleChannelCryptoAdapter adapts mumble.Server to ChannelCryptoLister.

func (*MumbleChannelCryptoAdapter) ChannelCryptoModes

func (a *MumbleChannelCryptoAdapter) ChannelCryptoModes(serverID uint) map[uint32]string

ChannelCryptoModes implements handler.ChannelCryptoLister.

type MumbleUserActionAdapter

type MumbleUserActionAdapter struct {
	Server   *mumble.Server
	ServerID uint
}

MumbleUserActionAdapter adapts mumble.Server to ConnectedUserActioner. Only supports the single virtual server ID it was constructed with.

func (*MumbleUserActionAdapter) BanAndKick

func (a *MumbleUserActionAdapter) BanAndKick(serverID uint, sessionID uint32, reason string) bool

BanAndKick implements handler.ConnectedUserActioner.

func (*MumbleUserActionAdapter) Kick

func (a *MumbleUserActionAdapter) Kick(serverID uint, sessionID uint32, reason string) bool

Kick implements handler.ConnectedUserActioner.

func (*MumbleUserActionAdapter) Mute

func (a *MumbleUserActionAdapter) Mute(serverID uint, sessionID uint32, mute bool) bool

Mute implements handler.ConnectedUserActioner.

type MumbleUserAdapter

type MumbleUserAdapter struct {
	*user.Manager
	Server *mumble.Server // optional: used for voice transport (udp/tcp)
}

MumbleUserAdapter adapts user.Manager to ConnectedUserLister.

func (*MumbleUserAdapter) ListConnected

func (a *MumbleUserAdapter) ListConnected(serverID uint, db *gorm.DB, includeSensitive bool) interface{}

ListConnected returns connected users for REST API with is_admin resolved for display.

type OnACLChange

type OnACLChange func(serverID uint)

OnACLChange is called when ACLs are modified via REST (for cache invalidation).

type OnBanChange

type OnBanChange func(serverID uint)

OnBanChange is called when bans are created or deleted via REST (for Mumble cache invalidation).

Jump to

Keyboard shortcuts

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