mirror of
https://github.com/stryan/mumble-discord-bridge.git
synced 2024-09-28 15:06:23 -04:00
Compare commits
No commits in common. "main" and "v0.4.2" have entirely different histories.
33
.github/workflows/build-docker.yml
vendored
33
.github/workflows/build-docker.yml
vendored
@ -1,33 +0,0 @@
|
|||||||
name: 'Docker'
|
|
||||||
on:
|
|
||||||
create:
|
|
||||||
tags:
|
|
||||||
- v*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker-build-push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
|
||||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: stieneee/mumble-discord-bridge:latest,stieneee/mumble-discord-bridge:${{ github.ref_name }},ghcr.io/stieneee/mumble-discord-bridge:latest,ghcr.io/stieneee/mumble-discord-bridge:${{ github.ref_name }}
|
|
46
.github/workflows/build-release.yml
vendored
46
.github/workflows/build-release.yml
vendored
@ -1,44 +1,28 @@
|
|||||||
name: 'CI'
|
name: 'CI'
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
tags:
|
||||||
- main
|
- 'v*'
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
goreleaser:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
-
|
||||||
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
-
|
||||||
- name: Install libopus-dev zip
|
name: Install libopus-dev
|
||||||
run: sudo apt update && sudo apt-get -y install libopus-dev zip
|
run: sudo apt-get -y install libopus-dev
|
||||||
|
-
|
||||||
- name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.17
|
go-version: 1.15
|
||||||
|
-
|
||||||
- name: go-license install
|
name: Run GoReleaser
|
||||||
run: go install github.com/google/go-licenses@latest
|
|
||||||
|
|
||||||
- name: go-license save
|
|
||||||
run: go-licenses save ./cmd/mumble-discord-bridge --force --save_path="./LICENSES" && zip -r -9 LICENSES.zip ./LICENSES
|
|
||||||
|
|
||||||
- name: Run GoReleaser Build
|
|
||||||
uses: goreleaser/goreleaser-action@v2
|
|
||||||
with:
|
|
||||||
version: latest
|
|
||||||
args: build --rm-dist --skip-validate
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Run GoReleaser Release
|
|
||||||
uses: goreleaser/goreleaser-action@v2
|
uses: goreleaser/goreleaser-action@v2
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
@ -46,9 +30,3 @@ jobs:
|
|||||||
args: release --rm-dist
|
args: release --rm-dist
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Upload assets
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: mdb
|
|
||||||
path: dist/*
|
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -6,7 +6,3 @@ dist
|
|||||||
*.test
|
*.test
|
||||||
cert.pem
|
cert.pem
|
||||||
*.gob
|
*.gob
|
||||||
docker-compose.yml
|
|
||||||
mdb-local
|
|
||||||
LICENSES
|
|
||||||
LICENSES.zip
|
|
@ -19,37 +19,12 @@ builds:
|
|||||||
# - darwin
|
# - darwin
|
||||||
goarch:
|
goarch:
|
||||||
- amd64
|
- amd64
|
||||||
# dockers:
|
|
||||||
# - goos: linux
|
|
||||||
# goarch: amd64
|
|
||||||
# image_templates:
|
|
||||||
# - "ghcr.io/stieneee/mumble-discord-bridge:latest"
|
|
||||||
# - "ghcr.io/stieneee/mumble-discord-bridge:{{ .Tag }}"
|
|
||||||
# - "stieneee/mumble-discord-bridge:latest"
|
|
||||||
# - "stieneee/mumble-discord-bridge:{{ .Tag }}"
|
|
||||||
# skip_push: "false"
|
|
||||||
# dockerfile: Dockerfile
|
|
||||||
# use: docker
|
|
||||||
# build_flag_templates:
|
|
||||||
# - "--pull"
|
|
||||||
# - "--label=org.opencontainers.image.created={{.Date}}"
|
|
||||||
# - "--label=org.opencontainers.image.title={{.ProjectName}}"
|
|
||||||
# - "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
|
||||||
# - "--label=org.opencontainers.image.version={{.Version}}"
|
|
||||||
# - "--platform=linux/amd64"
|
|
||||||
# push_flags:
|
|
||||||
# - --tls-verify=false
|
|
||||||
# extra_files:
|
|
||||||
# - config.yml
|
|
||||||
|
|
||||||
# archives:
|
archives:
|
||||||
checksum:
|
checksum:
|
||||||
name_template: 'checksums.txt'
|
name_template: 'checksums.txt'
|
||||||
snapshot:
|
snapshot:
|
||||||
name_template: "{{ .Tag }}-next"
|
name_template: "{{ .Tag }}-next"
|
||||||
release:
|
|
||||||
extra_files:
|
|
||||||
- glob: "./LICENSES.zip"
|
|
||||||
changelog:
|
changelog:
|
||||||
sort: asc
|
sort: asc
|
||||||
filters:
|
filters:
|
||||||
|
@ -2,14 +2,12 @@
|
|||||||
|
|
||||||
# Stage 1
|
# Stage 1
|
||||||
|
|
||||||
FROM golang:1.17 as builder
|
FROM golang:1.16 as builder
|
||||||
WORKDIR /go/src/app
|
WORKDIR /go/src/app
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
|
||||||
RUN apt update && apt install -y libopus-dev
|
RUN apt update && apt install -y libopus-dev
|
||||||
RUN go install github.com/goreleaser/goreleaser@latest
|
RUN ./bin/goreleaser build --skip-validate
|
||||||
RUN go install github.com/google/go-licenses@latest
|
|
||||||
RUN goreleaser build --skip-validate
|
|
||||||
RUN go-licenses save ./cmd/mumble-discord-bridge --force --save_path="./dist/LICENSES"
|
|
||||||
|
|
||||||
# Stage 2
|
# Stage 2
|
||||||
|
|
||||||
@ -17,7 +15,6 @@ FROM alpine:latest as final
|
|||||||
WORKDIR /opt/
|
WORKDIR /opt/
|
||||||
RUN apk add opus
|
RUN apk add opus
|
||||||
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
|
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
|
||||||
COPY --from=builder /go/src/app/dist/LICENSES .
|
|
||||||
COPY --from=builder /go/src/app/dist/mumble-discord-bridge_linux_amd64/mumble-discord-bridge .
|
COPY --from=builder /go/src/app/dist/mumble-discord-bridge_linux_amd64/mumble-discord-bridge .
|
||||||
|
|
||||||
# FROM ubuntu:latest as final
|
# FROM ubuntu:latest as final
|
||||||
|
29
Makefile
29
Makefile
@ -1,23 +1,16 @@
|
|||||||
GOFILES=$(shell find ./ -type f -name '*.go')
|
GOFILES=$(shell find ./ -type f -name '*.go')
|
||||||
LATEST_TAG=$(shell git describe --tags `git rev-list --tags --max-count=1`)
|
|
||||||
|
|
||||||
mumble-discord-bridge: $(GOFILES) .goreleaser.yml
|
mumble-discord-bridge: $(GOFILES) .goreleaser.yml
|
||||||
goreleaser build --skip-validate --rm-dist --single-target --auto-snapshot
|
goreleaser build --skip-validate --rm-dist
|
||||||
|
|
||||||
release:
|
|
||||||
rm -rf LICENSES.zip LICENSES
|
|
||||||
go-licenses save ./cmd/mumble-discord-bridge --save_path="./LICENSES"
|
|
||||||
zip -r -9 LICENSES.zip ./LICENSES
|
|
||||||
goreleaser release --rm-dist
|
|
||||||
|
|
||||||
dev: $(GOFILES) .goreleaser.yml
|
dev: $(GOFILES) .goreleaser.yml
|
||||||
goreleaser build --skip-validate --rm-dist --single-target --snapshot && sudo ./dist/mumble-discord-bridge_linux_amd64/mumble-discord-bridge
|
goreleaser build --skip-validate --rm-dist && sudo ./dist/mumble-discord-bridge_linux_amd64/mumble-discord-bridge
|
||||||
|
|
||||||
dev-race: $(GOFILES) .goreleaser.yml
|
dev-race: $(GOFILES) .goreleaser.yml
|
||||||
go run -race ./cmd/mumble-discord-bridge
|
go run -race ./cmd/mumble-discord-bridge
|
||||||
|
|
||||||
dev-profile: $(GOFILES) .goreleaser.yml
|
dev-profile: $(GOFILES) .goreleaser.yml
|
||||||
goreleaser build --skip-validate --rm-dist --single-target --snapshot && sudo ./dist/mumble-discord-bridge_linux_amd64/mumble-discord-bridge -cpuprofile cpu.prof
|
goreleaser build --skip-validate --rm-dist && sudo ./dist/mumble-discord-bridge_linux_amd64/mumble-discord-bridge -cpuprofile cpu.prof
|
||||||
|
|
||||||
test-chart: SHELL:=/bin/bash
|
test-chart: SHELL:=/bin/bash
|
||||||
test-chart:
|
test-chart:
|
||||||
@ -26,24 +19,16 @@ test-chart:
|
|||||||
psrecord --plot docs/test-cpu-memory.png $$(pidof mumble-discord-bridge.test)
|
psrecord --plot docs/test-cpu-memory.png $$(pidof mumble-discord-bridge.test)
|
||||||
|
|
||||||
docker-latest:
|
docker-latest:
|
||||||
docker build -t stieneee/mumble-discord-bridge:latest -t stieneee/mumble-discord-bridge:$(LATEST_TAG) -t ghcr.io/stieneee/mumble-discord-bridge:latest -t ghcr.io/stieneee/mumble-discord-bridge:$(LATEST_TAG) .
|
docker build -t stieneee/mumble-discord-bridge:latest .
|
||||||
|
|
||||||
docker-latest-run:
|
docker-latest-run:
|
||||||
docker run --env-file .env -it stieneee/mumble-discord-bridge:latest
|
docker run --env-file .env -it stieneee/mumble-discord-bridge:latest
|
||||||
|
|
||||||
docker-release:
|
|
||||||
docker push stieneee/mumble-discord-bridge:latest
|
|
||||||
docker push stieneee/mumble-discord-bridge:$(LATEST_TAG)
|
|
||||||
docker push ghcr.io/stieneee/mumble-discord-bridge:latest
|
|
||||||
docker push ghcr.io/stieneee/mumble-discord-bridge:$(LATEST_TAG)
|
|
||||||
|
|
||||||
docker-next:
|
docker-next:
|
||||||
docker build -t stieneee/mumble-discord-bridge:next -t ghcr.io/stieneee/mumble-discord-bridge:next .
|
docker build -t stieneee/mumble-discord-bridge:next .
|
||||||
docker push stieneee/mumble-discord-bridge:next
|
docker push stieneee/mumble-discord-bridge:next
|
||||||
docker push ghcr.io/stieneee/mumble-discord-bridge:next
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf dist
|
rm -f mumble-discord-bridge
|
||||||
rm -rf LICENSES.zip LICENSES
|
|
||||||
|
|
||||||
.PHONY: release dev dev-profile dev-race test-chart docker-latest docker-latest-release docker-release docker-next clean
|
.PHONY: docker-latest docker-latest-push clean
|
97
README.md
97
README.md
@ -4,39 +4,69 @@ Mumble Discord Bridge is an open source Go application to bridge the audio betwe
|
|||||||
|
|
||||||
It was built with the hope that people can continue to use the voice application of their choice.
|
It was built with the hope that people can continue to use the voice application of their choice.
|
||||||
|
|
||||||
## PatchCord.io
|
|
||||||
|
|
||||||
Mumble Discord Bridge can be hosted on any server or computer and ships in a Docker container for convenience.
|
|
||||||
|
|
||||||
If hosting this application yourself seem like an difficult task please consider [PatchCord.io](https://patchcord.io).
|
|
||||||
The site even offers a free tier for those who want to try out Mumble Discord Bridge.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Several configuration variables must be set for the binary to function correctly.
|
Several configuration variables must be set for the binary to function correctly.
|
||||||
All variables can be set using flags or in the environment.
|
All variables can be set using flags or in the environment.
|
||||||
The binary will also attempt to load .env file located in the working directory.
|
The binary will also attempt to load .env file located in the working directory.
|
||||||
See the help documentation for all the options
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mumble-discord-bridge --help
|
Usage of ./mumble-discord-bridge:
|
||||||
|
-cpuprofile file
|
||||||
|
write cpu profile to file
|
||||||
|
-debug-level int
|
||||||
|
DEBUG_LEVEL, Discord debug level, optional, (default 1) (default 1)
|
||||||
|
-discord-cid string
|
||||||
|
DISCORD_CID, discord cid, required
|
||||||
|
-discord-command string
|
||||||
|
DISCORD_COMMAND, Discord command string, env alt DISCORD_COMMAND, optional, (defaults mumble-discord) (default "mumble-discord")
|
||||||
|
-discord-disable-text
|
||||||
|
DISCORD_DISABLE_TEXT, disable sending direct messages to discord, (default false)
|
||||||
|
-discord-gid string
|
||||||
|
DISCORD_GID, discord gid, required
|
||||||
|
-discord-token string
|
||||||
|
DISCORD_TOKEN, discord bot token, required
|
||||||
|
-mode string
|
||||||
|
MODE, [constant, manual, auto] determine which mode the bridge starts in, (default constant) (default "constant")
|
||||||
|
-mumble-address string
|
||||||
|
MUMBLE_ADDRESS, mumble server address, example example.com, required
|
||||||
|
-mumble-certificate string
|
||||||
|
MUMBLE_CERTIFICATE, client certificate to use when connecting to the Mumble server
|
||||||
|
-mumble-channel string
|
||||||
|
MUMBLE_CHANNEL, mumble channel to start in, using '/' to separate nested channels, optional
|
||||||
|
-mumble-disable-text
|
||||||
|
MUMBLE_DISABLE_TEXT, disable sending text to mumble, (default false)
|
||||||
|
-mumble-insecure
|
||||||
|
MUMBLE_INSECURE, mumble insecure, optional
|
||||||
|
-mumble-password string
|
||||||
|
MUMBLE_PASSWORD, mumble password, optional
|
||||||
|
-mumble-port int
|
||||||
|
MUMBLE_PORT, mumble port, (default 64738) (default 64738)
|
||||||
|
-mumble-username string
|
||||||
|
MUMBLE_USERNAME, mumble username, (default: discord) (default "Discord")
|
||||||
|
-nice
|
||||||
|
NICE, whether the bridge should automatically try to 'nice' itself, (default false)
|
||||||
|
-to-discord-buffer int
|
||||||
|
TO_DISCORD_BUFFER, Jitter buffer from Mumble to Discord to absorb timing issues related to network, OS and hardware quality. (Increments of 10ms) (default 50)
|
||||||
|
-to-mumble-buffer int
|
||||||
|
TO_MUMBLE_BUFFER, Jitter buffer from Discord to Mumble to absorb timing issues related to network, OS and hardware quality. (Increments of 10ms) (default 50)
|
||||||
```
|
```
|
||||||
|
|
||||||
The bridge can be run with the follow modes:
|
The bridge can be run with the follow modes:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
auto
|
auto
|
||||||
The bridge starts up but does not connect immediately. It can be either manually linked (see below) or will join the voice channels when there's at least one person on each side.
|
The bridge starts up but does not connect immediately. It can be either manually linked (see below) or will join the voice channels when there's at least one person on each side.
|
||||||
The bridge will leave both voice channels once there is no one on either end
|
The bridge will leave both voice channels once there is no one on either end
|
||||||
manual
|
manual
|
||||||
The bridge starts up but does not connect immediately. It will join the voice channels when issued the link command and will leave with the unlink command
|
The bridge starts up but does not connect immediately. It will join the voice channels when issued the link command and will leave with the unlink command
|
||||||
constant (default)
|
constant
|
||||||
The bridge starts up and immediately connects to both Discord and Mumble voice channels. It can not be controlled in this mode and quits when the program is stopped
|
The bridge starts up and immediately connects to both Discord and Mumble voice channels. It can not be controlled in this mode and quits when the program is stopped
|
||||||
```
|
```
|
||||||
|
|
||||||
In "auto" or "manual" modes, the bridge can be controlled in Discord with the following commands:
|
In "auto" or "manual" modes, the bridge can be controlled in Discord with the following commands:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
!DISCORD_COMMAND link
|
!DISCORD_COMMAND link
|
||||||
Commands the bridge to join the Discord channel the user is in and the Mumble server
|
Commands the bridge to join the Discord channel the user is in and the Mumble server
|
||||||
|
|
||||||
@ -69,8 +99,6 @@ The bot requires the following permissions:
|
|||||||
* Voice Channel Speak
|
* Voice Channel Speak
|
||||||
* Voice Channel Use Voice Activity
|
* Voice Channel Use Voice Activity
|
||||||
|
|
||||||
Permission integer 36768768.
|
|
||||||
|
|
||||||
### Finding Discord CID and GID
|
### Finding Discord CID and GID
|
||||||
|
|
||||||
Discord GID is a unique ID linked to one Discord Server, also called Guild. CID is similarly a unique ID for a Discord Channel. To find these you need to set Discord into developer Mode.
|
Discord GID is a unique ID linked to one Discord Server, also called Guild. CID is similarly a unique ID for a Discord Channel. To find these you need to set Discord into developer Mode.
|
||||||
@ -79,7 +107,7 @@ Discord GID is a unique ID linked to one Discord Server, also called Guild. CID
|
|||||||
|
|
||||||
Then you can get the GID by right-clicking your server and selecting Copy-ID. Similarly the CID can be found right clicking the voice channel and selecting Copy ID.
|
Then you can get the GID by right-clicking your server and selecting Copy-ID. Similarly the CID can be found right clicking the voice channel and selecting Copy ID.
|
||||||
|
|
||||||
### Generating Mumble Client (Optional)
|
### Generating Mumble Client (Optional)
|
||||||
|
|
||||||
Optionally you can specify a client certificate for mumble [Mumble Certificates](https://wiki.mumble.info/wiki/Mumble_Certificates)
|
Optionally you can specify a client certificate for mumble [Mumble Certificates](https://wiki.mumble.info/wiki/Mumble_Certificates)
|
||||||
If you don't have a client certificate, you can generate one with this command:
|
If you don't have a client certificate, you can generate one with this command:
|
||||||
@ -122,33 +150,6 @@ docker docker run -e MUMBLE_ADDRESS=example.com -e MUMBLE_PASSWORD=optional -e D
|
|||||||
docker stop mumble-discord-bridge && docker rm mumble-discord-bridge
|
docker stop mumble-discord-bridge && docker rm mumble-discord-bridge
|
||||||
```
|
```
|
||||||
|
|
||||||
### MDB Bridge Options
|
|
||||||
|
|
||||||
The following options can be set using environment variables or with command line options.
|
|
||||||
|
|
||||||
| Environment Option | Flag | Type | Default | Description |
|
|
||||||
|----------------------------|-----------------------------|---------|------------------|--------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| DEBUG_LEVEL | -debug-level | int | 1 | discord debug level |
|
|
||||||
| DISCORD_CID | -discord-cid | string | "" | discord cid, required |
|
|
||||||
| DISCORD_COMMAND | -discord-command | string | "mumble-discord" | discord command string, env alt DISCORD_COMMAND, optional |
|
|
||||||
| DISCORD_DISABLE_BOT_STATUS | -discord-disable-bot-status | boolean | false | disable updating bot status |
|
|
||||||
| DISCORD_DISABLE_TEXT | -discord-disable-text | boolean | false | disable sending direct messages to discord |
|
|
||||||
| DISCORD_GID | -discord-gid | string | "" | discord gid, required |
|
|
||||||
| DISCORD_TOKEN | -discord-token | string | "" | discord bot token, required |
|
|
||||||
| MODE | -mode | string | "constant" | [constant, manual, auto] determine which mode the bridge starts in |
|
|
||||||
| MUMBLE_ADDRESS | -mumble-address | string | "" | mumble server address, example example.com, required |
|
|
||||||
| MUMBLE_CERTIFICATE | -mumble-certificate | string | "" | client certificate to use when connecting to the Mumble server |
|
|
||||||
| MUMBLE_CHANNEL | -mumble-channel | string | "" | mumble channel to start in, using '/' to separate nested channels, optional |
|
|
||||||
| MUMBLE_DISABLE_TEXT | -mumble-disable-text | boolean | false | disable sending text to mumble |
|
|
||||||
| MUMBLE_INSECURE | -mumble-insecure | boolean | false | mumble insecure, ignore ssl certificates issues |
|
|
||||||
| MUMBLE_PASSWORD | -mumble-password | string | "" | mumble password |
|
|
||||||
| MUMBLE_PORT | -mumble-port | int | 64738 | mumble port |
|
|
||||||
| MUMBLE_USERNAME | -mumble-username | string | "Discord" | mumble username |
|
|
||||||
| PROMETHEUS_ENABLE | -prometheus-enable | boolean | false | enable prometheus metrics |
|
|
||||||
| PROMETHEUS_PORT | -prometheus-port | int | 9559 | prometheus metrics port |
|
|
||||||
| TO_DISCORD_BUFFER | -to-discord-buffer | int | 50 | jitter buffer from Mumble to Discord to absorb timing issues related to network, OS and hardware quality. (Increments of 10ms) |
|
|
||||||
| TO_MUMBLE_BUFFER | -to-mumble-buffer | int | 50 | jitter buffer from Discord to Mumble to absorb timing issues related to network, OS and hardware quality. (Increments of 10ms) |****
|
|
||||||
|
|
||||||
### Mumbler Server Setting
|
### Mumbler Server Setting
|
||||||
|
|
||||||
To ensure compatibility please edit your murmur configuration file with the following
|
To ensure compatibility please edit your murmur configuration file with the following
|
||||||
@ -166,8 +167,9 @@ A simple go build command is all that is needed.
|
|||||||
Ensure the opus library is installed.
|
Ensure the opus library is installed.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go install github.com/goreleaser/goreleaser@latest
|
go build -o mumble-discord-bridge *.go
|
||||||
goreleaser build --skip-validate --rm-dist --single-target --auto-snapshot
|
#or
|
||||||
|
make mumble-discord-bridge
|
||||||
```
|
```
|
||||||
|
|
||||||
### OpenBSD Users
|
### OpenBSD Users
|
||||||
@ -185,13 +187,6 @@ A default jitter of 50ms should be adequate for most scenarios.
|
|||||||
A warning will be logged if short burst or audio are seen.
|
A warning will be logged if short burst or audio are seen.
|
||||||
A single warning can be ignored multiple warnings in short time spans would suggest the need for a larger jitter buffer.
|
A single warning can be ignored multiple warnings in short time spans would suggest the need for a larger jitter buffer.
|
||||||
|
|
||||||
## Monitoring the Bridge (Optional)
|
|
||||||
|
|
||||||
The bridge can be started with a Prometheus metrics endpoint enabled.
|
|
||||||
The example folder contains the a docker-compose file that will spawn the bridge, Prometheus and Grafana configured to serve a single a pre-configured dashboard.
|
|
||||||
|
|
||||||
![Mumble Discord Bridge Grafana Dashboard](example/grafana-dashboard.png "Grafana Dashboard")
|
|
||||||
|
|
||||||
## Known Issues
|
## Known Issues
|
||||||
|
|
||||||
Currently there is an issue opening the discord voice channel.
|
Currently there is an issue opening the discord voice channel.
|
||||||
|
@ -50,12 +50,9 @@ func main() {
|
|||||||
discordSendBuffer := flag.Int("to-discord-buffer", lookupEnvOrInt("TO_DISCORD_BUFFER", 50), "TO_DISCORD_BUFFER, Jitter buffer from Mumble to Discord to absorb timing issues related to network, OS and hardware quality. (Increments of 10ms)")
|
discordSendBuffer := flag.Int("to-discord-buffer", lookupEnvOrInt("TO_DISCORD_BUFFER", 50), "TO_DISCORD_BUFFER, Jitter buffer from Mumble to Discord to absorb timing issues related to network, OS and hardware quality. (Increments of 10ms)")
|
||||||
discordCommand := flag.String("discord-command", lookupEnvOrString("DISCORD_COMMAND", "mumble-discord"), "DISCORD_COMMAND, Discord command string, env alt DISCORD_COMMAND, optional, (defaults mumble-discord)")
|
discordCommand := flag.String("discord-command", lookupEnvOrString("DISCORD_COMMAND", "mumble-discord"), "DISCORD_COMMAND, Discord command string, env alt DISCORD_COMMAND, optional, (defaults mumble-discord)")
|
||||||
discordDisableText := flag.Bool("discord-disable-text", lookupEnvOrBool("DISCORD_DISABLE_TEXT", false), "DISCORD_DISABLE_TEXT, disable sending direct messages to discord, (default false)")
|
discordDisableText := flag.Bool("discord-disable-text", lookupEnvOrBool("DISCORD_DISABLE_TEXT", false), "DISCORD_DISABLE_TEXT, disable sending direct messages to discord, (default false)")
|
||||||
discordDisableBotStatus := flag.Bool("discord-disable-bot-status", lookupEnvOrBool("DISCORD_DISABLE_BOT_STATUS", false), "DISCORD_DISABLE_BOT_STATUS, disable updating bot status, (default false)")
|
|
||||||
mode := flag.String("mode", lookupEnvOrString("MODE", "constant"), "MODE, [constant, manual, auto] determine which mode the bridge starts in, (default constant)")
|
mode := flag.String("mode", lookupEnvOrString("MODE", "constant"), "MODE, [constant, manual, auto] determine which mode the bridge starts in, (default constant)")
|
||||||
nice := flag.Bool("nice", lookupEnvOrBool("NICE", false), "NICE, whether the bridge should automatically try to 'nice' itself, (default false)")
|
nice := flag.Bool("nice", lookupEnvOrBool("NICE", false), "NICE, whether the bridge should automatically try to 'nice' itself, (default false)")
|
||||||
debug := flag.Int("debug-level", lookupEnvOrInt("DEBUG", 1), "DEBUG_LEVEL, Discord debug level, optional, (default 1)")
|
debug := flag.Int("debug-level", lookupEnvOrInt("DEBUG", 1), "DEBUG_LEVEL, Discord debug level, optional, (default 1)")
|
||||||
promEnable := flag.Bool("prometheus-enable", lookupEnvOrBool("PROMETHEUS_ENABLE", false), "PROMETHEUS_ENABLE, Enable prometheus metrics")
|
|
||||||
promPort := flag.Int("prometheus-port", lookupEnvOrInt("PROMETHEUS_PORT", 9559), "PROMETHEUS_PORT, Prometheus metrics port, optional, (default 9559)")
|
|
||||||
|
|
||||||
cpuprofile := flag.String("cpuprofile", "", "write cpu profile to `file`")
|
cpuprofile := flag.String("cpuprofile", "", "write cpu profile to `file`")
|
||||||
|
|
||||||
@ -88,10 +85,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if *promEnable {
|
|
||||||
go bridge.StartPromServer(*promPort)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Optional CPU Profiling
|
// Optional CPU Profiling
|
||||||
if *cpuprofile != "" {
|
if *cpuprofile != "" {
|
||||||
f, err := os.Create(*cpuprofile)
|
f, err := os.Create(*cpuprofile)
|
||||||
@ -136,7 +129,6 @@ func main() {
|
|||||||
CID: *discordCID,
|
CID: *discordCID,
|
||||||
DiscordStartStreamingCount: discordStartStreamingCount,
|
DiscordStartStreamingCount: discordStartStreamingCount,
|
||||||
DiscordDisableText: *discordDisableText,
|
DiscordDisableText: *discordDisableText,
|
||||||
DiscordDisableBotStatus: *discordDisableBotStatus,
|
|
||||||
Version: version,
|
Version: version,
|
||||||
},
|
},
|
||||||
Connected: false,
|
Connected: false,
|
||||||
@ -144,8 +136,6 @@ func main() {
|
|||||||
MumbleUsers: make(map[string]bool),
|
MumbleUsers: make(map[string]bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
bridge.PromApplicationStartTime.SetToCurrentTime()
|
|
||||||
|
|
||||||
// MUMBLE SETUP
|
// MUMBLE SETUP
|
||||||
Bridge.BridgeConfig.MumbleConfig = gumble.NewConfig()
|
Bridge.BridgeConfig.MumbleConfig = gumble.NewConfig()
|
||||||
Bridge.BridgeConfig.MumbleConfig.Username = *mumbleUsername
|
Bridge.BridgeConfig.MumbleConfig.Username = *mumbleUsername
|
||||||
@ -159,7 +149,6 @@ func main() {
|
|||||||
Bridge.BridgeConfig.MumbleConfig.Attach(gumbleutil.Listener{
|
Bridge.BridgeConfig.MumbleConfig.Attach(gumbleutil.Listener{
|
||||||
Connect: Bridge.MumbleListener.MumbleConnect,
|
Connect: Bridge.MumbleListener.MumbleConnect,
|
||||||
UserChange: Bridge.MumbleListener.MumbleUserChange,
|
UserChange: Bridge.MumbleListener.MumbleUserChange,
|
||||||
// ChannelChange: Bridge.MumbleListener.MumbleChannelChange,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// DISCORD SETUP
|
// DISCORD SETUP
|
||||||
@ -209,6 +198,11 @@ func main() {
|
|||||||
Bridge.Mode = bridge.BridgeModeConstant
|
Bridge.Mode = bridge.BridgeModeConstant
|
||||||
Bridge.DiscordChannelID = Bridge.BridgeConfig.CID
|
Bridge.DiscordChannelID = Bridge.BridgeConfig.CID
|
||||||
go func() {
|
go func() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
fmt.Println("Bridge paniced", r)
|
||||||
|
}
|
||||||
|
}()
|
||||||
for {
|
for {
|
||||||
Bridge.StartBridge()
|
Bridge.StartBridge()
|
||||||
log.Println("Bridge died")
|
log.Println("Bridge died")
|
||||||
|
@ -1,69 +0,0 @@
|
|||||||
# This docker compose file contians an exmaple of staring Mumble-Discord-Bridge with Prometheus and Grafana
|
|
||||||
# The monitoring folder is need to provide the nesscary default configs for Promethus and Grafana
|
|
||||||
# Prometheus port 9090
|
|
||||||
# Grafana port 3030
|
|
||||||
|
|
||||||
version: '3.8'
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
prometheus_data: {}
|
|
||||||
grafana_data: {}
|
|
||||||
|
|
||||||
services:
|
|
||||||
|
|
||||||
services:
|
|
||||||
mumble-discord-bridge:
|
|
||||||
image: stieneee/mumble-discord-bridge
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- mdb
|
|
||||||
environment:
|
|
||||||
- MUMBLE_ADDRESS=example.com"
|
|
||||||
- MUMBLE_USERNAME=discord-bridge
|
|
||||||
- MUMBLE_PASSWORD=password
|
|
||||||
- DISCORD_TOKEN=token
|
|
||||||
- DISCORD_GID=gid
|
|
||||||
- DISCORD_CID=cid
|
|
||||||
|
|
||||||
prometheus:
|
|
||||||
image: prom/prometheus:latest
|
|
||||||
container_name: prometheus
|
|
||||||
volumes:
|
|
||||||
- ./prometheus:/etc/prometheus
|
|
||||||
- prometheus_data:/prometheus
|
|
||||||
command:
|
|
||||||
- '--config.file=/etc/prometheus/prometheus.yml'
|
|
||||||
- '--storage.tsdb.path=/prometheus'
|
|
||||||
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
|
||||||
- '--web.console.templates=/etc/prometheus/consoles'
|
|
||||||
- '--storage.tsdb.retention.time=200h'
|
|
||||||
- '--web.enable-lifecycle'
|
|
||||||
restart: unless-stopped
|
|
||||||
expose:
|
|
||||||
- 9090
|
|
||||||
ports:
|
|
||||||
- 9090:9090
|
|
||||||
depends_on:
|
|
||||||
- mumble-discord-bridge
|
|
||||||
|
|
||||||
grafana:
|
|
||||||
image: grafana/grafana:latest
|
|
||||||
container_name: grafana
|
|
||||||
volumes:
|
|
||||||
# - grafana_data:/var/lib/grafana
|
|
||||||
- ./grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
|
|
||||||
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
|
|
||||||
environment:
|
|
||||||
# - GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin}
|
|
||||||
# - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
|
|
||||||
- GF_USERS_ALLOW_SIGN_UP=false
|
|
||||||
- GF_AUTH_ANONYMOUS_ENABLED=true
|
|
||||||
- GF_AUTH_ANONYMOUS_ORG_NAME=Main Org.
|
|
||||||
- GF_AUTH_ANONYMOUS_ORG_ROLE=Editor
|
|
||||||
restart: unless-stopped
|
|
||||||
expose:
|
|
||||||
- 3000
|
|
||||||
ports:
|
|
||||||
- 3030:3000
|
|
||||||
depends_on:
|
|
||||||
- prometheus
|
|
@ -1,6 +1,3 @@
|
|||||||
# This a basic docker-compose file to run an instance an instance of Mumble-Discord-Bridge
|
|
||||||
# docker-compose -f ./docker-compose.yml up -d
|
|
||||||
|
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
Binary file not shown.
Before Width: | Height: | Size: 156 KiB |
@ -1,24 +0,0 @@
|
|||||||
apiVersion: 1
|
|
||||||
|
|
||||||
providers:
|
|
||||||
# <string> an unique provider name. Required
|
|
||||||
- name: 'MDB'
|
|
||||||
# <int> Org id. Default to 1
|
|
||||||
orgId: 1
|
|
||||||
# <string> name of the dashboard folder.
|
|
||||||
folder: ''
|
|
||||||
# <string> folder UID. will be automatically generated if not specified
|
|
||||||
folderUid: ''
|
|
||||||
# <string> provider type. Default to 'file'
|
|
||||||
type: file
|
|
||||||
# <bool> disable dashboard deletion
|
|
||||||
disableDeletion: false
|
|
||||||
# <int> how often Grafana will scan for changed dashboards
|
|
||||||
updateIntervalSeconds: 30
|
|
||||||
# <bool> allow updating provisioned dashboards from the UI
|
|
||||||
allowUiUpdates: true
|
|
||||||
options:
|
|
||||||
# <string, required> path to dashboard files on disk. Required when using the 'file' type
|
|
||||||
path: /etc/grafana/provisioning/dashboards
|
|
||||||
# <bool> use folder names from filesystem to create folders in Grafana
|
|
||||||
foldersFromFilesStructure: false
|
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +0,0 @@
|
|||||||
apiVersion: 1
|
|
||||||
|
|
||||||
datasources:
|
|
||||||
- name: Prometheus
|
|
||||||
type: prometheus
|
|
||||||
access: proxy
|
|
||||||
orgId: 1
|
|
||||||
url: http://prometheus:9090
|
|
||||||
basicAuth: false
|
|
||||||
isDefault: true
|
|
||||||
editable: true
|
|
@ -1,12 +0,0 @@
|
|||||||
global:
|
|
||||||
scrape_interval: 15s
|
|
||||||
evaluation_interval: 15s
|
|
||||||
|
|
||||||
# A scrape configuration containing exactly one endpoint to scrape.
|
|
||||||
scrape_configs:
|
|
||||||
- job_name: 'mdb'
|
|
||||||
scrape_interval: 1s
|
|
||||||
static_configs:
|
|
||||||
- targets: [
|
|
||||||
'mumble-discord-bridge:9559',
|
|
||||||
]
|
|
2
go.mod
2
go.mod
@ -5,9 +5,9 @@ go 1.15
|
|||||||
require (
|
require (
|
||||||
github.com/bwmarrin/discordgo v0.23.3-0.20210512035133-7d7206b01bb5
|
github.com/bwmarrin/discordgo v0.23.3-0.20210512035133-7d7206b01bb5
|
||||||
github.com/joho/godotenv v1.3.0
|
github.com/joho/godotenv v1.3.0
|
||||||
github.com/prometheus/client_golang v1.11.0
|
|
||||||
github.com/stieneee/gopus v0.0.0-20210424193312-6d10f6090335
|
github.com/stieneee/gopus v0.0.0-20210424193312-6d10f6090335
|
||||||
github.com/stieneee/gumble v0.0.0-20210424210604-732f48b5e0de
|
github.com/stieneee/gumble v0.0.0-20210424210604-732f48b5e0de
|
||||||
github.com/stieneee/tickerct v0.0.0-20210420020607-d1b092aa40e9
|
github.com/stieneee/tickerct v0.0.0-20210420020607-d1b092aa40e9
|
||||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
|
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
|
||||||
|
golang.org/x/sys v0.0.0-20210108172913-0df2131ae363 // indirect
|
||||||
)
|
)
|
||||||
|
133
go.sum
133
go.sum
@ -1,159 +1,38 @@
|
|||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
|
||||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
|
||||||
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
|
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
|
||||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
|
||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
|
||||||
github.com/bwmarrin/discordgo v0.23.3-0.20210512035133-7d7206b01bb5 h1:VtiZMSjY2N6XpM1luSchBVX76QURpS0HA7BffVuHOCo=
|
github.com/bwmarrin/discordgo v0.23.3-0.20210512035133-7d7206b01bb5 h1:VtiZMSjY2N6XpM1luSchBVX76QURpS0HA7BffVuHOCo=
|
||||||
github.com/bwmarrin/discordgo v0.23.3-0.20210512035133-7d7206b01bb5/go.mod h1:OMKxbTmkKofBjBi4/yidO3ItxbJ6PUfEUkjchM4En8c=
|
github.com/bwmarrin/discordgo v0.23.3-0.20210512035133-7d7206b01bb5/go.mod h1:OMKxbTmkKofBjBi4/yidO3ItxbJ6PUfEUkjchM4En8c=
|
||||||
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
github.com/dchote/go-openal v0.0.0-20171116030048-f4a9a141d372 h1:tz3KnXWtRZR0RWOfcMNOw+HHezWLQa7vfSOWTtKjchI=
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/dchote/go-openal v0.0.0-20171116030048-f4a9a141d372/go.mod h1:74z+CYu2/mx4N+mcIS/rsvfAxBPBV9uv8zRAnwyFkdI=
|
github.com/dchote/go-openal v0.0.0-20171116030048-f4a9a141d372/go.mod h1:74z+CYu2/mx4N+mcIS/rsvfAxBPBV9uv8zRAnwyFkdI=
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
|
||||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
|
||||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
|
||||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
|
||||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
|
||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
|
||||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
|
||||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
|
||||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
|
||||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
|
||||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
|
||||||
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
|
||||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
||||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
|
||||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
|
||||||
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
|
|
||||||
github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ=
|
|
||||||
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
|
|
||||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
|
||||||
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
|
||||||
github.com/prometheus/common v0.26.0 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ=
|
|
||||||
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
|
|
||||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
|
||||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
|
||||||
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
|
||||||
github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
|
|
||||||
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
|
||||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
|
||||||
github.com/stieneee/gopus v0.0.0-20210424193312-6d10f6090335 h1:yzwz6AqGKysli5du4CrQ48BMGUCSkrl7V7Kbo9VaG8w=
|
github.com/stieneee/gopus v0.0.0-20210424193312-6d10f6090335 h1:yzwz6AqGKysli5du4CrQ48BMGUCSkrl7V7Kbo9VaG8w=
|
||||||
github.com/stieneee/gopus v0.0.0-20210424193312-6d10f6090335/go.mod h1:tAKYr3fSBJGold7c9DMPlhupn9oy8hTgl3cZ0hoyRQs=
|
github.com/stieneee/gopus v0.0.0-20210424193312-6d10f6090335/go.mod h1:tAKYr3fSBJGold7c9DMPlhupn9oy8hTgl3cZ0hoyRQs=
|
||||||
github.com/stieneee/gumble v0.0.0-20210424210604-732f48b5e0de h1:4dWOeXRnba4jHVa3KuWf7i/GOIAlBMR3euVTUXOey2I=
|
github.com/stieneee/gumble v0.0.0-20210424210604-732f48b5e0de h1:4dWOeXRnba4jHVa3KuWf7i/GOIAlBMR3euVTUXOey2I=
|
||||||
github.com/stieneee/gumble v0.0.0-20210424210604-732f48b5e0de/go.mod h1:hVIsmrlrudlx2HJbsDkIZI4crkv6NHSau0ldEWbQI/Y=
|
github.com/stieneee/gumble v0.0.0-20210424210604-732f48b5e0de/go.mod h1:hVIsmrlrudlx2HJbsDkIZI4crkv6NHSau0ldEWbQI/Y=
|
||||||
github.com/stieneee/tickerct v0.0.0-20210420020607-d1b092aa40e9 h1:0l2H6Oj6JHMmkqm9xaBMQA5MOGhPT+Nn/thlTUcD9Iw=
|
github.com/stieneee/tickerct v0.0.0-20210420020607-d1b092aa40e9 h1:0l2H6Oj6JHMmkqm9xaBMQA5MOGhPT+Nn/thlTUcD9Iw=
|
||||||
github.com/stieneee/tickerct v0.0.0-20210420020607-d1b092aa40e9/go.mod h1:54+oZlabriEpT52rPAjAeEWUFgYqv325LrS3hNxHGFE=
|
github.com/stieneee/tickerct v0.0.0-20210420020607-d1b092aa40e9/go.mod h1:54+oZlabriEpT52rPAjAeEWUFgYqv325LrS3hNxHGFE=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
|
||||||
golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
|
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
|
||||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
|
||||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210108172913-0df2131ae363 h1:wHn06sgWHMO1VsQ8F+KzDJx/JzqfsNLnc+oEi07qD7s=
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210108172913-0df2131ae363/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM=
|
||||||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q=
|
|
||||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||||
|
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
|
||||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
|
||||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
|
||||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
|
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
|
@ -42,7 +42,6 @@ type BridgeConfig struct {
|
|||||||
CID string
|
CID string
|
||||||
DiscordStartStreamingCount int
|
DiscordStartStreamingCount int
|
||||||
DiscordDisableText bool
|
DiscordDisableText bool
|
||||||
DiscordDisableBotStatus bool
|
|
||||||
Version string
|
Version string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,9 +119,6 @@ func (b *BridgeState) StartBridge() {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
promBridgeStarts.Inc()
|
|
||||||
promBridgeStartTime.SetToCurrentTime()
|
|
||||||
|
|
||||||
// DISCORD Connect Voice
|
// DISCORD Connect Voice
|
||||||
log.Println("Attempting to join Discord voice channel")
|
log.Println("Attempting to join Discord voice channel")
|
||||||
if b.DiscordChannelID == "" {
|
if b.DiscordChannelID == "" {
|
||||||
@ -142,7 +138,7 @@ func (b *BridgeState) StartBridge() {
|
|||||||
|
|
||||||
// MUMBLE Connect
|
// MUMBLE Connect
|
||||||
|
|
||||||
b.MumbleStream = NewMumbleDuplex()
|
b.MumbleStream = &MumbleDuplex{}
|
||||||
det := b.BridgeConfig.MumbleConfig.AudioListeners.Attach(b.MumbleStream)
|
det := b.BridgeConfig.MumbleConfig.AudioListeners.Attach(b.MumbleStream)
|
||||||
defer det.Detach()
|
defer det.Detach()
|
||||||
|
|
||||||
@ -181,40 +177,26 @@ func (b *BridgeState) StartBridge() {
|
|||||||
defer close(toDiscord)
|
defer close(toDiscord)
|
||||||
defer close(toMumble)
|
defer close(toMumble)
|
||||||
|
|
||||||
// From Discord
|
|
||||||
b.DiscordStream = NewDiscordDuplex(b)
|
|
||||||
|
|
||||||
// Start Passing Between
|
// Start Passing Between
|
||||||
|
|
||||||
// From Mumble
|
// From Mumble
|
||||||
wg.Add(1)
|
go b.MumbleStream.fromMumbleMixer(ctx, &wg, toDiscord)
|
||||||
go func() {
|
|
||||||
defer wg.Done()
|
|
||||||
b.MumbleStream.fromMumbleMixer(ctx, cancel, toDiscord)
|
|
||||||
}()
|
|
||||||
|
|
||||||
wg.Add(1)
|
// From Discord
|
||||||
go func() {
|
b.DiscordStream = &DiscordDuplex{
|
||||||
defer wg.Done()
|
Bridge: b,
|
||||||
b.DiscordStream.discordReceivePCM(ctx, cancel)
|
fromDiscordMap: make(map[uint32]fromDiscord),
|
||||||
}()
|
}
|
||||||
wg.Add(1)
|
|
||||||
go func() {
|
go b.DiscordStream.discordReceivePCM(ctx, &wg, cancel)
|
||||||
defer wg.Done()
|
go b.DiscordStream.fromDiscordMixer(ctx, &wg, toMumble)
|
||||||
b.DiscordStream.fromDiscordMixer(ctx, toMumble)
|
|
||||||
}()
|
|
||||||
|
|
||||||
// To Discord
|
// To Discord
|
||||||
wg.Add(1)
|
go b.DiscordStream.discordSendPCM(ctx, &wg, cancel, toDiscord)
|
||||||
go func() {
|
|
||||||
defer wg.Done()
|
|
||||||
b.DiscordStream.discordSendPCM(ctx, cancel, toDiscord)
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Monitor
|
// Monitor Mumble
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
|
||||||
ticker := time.NewTicker(500 * time.Millisecond)
|
ticker := time.NewTicker(500 * time.Millisecond)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
@ -228,6 +210,7 @@ func (b *BridgeState) StartBridge() {
|
|||||||
cancel()
|
cancel()
|
||||||
}
|
}
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
wg.Done()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,9 +252,6 @@ func (b *BridgeState) DiscordStatusUpdate() {
|
|||||||
log.Printf("error pinging mumble server %v\n", err)
|
log.Printf("error pinging mumble server %v\n", err)
|
||||||
b.DiscordSession.UpdateListeningStatus("an error pinging mumble")
|
b.DiscordSession.UpdateListeningStatus("an error pinging mumble")
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
promMumblePing.Set(float64(resp.Ping.Milliseconds()))
|
|
||||||
|
|
||||||
b.MumbleUsersMutex.Lock()
|
b.MumbleUsersMutex.Lock()
|
||||||
b.BridgeMutex.Lock()
|
b.BridgeMutex.Lock()
|
||||||
b.MumbleUserCount = resp.ConnectedUsers
|
b.MumbleUserCount = resp.ConnectedUsers
|
||||||
@ -279,7 +259,7 @@ func (b *BridgeState) DiscordStatusUpdate() {
|
|||||||
b.MumbleUserCount = b.MumbleUserCount - 1
|
b.MumbleUserCount = b.MumbleUserCount - 1
|
||||||
}
|
}
|
||||||
if b.MumbleUserCount == 0 {
|
if b.MumbleUserCount == 0 {
|
||||||
status = "no users in Mumble"
|
status = "No users in Mumble"
|
||||||
} else {
|
} else {
|
||||||
if len(b.MumbleUsers) > 0 {
|
if len(b.MumbleUsers) > 0 {
|
||||||
status = fmt.Sprintf("%v/%v users in Mumble\n", len(b.MumbleUsers), b.MumbleUserCount)
|
status = fmt.Sprintf("%v/%v users in Mumble\n", len(b.MumbleUsers), b.MumbleUserCount)
|
||||||
@ -289,16 +269,8 @@ func (b *BridgeState) DiscordStatusUpdate() {
|
|||||||
}
|
}
|
||||||
b.BridgeMutex.Unlock()
|
b.BridgeMutex.Unlock()
|
||||||
b.MumbleUsersMutex.Unlock()
|
b.MumbleUsersMutex.Unlock()
|
||||||
if !b.BridgeConfig.DiscordDisableBotStatus {
|
b.DiscordSession.UpdateListeningStatus(status)
|
||||||
b.DiscordSession.UpdateListeningStatus(status)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
discordHeartBeat := b.DiscordSession.LastHeartbeatAck.Sub(b.DiscordSession.LastHeartbeatSent).Milliseconds()
|
|
||||||
if discordHeartBeat > 0 {
|
|
||||||
promDiscordHeartBeat.Set(float64(discordHeartBeat))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,6 +150,7 @@ func (l *DiscordListener) MessageCreate(s *discordgo.Session, m *discordgo.Messa
|
|||||||
go l.Bridge.AutoBridge()
|
go l.Bridge.AutoBridge()
|
||||||
} else {
|
} else {
|
||||||
l.Bridge.DiscordSession.ChannelMessageSend(m.ChannelID, "Auto mode disabled")
|
l.Bridge.DiscordSession.ChannelMessageSend(m.ChannelID, "Auto mode disabled")
|
||||||
|
l.Bridge.DiscordChannelID = ""
|
||||||
l.Bridge.AutoChanDie <- true
|
l.Bridge.AutoChanDie <- true
|
||||||
l.Bridge.Mode = BridgeModeManual
|
l.Bridge.Mode = BridgeModeManual
|
||||||
}
|
}
|
||||||
@ -226,13 +227,9 @@ func (l *DiscordListener) VoiceUpdate(s *discordgo.Session, event *discordgo.Voi
|
|||||||
l.Bridge.MumbleClient.Self.Channel.Send(fmt.Sprintf("%v has left Discord channel\n", l.Bridge.DiscordUsers[id].username), false)
|
l.Bridge.MumbleClient.Self.Channel.Send(fmt.Sprintf("%v has left Discord channel\n", l.Bridge.DiscordUsers[id].username), false)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
delete(l.Bridge.DiscordUsers, id)
|
|
||||||
l.Bridge.BridgeMutex.Unlock()
|
l.Bridge.BridgeMutex.Unlock()
|
||||||
|
delete(l.Bridge.DiscordUsers, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
l.Bridge.BridgeMutex.Lock()
|
|
||||||
promDiscordUsers.Set(float64(len(l.Bridge.DiscordUsers)))
|
|
||||||
l.Bridge.BridgeMutex.Unlock()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,19 +26,8 @@ type fromDiscord struct {
|
|||||||
type DiscordDuplex struct {
|
type DiscordDuplex struct {
|
||||||
Bridge *BridgeState
|
Bridge *BridgeState
|
||||||
|
|
||||||
discordMutex sync.Mutex
|
discordMutex sync.Mutex
|
||||||
fromDiscordMap map[uint32]fromDiscord
|
fromDiscordMap map[uint32]fromDiscord
|
||||||
discordSendSleepTick sleepct.SleepCT
|
|
||||||
discordReceiveSleepTick sleepct.SleepCT
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewDiscordDuplex(b *BridgeState) *DiscordDuplex {
|
|
||||||
return &DiscordDuplex{
|
|
||||||
Bridge: b,
|
|
||||||
fromDiscordMap: make(map[uint32]fromDiscord),
|
|
||||||
discordSendSleepTick: sleepct.SleepCT{},
|
|
||||||
discordReceiveSleepTick: sleepct.SleepCT{},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnError gets called by dgvoice when an error is encountered.
|
// OnError gets called by dgvoice when an error is encountered.
|
||||||
@ -54,8 +43,8 @@ var OnError = func(str string, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SendPCM will receive on the provied channel encode
|
// SendPCM will receive on the provied channel encode
|
||||||
// received PCM data with Opus then send that to Discordgo
|
// received PCM data into Opus then send that to Discordgo
|
||||||
func (dd *DiscordDuplex) discordSendPCM(ctx context.Context, cancel context.CancelFunc, pcm <-chan []int16) {
|
func (dd *DiscordDuplex) discordSendPCM(ctx context.Context, wg *sync.WaitGroup, cancel context.CancelFunc, pcm <-chan []int16) {
|
||||||
const channels int = 1
|
const channels int = 1
|
||||||
const frameRate int = 48000 // audio sampling rate
|
const frameRate int = 48000 // audio sampling rate
|
||||||
const frameSize int = 960 // uint16 size of each audio frame
|
const frameSize int = 960 // uint16 size of each audio frame
|
||||||
@ -72,27 +61,14 @@ func (dd *DiscordDuplex) discordSendPCM(ctx context.Context, cancel context.Canc
|
|||||||
// Generate Opus Silence Frame
|
// Generate Opus Silence Frame
|
||||||
opusSilence := []byte{0xf8, 0xff, 0xfe}
|
opusSilence := []byte{0xf8, 0xff, 0xfe}
|
||||||
|
|
||||||
dd.discordSendSleepTick.Start(20 * time.Millisecond)
|
sleepTick := sleepct.SleepCT{}
|
||||||
|
sleepTick.Start(20 * time.Millisecond)
|
||||||
|
|
||||||
lastReady := true
|
lastReady := true
|
||||||
var readyTimeout *time.Timer
|
var readyTimeout *time.Timer
|
||||||
var speakingStart time.Time
|
var speakingStart time.Time
|
||||||
|
|
||||||
// Spy on the PCM channel to notify
|
wg.Add(1)
|
||||||
// TODO determine a method to notify a paused sleepct
|
|
||||||
// pcm := make(chan []int16, 10)
|
|
||||||
// go func() {
|
|
||||||
// for {
|
|
||||||
// t, ok := <-pcmIn
|
|
||||||
// if !ok {
|
|
||||||
// close(pcm)
|
|
||||||
// return
|
|
||||||
// } else {
|
|
||||||
// dd.discordSendSleepTick.Notify()
|
|
||||||
// pcm <- t
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }()
|
|
||||||
|
|
||||||
internalSend := func(opus []byte) {
|
internalSend := func(opus []byte) {
|
||||||
dd.Bridge.DiscordVoice.RWMutex.RLock()
|
dd.Bridge.DiscordVoice.RWMutex.RLock()
|
||||||
@ -110,47 +86,25 @@ func (dd *DiscordDuplex) discordSendPCM(ctx context.Context, cancel context.Canc
|
|||||||
lastReady = true
|
lastReady = true
|
||||||
readyTimeout.Stop()
|
readyTimeout.Stop()
|
||||||
} else {
|
} else {
|
||||||
select {
|
dd.Bridge.DiscordVoice.OpusSend <- opus
|
||||||
case dd.Bridge.DiscordVoice.OpusSend <- opus:
|
|
||||||
case <-ctx.Done():
|
|
||||||
}
|
|
||||||
|
|
||||||
promDiscordSentPackets.Inc()
|
|
||||||
}
|
}
|
||||||
dd.Bridge.DiscordVoice.RWMutex.RUnlock()
|
dd.Bridge.DiscordVoice.RWMutex.RUnlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
defer log.Println("Stopping Discord send PCM")
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
wg.Done()
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are not streaming try to pause
|
sleepTick.SleepNextTarget()
|
||||||
// promTimerDiscordSend.Observe(float64(dd.discordSendSleepTick.SleepNextTarget(ctx, !streaming)))
|
|
||||||
promTimerDiscordSend.Observe(float64(dd.discordSendSleepTick.SleepNextTarget(ctx, false)))
|
|
||||||
|
|
||||||
if (len(pcm) > 1 && streaming) || (len(pcm) > dd.Bridge.BridgeConfig.DiscordStartStreamingCount && !streaming) {
|
if (len(pcm) > 1 && streaming) || (len(pcm) > dd.Bridge.BridgeConfig.DiscordStartStreamingCount && !streaming) {
|
||||||
if !streaming {
|
if !streaming {
|
||||||
speakingStart = time.Now()
|
speakingStart = time.Now()
|
||||||
done := make(chan bool, 1)
|
dd.Bridge.DiscordVoice.Speaking(true)
|
||||||
go func() {
|
|
||||||
// This call will prevent discordSendPCM from exiting if the discord connection is lost
|
|
||||||
dd.Bridge.DiscordVoice.Speaking(true)
|
|
||||||
done <- true
|
|
||||||
}()
|
|
||||||
select {
|
|
||||||
case <-done:
|
|
||||||
case <-time.After(5 * time.Second):
|
|
||||||
fmt.Println("Discord speaking timeout :(")
|
|
||||||
cancel()
|
|
||||||
return
|
|
||||||
case <-ctx.Done():
|
|
||||||
return
|
|
||||||
}
|
|
||||||
streaming = true
|
streaming = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +126,7 @@ func (dd *DiscordDuplex) discordSendPCM(ctx context.Context, cancel context.Canc
|
|||||||
// It is possible that short speaking cycle is the result of a short input to mumble (Not a problem). ie a quick tap of push to talk button.
|
// It is possible that short speaking cycle is the result of a short input to mumble (Not a problem). ie a quick tap of push to talk button.
|
||||||
// Or when timing delays are introduced via network, hardware or kernel delays (Problem).
|
// Or when timing delays are introduced via network, hardware or kernel delays (Problem).
|
||||||
// The problem delays result in choppy or stuttering sounds, especially when the silence frames are introduced into the opus frames below.
|
// The problem delays result in choppy or stuttering sounds, especially when the silence frames are introduced into the opus frames below.
|
||||||
// Multiple short cycle delays can result in a discord rate limiter being trigger due to of multiple JSON speaking/not-speaking state changes
|
// Multiple short cycle delays can result in a Discrod rate limiter being trigger due to of multiple JSON speaking/not-speaking state changes
|
||||||
if time.Since(speakingStart).Milliseconds() < 50 {
|
if time.Since(speakingStart).Milliseconds() < 50 {
|
||||||
log.Println("Warning: Short Mumble to Discord speaking cycle. Consider increaseing the size of the to Discord jitter buffer.")
|
log.Println("Warning: Short Mumble to Discord speaking cycle. Consider increaseing the size of the to Discord jitter buffer.")
|
||||||
}
|
}
|
||||||
@ -181,9 +135,7 @@ func (dd *DiscordDuplex) discordSendPCM(ctx context.Context, cancel context.Canc
|
|||||||
// We want to do this after alerting the user of possible short speaking cycles
|
// We want to do this after alerting the user of possible short speaking cycles
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
internalSend(opusSilence)
|
internalSend(opusSilence)
|
||||||
// promTimerDiscordSend.Observe(float64(dd.discordSendSleepTick.SleepNextTarget(ctx, true)))
|
sleepTick.SleepNextTarget()
|
||||||
promTimerDiscordSend.Observe(float64(dd.discordSendSleepTick.SleepNextTarget(ctx, false)))
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dd.Bridge.DiscordVoice.Speaking(false)
|
dd.Bridge.DiscordVoice.Speaking(false)
|
||||||
@ -195,7 +147,7 @@ func (dd *DiscordDuplex) discordSendPCM(ctx context.Context, cancel context.Canc
|
|||||||
|
|
||||||
// ReceivePCM will receive on the the Discordgo OpusRecv channel and decode
|
// ReceivePCM will receive on the the Discordgo OpusRecv channel and decode
|
||||||
// the opus audio into PCM then send it on the provided channel.
|
// the opus audio into PCM then send it on the provided channel.
|
||||||
func (dd *DiscordDuplex) discordReceivePCM(ctx context.Context, cancel context.CancelFunc) {
|
func (dd *DiscordDuplex) discordReceivePCM(ctx context.Context, wg *sync.WaitGroup, cancel context.CancelFunc) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
lastReady := true
|
lastReady := true
|
||||||
@ -206,6 +158,8 @@ func (dd *DiscordDuplex) discordReceivePCM(ctx context.Context, cancel context.C
|
|||||||
zeros[i] = 0
|
zeros[i] = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wg.Add(1)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
dd.Bridge.DiscordVoice.RWMutex.RLock()
|
dd.Bridge.DiscordVoice.RWMutex.RLock()
|
||||||
if !dd.Bridge.DiscordVoice.Ready || dd.Bridge.DiscordVoice.OpusRecv == nil {
|
if !dd.Bridge.DiscordVoice.Ready || dd.Bridge.DiscordVoice.OpusRecv == nil {
|
||||||
@ -230,7 +184,7 @@ func (dd *DiscordDuplex) discordReceivePCM(ctx context.Context, cancel context.C
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
log.Println("Stopping Discord receive PCM")
|
wg.Done()
|
||||||
return
|
return
|
||||||
case p, ok = <-dd.Bridge.DiscordVoice.OpusRecv:
|
case p, ok = <-dd.Bridge.DiscordVoice.OpusRecv:
|
||||||
}
|
}
|
||||||
@ -280,7 +234,7 @@ func (dd *DiscordDuplex) discordReceivePCM(ctx context.Context, cancel context.C
|
|||||||
dd.fromDiscordMap[p.SSRC] = s
|
dd.fromDiscordMap[p.SSRC] = s
|
||||||
dd.discordMutex.Unlock()
|
dd.discordMutex.Unlock()
|
||||||
|
|
||||||
p.PCM, err = s.decoder.Decode(p.Opus, deltaT, false)
|
p.PCM, err = s.decoder.Decode(p.Opus, deltaT*2, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
OnError("Error decoding opus data", err)
|
OnError("Error decoding opus data", err)
|
||||||
continue
|
continue
|
||||||
@ -288,8 +242,6 @@ func (dd *DiscordDuplex) discordReceivePCM(ctx context.Context, cancel context.C
|
|||||||
|
|
||||||
// fmt.Println(p.SSRC, p.Type, deltaT, p.Sequence, p.Sequence-s.lastSequence, oldReceiving, s.streaming, len(p.Opus), len(p.PCM))
|
// fmt.Println(p.SSRC, p.Type, deltaT, p.Sequence, p.Sequence-s.lastSequence, oldReceiving, s.streaming, len(p.Opus), len(p.PCM))
|
||||||
|
|
||||||
promDiscordReceivedPackets.Inc()
|
|
||||||
|
|
||||||
// Push data into pcm channel in 10ms chunks of mono pcm data
|
// Push data into pcm channel in 10ms chunks of mono pcm data
|
||||||
dd.discordMutex.Lock()
|
dd.discordMutex.Lock()
|
||||||
for l := 0; l < len(p.PCM); l = l + 480 {
|
for l := 0; l < len(p.PCM); l = l + 480 {
|
||||||
@ -305,41 +257,37 @@ func (dd *DiscordDuplex) discordReceivePCM(ctx context.Context, cancel context.C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dd.discordMutex.Unlock()
|
dd.discordMutex.Unlock()
|
||||||
|
|
||||||
dd.discordReceiveSleepTick.Notify()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dd *DiscordDuplex) fromDiscordMixer(ctx context.Context, toMumble chan<- gumble.AudioBuffer) {
|
func (dd *DiscordDuplex) fromDiscordMixer(ctx context.Context, wg *sync.WaitGroup, toMumble chan<- gumble.AudioBuffer) {
|
||||||
mumbleSilence := gumble.AudioBuffer{}
|
mumbleSilence := gumble.AudioBuffer{}
|
||||||
for i := 3; i < 480; i++ {
|
for i := 3; i < 480; i++ {
|
||||||
mumbleSilence = append(mumbleSilence, 0x00)
|
mumbleSilence = append(mumbleSilence, 0x00)
|
||||||
}
|
}
|
||||||
var speakingStart time.Time
|
var speakingStart time.Time
|
||||||
|
|
||||||
dd.discordReceiveSleepTick.Start(10 * time.Millisecond)
|
sleepTick := sleepct.SleepCT{}
|
||||||
|
sleepTick.Start(10 * time.Millisecond)
|
||||||
|
|
||||||
sendAudio := false
|
sendAudio := false
|
||||||
toMumbleStreaming := false
|
toMumbleStreaming := false
|
||||||
|
wg.Add(1)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
log.Println("Stopping from Discord mixer")
|
wg.Done()
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
// if didn't send audio try to pause
|
sleepTick.SleepNextTarget()
|
||||||
// promTimerDiscordMixer.Observe(float64(dd.discordReceiveSleepTick.SleepNextTarget(ctx, !sendAudio)))
|
|
||||||
// TODO Additional pause testing
|
|
||||||
promTimerDiscordMixer.Observe(float64(dd.discordReceiveSleepTick.SleepNextTarget(ctx, false)))
|
|
||||||
|
|
||||||
dd.discordMutex.Lock()
|
dd.discordMutex.Lock()
|
||||||
|
|
||||||
sendAudio = false
|
sendAudio = false
|
||||||
internalMixerArr := make([][]int16, 0)
|
internalMixerArr := make([][]int16, 0)
|
||||||
streamingCount := 0
|
|
||||||
|
|
||||||
// Work through each channel
|
// Work through each channel
|
||||||
for i := range dd.fromDiscordMap {
|
for i := range dd.fromDiscordMap {
|
||||||
@ -358,7 +306,6 @@ func (dd *DiscordDuplex) fromDiscordMixer(ctx context.Context, toMumble chan<- g
|
|||||||
dd.fromDiscordMap[i] = x
|
dd.fromDiscordMap[i] = x
|
||||||
}
|
}
|
||||||
|
|
||||||
streamingCount++
|
|
||||||
x1 := (<-dd.fromDiscordMap[i].pcm)
|
x1 := (<-dd.fromDiscordMap[i].pcm)
|
||||||
internalMixerArr = append(internalMixerArr, x1)
|
internalMixerArr = append(internalMixerArr, x1)
|
||||||
} else {
|
} else {
|
||||||
@ -371,9 +318,6 @@ func (dd *DiscordDuplex) fromDiscordMixer(ctx context.Context, toMumble chan<- g
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
promDiscordArraySize.Set(float64(len(dd.fromDiscordMap)))
|
|
||||||
promDiscordStreaming.Set(float64(streamingCount))
|
|
||||||
|
|
||||||
dd.discordMutex.Unlock()
|
dd.discordMutex.Unlock()
|
||||||
|
|
||||||
mumbleTimeoutSend := func(outBuf []int16) {
|
mumbleTimeoutSend := func(outBuf []int16) {
|
||||||
@ -385,10 +329,8 @@ func (dd *DiscordDuplex) fromDiscordMixer(ctx context.Context, toMumble chan<- g
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case toMumble <- outBuf:
|
case toMumble <- outBuf:
|
||||||
promSentMumblePackets.Inc()
|
|
||||||
case <-timeout:
|
case <-timeout:
|
||||||
log.Println("To Mumble timeout. Dropping packet")
|
log.Println("To Mumble timeout. Dropping packet")
|
||||||
promToMumbleDropped.Inc()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +354,7 @@ func (dd *DiscordDuplex) fromDiscordMixer(ctx context.Context, toMumble chan<- g
|
|||||||
|
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
mumbleTimeoutSend(mumbleSilence)
|
mumbleTimeoutSend(mumbleSilence)
|
||||||
promTimerDiscordMixer.Observe(float64(dd.discordReceiveSleepTick.SleepNextTarget(ctx, false)))
|
sleepTick.SleepNextTarget()
|
||||||
}
|
}
|
||||||
|
|
||||||
toMumbleStreaming = false
|
toMumbleStreaming = false
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package bridge
|
package bridge
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/stieneee/gumble/gumble"
|
"github.com/stieneee/gumble/gumble"
|
||||||
)
|
)
|
||||||
@ -14,44 +12,28 @@ type MumbleListener struct {
|
|||||||
Bridge *BridgeState
|
Bridge *BridgeState
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *MumbleListener) updateUsers() {
|
|
||||||
l.Bridge.MumbleUsersMutex.Lock()
|
|
||||||
l.Bridge.MumbleUsers = make(map[string]bool)
|
|
||||||
for _, user := range l.Bridge.MumbleClient.Self.Channel.Users {
|
|
||||||
//note, this might be too slow for really really big channels?
|
|
||||||
//event listeners block while processing
|
|
||||||
//also probably bad to rebuild the set every user change.
|
|
||||||
if user.Name != l.Bridge.MumbleClient.Self.Name {
|
|
||||||
l.Bridge.MumbleUsers[user.Name] = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
promMumbleUsers.Set(float64(len(l.Bridge.MumbleUsers)))
|
|
||||||
l.Bridge.MumbleUsersMutex.Unlock()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *MumbleListener) MumbleConnect(e *gumble.ConnectEvent) {
|
func (l *MumbleListener) MumbleConnect(e *gumble.ConnectEvent) {
|
||||||
//join specified channel
|
//join specified channel
|
||||||
startingChannel := e.Client.Channels.Find(l.Bridge.BridgeConfig.MumbleChannel...)
|
startingChannel := e.Client.Channels.Find(l.Bridge.BridgeConfig.MumbleChannel...)
|
||||||
if startingChannel != nil {
|
if startingChannel != nil {
|
||||||
e.Client.Self.Move(startingChannel)
|
e.Client.Self.Move(startingChannel)
|
||||||
}
|
}
|
||||||
|
|
||||||
// l.updateUsers() // patch below
|
|
||||||
|
|
||||||
// This is an ugly patch Mumble Client state is slow to update
|
|
||||||
time.AfterFunc(5*time.Second, func() {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
fmt.Printf("Failed to mumble user list %v \n", r)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
l.updateUsers()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *MumbleListener) MumbleUserChange(e *gumble.UserChangeEvent) {
|
func (l *MumbleListener) MumbleUserChange(e *gumble.UserChangeEvent) {
|
||||||
l.updateUsers()
|
l.Bridge.MumbleUsersMutex.Lock()
|
||||||
|
if e.Type.Has(gumble.UserChangeConnected) || e.Type.Has(gumble.UserChangeChannel) || e.Type.Has(gumble.UserChangeDisconnected) {
|
||||||
|
l.Bridge.MumbleUsers = make(map[string]bool)
|
||||||
|
for _, user := range l.Bridge.MumbleClient.Self.Channel.Users {
|
||||||
|
//note, this might be too slow for really really big channels?
|
||||||
|
//event listeners block while processing
|
||||||
|
//also probably bad to rebuild the set every user change.
|
||||||
|
if user.Name != l.Bridge.MumbleClient.Self.Name {
|
||||||
|
l.Bridge.MumbleUsers[user.Name] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
l.Bridge.MumbleUsersMutex.Unlock()
|
||||||
|
|
||||||
if e.Type.Has(gumble.UserChangeConnected) {
|
if e.Type.Has(gumble.UserChangeConnected) {
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package bridge
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -12,34 +11,23 @@ import (
|
|||||||
"github.com/stieneee/mumble-discord-bridge/pkg/sleepct"
|
"github.com/stieneee/mumble-discord-bridge/pkg/sleepct"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MumbleDuplex - listener and outgoing
|
var mutex sync.Mutex
|
||||||
type MumbleDuplex struct {
|
var fromMumbleArr []chan gumble.AudioBuffer
|
||||||
mutex sync.Mutex
|
var mumbleStreamingArr []bool
|
||||||
fromMumbleArr []chan gumble.AudioBuffer
|
|
||||||
mumbleStreamingArr []bool
|
|
||||||
mumbleSleepTick sleepct.SleepCT
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewMumbleDuplex() *MumbleDuplex {
|
// MumbleDuplex - listenera and outgoing
|
||||||
return &MumbleDuplex{
|
type MumbleDuplex struct{}
|
||||||
fromMumbleArr: make([]chan gumble.AudioBuffer, 0),
|
|
||||||
mumbleStreamingArr: make([]bool, 0),
|
|
||||||
mumbleSleepTick: sleepct.SleepCT{},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// OnAudioStream - Spawn routines to handle incoming packets
|
// OnAudioStream - Spawn routines to handle incoming packets
|
||||||
func (m *MumbleDuplex) OnAudioStream(e *gumble.AudioStreamEvent) {
|
func (m MumbleDuplex) OnAudioStream(e *gumble.AudioStreamEvent) {
|
||||||
|
|
||||||
// hold a reference ot the channel in the closure
|
// hold a reference ot the channel in the closure
|
||||||
streamChan := make(chan gumble.AudioBuffer, 100)
|
localMumbleArray := make(chan gumble.AudioBuffer, 100)
|
||||||
|
|
||||||
m.mutex.Lock()
|
mutex.Lock()
|
||||||
m.fromMumbleArr = append(m.fromMumbleArr, streamChan)
|
fromMumbleArr = append(fromMumbleArr, localMumbleArray)
|
||||||
m.mumbleStreamingArr = append(m.mumbleStreamingArr, false)
|
mumbleStreamingArr = append(mumbleStreamingArr, false)
|
||||||
m.mutex.Unlock()
|
mutex.Unlock()
|
||||||
|
|
||||||
promMumbleArraySize.Set(float64(len(m.fromMumbleArr)))
|
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
name := e.User.Name
|
name := e.User.Name
|
||||||
@ -49,62 +37,57 @@ func (m *MumbleDuplex) OnAudioStream(e *gumble.AudioStreamEvent) {
|
|||||||
|
|
||||||
// 480 per 10ms
|
// 480 per 10ms
|
||||||
for i := 0; i < len(p.AudioBuffer)/480; i++ {
|
for i := 0; i < len(p.AudioBuffer)/480; i++ {
|
||||||
streamChan <- p.AudioBuffer[480*i : 480*(i+1)]
|
localMumbleArray <- p.AudioBuffer[480*i : 480*(i+1)]
|
||||||
}
|
}
|
||||||
promReceivedMumblePackets.Inc()
|
|
||||||
m.mumbleSleepTick.Notify()
|
|
||||||
}
|
}
|
||||||
log.Println("Mumble audio stream ended", name)
|
log.Println("Mumble audio stream ended", name)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MumbleDuplex) fromMumbleMixer(ctx context.Context, cancel context.CancelFunc, toDiscord chan []int16) {
|
func (m MumbleDuplex) fromMumbleMixer(ctx context.Context, wg *sync.WaitGroup, toDiscord chan []int16) {
|
||||||
m.mumbleSleepTick.Start(10 * time.Millisecond)
|
sleepTick := sleepct.SleepCT{}
|
||||||
|
sleepTick.Start(10 * time.Millisecond)
|
||||||
|
|
||||||
sendAudio := false
|
sendAudio := false
|
||||||
|
bufferWarning := false
|
||||||
|
|
||||||
droppingPackets := false
|
wg.Add(1)
|
||||||
droppingPacketCount := 0
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
log.Println("Stopping From Mumble Mixer")
|
wg.Done()
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
promTimerMumbleMixer.Observe(float64(m.mumbleSleepTick.SleepNextTarget(ctx, false)))
|
sleepTick.SleepNextTarget()
|
||||||
|
|
||||||
m.mutex.Lock()
|
mutex.Lock()
|
||||||
|
|
||||||
sendAudio = false
|
sendAudio = false
|
||||||
internalMixerArr := make([]gumble.AudioBuffer, 0)
|
internalMixerArr := make([]gumble.AudioBuffer, 0)
|
||||||
streamingCount := 0
|
|
||||||
|
|
||||||
// Work through each channel
|
// Work through each channel
|
||||||
for i := 0; i < len(m.fromMumbleArr); i++ {
|
for i := 0; i < len(fromMumbleArr); i++ {
|
||||||
if len(m.fromMumbleArr[i]) > 0 {
|
if len(fromMumbleArr[i]) > 0 {
|
||||||
sendAudio = true
|
sendAudio = true
|
||||||
if !m.mumbleStreamingArr[i] {
|
if !mumbleStreamingArr[i] {
|
||||||
m.mumbleStreamingArr[i] = true
|
mumbleStreamingArr[i] = true
|
||||||
streamingCount++
|
|
||||||
// log.Println("Mumble starting", i)
|
// log.Println("Mumble starting", i)
|
||||||
}
|
}
|
||||||
|
|
||||||
x1 := (<-m.fromMumbleArr[i])
|
x1 := (<-fromMumbleArr[i])
|
||||||
internalMixerArr = append(internalMixerArr, x1)
|
internalMixerArr = append(internalMixerArr, x1)
|
||||||
} else {
|
} else {
|
||||||
if m.mumbleStreamingArr[i] {
|
if mumbleStreamingArr[i] {
|
||||||
m.mumbleStreamingArr[i] = false
|
mumbleStreamingArr[i] = false
|
||||||
// log.Println("Mumble stopping", i)
|
// log.Println("Mumble stopping", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m.mutex.Unlock()
|
mutex.Unlock()
|
||||||
|
|
||||||
promMumbleStreaming.Set(float64(streamingCount))
|
|
||||||
|
|
||||||
if sendAudio {
|
if sendAudio {
|
||||||
|
|
||||||
@ -116,27 +99,22 @@ func (m *MumbleDuplex) fromMumbleMixer(ctx context.Context, cancel context.Cance
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
promToDiscordBufferSize.Set(float64(len(toDiscord)))
|
if len(toDiscord) > 20 {
|
||||||
|
if !bufferWarning {
|
||||||
|
log.Println("Warning: toDiscord buffer size")
|
||||||
|
bufferWarning = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if bufferWarning {
|
||||||
|
log.Println("Resolved: toDiscord buffer size")
|
||||||
|
bufferWarning = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case toDiscord <- outBuf:
|
case toDiscord <- outBuf:
|
||||||
{
|
|
||||||
if droppingPackets {
|
|
||||||
log.Println("Discord buffer ok, total packets dropped " + strconv.Itoa(droppingPacketCount))
|
|
||||||
droppingPackets = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
if !droppingPackets {
|
log.Println("Error: toDiscord buffer full. Dropping packet")
|
||||||
log.Println("Error: toDiscord buffer full. Dropping packets")
|
|
||||||
droppingPackets = true
|
|
||||||
droppingPacketCount = 0
|
|
||||||
}
|
|
||||||
droppingPacketCount++
|
|
||||||
promToDiscordDropped.Inc()
|
|
||||||
if droppingPacketCount > 250 {
|
|
||||||
log.Println("Discord Timeout")
|
|
||||||
cancel()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,141 +0,0 @@
|
|||||||
package bridge
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
|
||||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
// Bridge General
|
|
||||||
|
|
||||||
PromApplicationStartTime = promauto.NewGauge(prometheus.GaugeOpts{
|
|
||||||
Name: "mdb_bridge_start_time",
|
|
||||||
Help: "The time the application started",
|
|
||||||
})
|
|
||||||
|
|
||||||
promBridgeStarts = promauto.NewCounter(prometheus.CounterOpts{
|
|
||||||
Name: "mdb_bridge_starts_count",
|
|
||||||
Help: "The number of times the bridge start routine has been called",
|
|
||||||
})
|
|
||||||
|
|
||||||
promBridgeStartTime = promauto.NewGauge(prometheus.GaugeOpts{
|
|
||||||
Name: "mdb_bridge_starts_time",
|
|
||||||
Help: "The time the current bridge instance started",
|
|
||||||
})
|
|
||||||
|
|
||||||
// MUMBLE
|
|
||||||
promMumblePing = promauto.NewGauge(prometheus.GaugeOpts{
|
|
||||||
Name: "mdb_mumble_ping",
|
|
||||||
Help: "Mumble ping",
|
|
||||||
})
|
|
||||||
|
|
||||||
promMumbleUsers = promauto.NewGauge(prometheus.GaugeOpts{
|
|
||||||
Name: "mdb_mumble_users_gauge",
|
|
||||||
Help: "The number of connected Mumble users",
|
|
||||||
})
|
|
||||||
|
|
||||||
promReceivedMumblePackets = promauto.NewCounter(prometheus.CounterOpts{
|
|
||||||
Name: "mdb_mumble_received_count",
|
|
||||||
Help: "The count of Mumble audio packets received",
|
|
||||||
})
|
|
||||||
|
|
||||||
promSentMumblePackets = promauto.NewCounter(prometheus.CounterOpts{
|
|
||||||
Name: "mdb_mumble_sent_count",
|
|
||||||
Help: "The count of audio packets sent to mumble",
|
|
||||||
})
|
|
||||||
|
|
||||||
// promToMumbleBufferSize = promauto.NewGauge(prometheus.GaugeOpts{
|
|
||||||
// Name: "mdb_to_mumble_buffer_gauge",
|
|
||||||
// Help: "",
|
|
||||||
// })
|
|
||||||
|
|
||||||
promToMumbleDropped = promauto.NewCounter(prometheus.CounterOpts{
|
|
||||||
Name: "mdb_to_mumble_dropped",
|
|
||||||
Help: "The number of packets timeouts to mumble",
|
|
||||||
})
|
|
||||||
|
|
||||||
promMumbleArraySize = promauto.NewGauge(prometheus.GaugeOpts{
|
|
||||||
Name: "mdb_to_mumble_array_size_gauge",
|
|
||||||
Help: "The array size of mumble streams",
|
|
||||||
})
|
|
||||||
|
|
||||||
promMumbleStreaming = promauto.NewGauge(prometheus.GaugeOpts{ //SUMMARY?
|
|
||||||
Name: "mdb_mumble_streaming_gauge",
|
|
||||||
Help: "The number of active audio streams streaming audio from mumble",
|
|
||||||
})
|
|
||||||
|
|
||||||
// DISCORD
|
|
||||||
|
|
||||||
// TODO Discrod Ping
|
|
||||||
|
|
||||||
promDiscordHeartBeat = promauto.NewGauge(prometheus.GaugeOpts{
|
|
||||||
Name: "mdb_discord_latency",
|
|
||||||
Help: "Discord heartbeat latency",
|
|
||||||
})
|
|
||||||
|
|
||||||
promDiscordUsers = promauto.NewGauge(prometheus.GaugeOpts{
|
|
||||||
Name: "mdb_discord_users_gauge",
|
|
||||||
Help: "The number of Connected Discord users",
|
|
||||||
})
|
|
||||||
|
|
||||||
promDiscordReceivedPackets = promauto.NewCounter(prometheus.CounterOpts{
|
|
||||||
Name: "mdb_discord_received_count",
|
|
||||||
Help: "The number of received packets from Discord",
|
|
||||||
})
|
|
||||||
|
|
||||||
promDiscordSentPackets = promauto.NewCounter(prometheus.CounterOpts{
|
|
||||||
Name: "mdb_discord_sent_count",
|
|
||||||
Help: "The number of packets sent to Discord",
|
|
||||||
})
|
|
||||||
|
|
||||||
promToDiscordBufferSize = promauto.NewGauge(prometheus.GaugeOpts{
|
|
||||||
Name: "mdb_discord_buffer_gauge",
|
|
||||||
Help: "The buffer size for packets to Discord",
|
|
||||||
})
|
|
||||||
|
|
||||||
promToDiscordDropped = promauto.NewCounter(prometheus.CounterOpts{
|
|
||||||
Name: "mdb_to_discord_dropped",
|
|
||||||
Help: "The count of packets dropped to discord",
|
|
||||||
})
|
|
||||||
|
|
||||||
promDiscordArraySize = promauto.NewGauge(prometheus.GaugeOpts{
|
|
||||||
Name: "mdb_discord_array_size_gauge",
|
|
||||||
Help: "The discord receiving array size",
|
|
||||||
})
|
|
||||||
|
|
||||||
promDiscordStreaming = promauto.NewGauge(prometheus.GaugeOpts{
|
|
||||||
Name: "mdb_discord_streaming_gauge",
|
|
||||||
Help: "The number of active audio streams streaming from discord",
|
|
||||||
})
|
|
||||||
|
|
||||||
// Sleep Timer Performance
|
|
||||||
|
|
||||||
promTimerDiscordSend = promauto.NewHistogram(prometheus.HistogramOpts{
|
|
||||||
Name: "mdb_timer_discord_send",
|
|
||||||
Help: "Timer performance for Discord send",
|
|
||||||
Buckets: []float64{1000, 2000, 5000, 10000, 20000},
|
|
||||||
})
|
|
||||||
|
|
||||||
promTimerDiscordMixer = promauto.NewHistogram(prometheus.HistogramOpts{
|
|
||||||
Name: "mdb_timer_discord_mixer",
|
|
||||||
Help: "Timer performance for the Discord mixer",
|
|
||||||
Buckets: []float64{1000, 2000, 5000, 10000, 20000},
|
|
||||||
})
|
|
||||||
|
|
||||||
promTimerMumbleMixer = promauto.NewHistogram(prometheus.HistogramOpts{
|
|
||||||
Name: "mdb_timer_mumble_mixer",
|
|
||||||
Help: "Timer performance for the Mumble mixer",
|
|
||||||
Buckets: []float64{1000, 2000, 5000, 10000, 20000},
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
func StartPromServer(port int) {
|
|
||||||
log.Println("Starting Metrics Server")
|
|
||||||
http.Handle("/metrics", promhttp.Handler())
|
|
||||||
http.ListenAndServe(":"+strconv.Itoa(port), nil)
|
|
||||||
}
|
|
@ -1,25 +1,20 @@
|
|||||||
package sleepct
|
package sleepct
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SleepCT - Sleep constant time step crates a sleep based ticker.
|
// SleepCT - Sleep constant time step crates a sleep based ticker
|
||||||
// designed to maintain a consistent sleep/tick interval.
|
// designed maintain a sleep/tick interval
|
||||||
// The sleeper can be paused waiting to be signaled from another go routine.
|
|
||||||
// This allows for the pausing of loops that do not have work to complete
|
|
||||||
type SleepCT struct {
|
type SleepCT struct {
|
||||||
d time.Duration // desired duration between targets
|
sync.Mutex
|
||||||
t time.Time // last time target
|
d time.Duration // duration
|
||||||
resume chan bool
|
t time.Time // last time target
|
||||||
wake time.Time // last wake time
|
|
||||||
drift int64 // last wake drift microseconds
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SleepCT) Start(d time.Duration) {
|
func (s *SleepCT) Start(d time.Duration) {
|
||||||
s.resume = make(chan bool, 2)
|
|
||||||
if s.t.IsZero() {
|
if s.t.IsZero() {
|
||||||
s.d = d
|
s.d = d
|
||||||
s.t = time.Now()
|
s.t = time.Now()
|
||||||
@ -28,65 +23,28 @@ func (s *SleepCT) Start(d time.Duration) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sleep to the next target duration.
|
func (s *SleepCT) SleepNextTarget() {
|
||||||
// If pause it set to true will sleep the duration and wait to be notified.
|
s.Lock()
|
||||||
// The notification channel will be cleared when the thread wakes.
|
|
||||||
// SleepNextTarget should not be call more than once concurrently.
|
|
||||||
func (s *SleepCT) SleepNextTarget(ctx context.Context, pause bool) int64 {
|
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
// if target is zero safety net
|
var last time.Time
|
||||||
if s.t.IsZero() {
|
if s.t.IsZero() {
|
||||||
fmt.Println("SleepCT reset")
|
fmt.Println("SleepCT reset")
|
||||||
s.t = now.Add(-s.d)
|
last = now.Add(-s.d)
|
||||||
|
} else {
|
||||||
|
last = s.t
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sleep to Next Target
|
// Next Target
|
||||||
s.t = s.t.Add(s.d)
|
s.t = last.Add(s.d)
|
||||||
|
|
||||||
// Compute the desired sleep time to reach the target
|
d := s.t.Sub(now)
|
||||||
d := time.Until(s.t)
|
|
||||||
|
|
||||||
// Sleep
|
|
||||||
time.Sleep(d)
|
time.Sleep(d)
|
||||||
|
|
||||||
// record the wake time
|
// delta := now.Sub(s.t)
|
||||||
s.wake = time.Now()
|
// fmt.Println("delta", delta, d, time.Since(s.t))
|
||||||
s.drift = s.wake.Sub(s.t).Microseconds()
|
|
||||||
|
|
||||||
// fmt.Println(s.t.UnixMilli(), d.Milliseconds(), wake.UnixMilli(), drift, pause, len(s.resume))
|
s.Unlock()
|
||||||
|
|
||||||
// external pause control
|
|
||||||
if pause {
|
|
||||||
// don't pause if the notification channel has something
|
|
||||||
if len(s.resume) == 0 {
|
|
||||||
// fmt.Println("pause")
|
|
||||||
select {
|
|
||||||
case <-s.resume:
|
|
||||||
case <-ctx.Done():
|
|
||||||
// fmt.Println("sleepct ctx exit")
|
|
||||||
}
|
|
||||||
// if we did pause set the last sleep target to now
|
|
||||||
s.t = time.Now()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drain the resume channel
|
|
||||||
select {
|
|
||||||
case <-s.resume:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
|
|
||||||
// return the drift for monitoring purposes
|
|
||||||
return s.drift
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notify attempts to resume a paused sleeper.
|
|
||||||
// It is safe to call notify from other processes and as often as desired.
|
|
||||||
func (s *SleepCT) Notify() {
|
|
||||||
select {
|
|
||||||
case s.resume <- true:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
@ -19,7 +18,7 @@ const maxSleepInterval time.Duration = 15 * time.Millisecond
|
|||||||
const tickerInterval time.Duration = 10 * time.Millisecond
|
const tickerInterval time.Duration = 10 * time.Millisecond
|
||||||
const testDuration time.Duration = time.Duration(testCount * 10 * int64(time.Millisecond))
|
const testDuration time.Duration = time.Duration(testCount * 10 * int64(time.Millisecond))
|
||||||
|
|
||||||
func testTickerBaseCase(wg *sync.WaitGroup, test *testing.T) {
|
func testTickerBaseCase(wg *sync.WaitGroup) {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(interval time.Duration) {
|
go func(interval time.Duration) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
@ -40,7 +39,7 @@ func testTickerBaseCase(wg *sync.WaitGroup, test *testing.T) {
|
|||||||
func TestTickerBaseCase(t *testing.T) {
|
func TestTickerBaseCase(t *testing.T) {
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
|
|
||||||
testTickerBaseCase(&wg, t)
|
testTickerBaseCase(&wg)
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
@ -116,7 +115,7 @@ func testSleepCT(wg *sync.WaitGroup) {
|
|||||||
if i+1 < testCount {
|
if i+1 < testCount {
|
||||||
time.Sleep(time.Duration(float64(maxSleepInterval) * rand.Float64()))
|
time.Sleep(time.Duration(float64(maxSleepInterval) * rand.Float64()))
|
||||||
}
|
}
|
||||||
s.SleepNextTarget(context.TODO(), false)
|
s.SleepNextTarget()
|
||||||
}
|
}
|
||||||
fmt.Println("SleepCT (loaded) after", testDuration, "drifts", time.Since(start)-testDuration)
|
fmt.Println("SleepCT (loaded) after", testDuration, "drifts", time.Since(start)-testDuration)
|
||||||
wg.Done()
|
wg.Done()
|
||||||
@ -131,35 +130,6 @@ func TestSleepCT(t *testing.T) {
|
|||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSleepCTPause(wg *sync.WaitGroup) {
|
|
||||||
wg.Add(1)
|
|
||||||
go func(interval time.Duration) {
|
|
||||||
now := time.Now()
|
|
||||||
start := now
|
|
||||||
// start the ticker
|
|
||||||
s := sleepct.SleepCT{}
|
|
||||||
s.Start(interval)
|
|
||||||
var i int64
|
|
||||||
for i = 0; i < testCount; i++ {
|
|
||||||
if i+1 < testCount {
|
|
||||||
time.Sleep(time.Duration(float64(maxSleepInterval) * rand.Float64()))
|
|
||||||
}
|
|
||||||
s.Notify()
|
|
||||||
s.SleepNextTarget(context.TODO(), true)
|
|
||||||
}
|
|
||||||
fmt.Println("SleepCT Pause (loaded) after", testDuration, "drifts", time.Since(start)-testDuration)
|
|
||||||
wg.Done()
|
|
||||||
}(tickerInterval)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestSleepCTPause(t *testing.T) {
|
|
||||||
wg := sync.WaitGroup{}
|
|
||||||
|
|
||||||
testSleepCTPause(&wg)
|
|
||||||
|
|
||||||
wg.Wait()
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestIdleJitter(t *testing.T) {
|
func TestIdleJitter(t *testing.T) {
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user