Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var OnError = func(str string, err error) { prefix := "dgVoice: " + str if err != nil { log.Println(prefix + ": " + err.Error()) } else { log.Println(prefix) } }
OnError gets called by dgvoice when an error is encountered. By default logs to STDERR
var (
PromApplicationStartTime = promauto.NewGauge(prometheus.GaugeOpts{
Name: "mdb_bridge_start_time",
Help: "The time the application started",
})
)
Functions ¶
func StartPromServer ¶ added in v0.5.0
func StartPromServer(port int)
Types ¶
type BridgeConfig ¶
type BridgeConfig struct { MumbleConfig *gumble.Config MumbleAddr string MumbleInsecure bool MumbleCertificate string MumbleChannel []string MumbleStartStreamCount int MumbleDisableText bool Command string GID string CID string DiscordStartStreamingCount int DiscordDisableText bool DiscordDisableBotStatus bool Version string }
type BridgeMode ¶
type BridgeMode int
const ( BridgeModeAuto BridgeMode = iota BridgeModeManual BridgeModeConstant )
type BridgeState ¶
type BridgeState struct { // The configuration data for this bridge BridgeConfig *BridgeConfig // External requests to kill the bridge BridgeDie chan bool // Wait for bridge to exit cleanly WaitExit *sync.WaitGroup // Bridge State Mutex BridgeMutex sync.Mutex // Bridge connection Connected bool // The bridge mode constant, auto, manual. Default is constant. Mode BridgeMode // Discord session. This is created and outside the bridge state DiscordSession *discordgo.Session // Discord voice connection. Empty if not connected. DiscordVoice *discordgo.VoiceConnection // Mumble client. Empty if not connected. MumbleClient *gumble.Client // Map of Discord users tracked by this bridge. DiscordUsers map[string]DiscordUser DiscordUsersMutex sync.Mutex // Map of Mumble users tracked by this bridge MumbleUsers map[string]bool MumbleUsersMutex sync.Mutex // Total Number of Mumble users MumbleUserCount int // Kill the auto connect routine AutoChanDie chan bool // Discord Duplex and Event Listener DiscordStream *DiscordDuplex DiscordListener *DiscordListener // Mumble Duplex and Event Listener MumbleStream *MumbleDuplex MumbleListener *MumbleListener // Discord Voice channel to join DiscordChannelID string // contains filtered or unexported fields }
BridgeState manages dynamic information about the bridge during runtime
func (*BridgeState) AutoBridge ¶
func (b *BridgeState) AutoBridge()
AutoBridge starts a goroutine to check the number of users in discord and mumble when there is at least one user on both, starts up the bridge when there are no users on either side, kills the bridge
func (*BridgeState) DiscordStatusUpdate ¶
func (b *BridgeState) DiscordStatusUpdate()
func (*BridgeState) StartBridge ¶
func (b *BridgeState) StartBridge()
startBridge established the voice connection
type DiscordDuplex ¶
type DiscordDuplex struct { Bridge *BridgeState // contains filtered or unexported fields }
DiscordDuplex Handle discord voice stream
func NewDiscordDuplex ¶ added in v0.5.0
func NewDiscordDuplex(b *BridgeState) *DiscordDuplex
type DiscordListener ¶
type DiscordListener struct {
Bridge *BridgeState
}
DiscordListener holds references to the current BridgeConf and BridgeState for use by the event handlers
func (*DiscordListener) GuildCreate ¶
func (l *DiscordListener) GuildCreate(s *discordgo.Session, event *discordgo.GuildCreate)
func (*DiscordListener) MessageCreate ¶
func (l *DiscordListener) MessageCreate(s *discordgo.Session, m *discordgo.MessageCreate)
func (*DiscordListener) VoiceUpdate ¶
func (l *DiscordListener) VoiceUpdate(s *discordgo.Session, event *discordgo.VoiceStateUpdate)
type DiscordUser ¶
type DiscordUser struct {
// contains filtered or unexported fields
}
type MumbleDuplex ¶
type MumbleDuplex struct {
// contains filtered or unexported fields
}
MumbleDuplex - listener and outgoing
func NewMumbleDuplex ¶ added in v0.5.0
func NewMumbleDuplex() *MumbleDuplex
func (*MumbleDuplex) OnAudioStream ¶
func (m *MumbleDuplex) OnAudioStream(e *gumble.AudioStreamEvent)
OnAudioStream - Spawn routines to handle incoming packets
type MumbleListener ¶
type MumbleListener struct {
Bridge *BridgeState
}
MumbleListener Handle mumble events
func (*MumbleListener) MumbleConnect ¶
func (l *MumbleListener) MumbleConnect(e *gumble.ConnectEvent)
func (*MumbleListener) MumbleUserChange ¶
func (l *MumbleListener) MumbleUserChange(e *gumble.UserChangeEvent)