add insecure server support

- add mumble-insecure parameter to readme
- fix readme.md minor command line error
This commit is contained in:
Hoshikawa Erina 2020-11-28 00:46:21 -08:00
parent ce98bbf971
commit 4ee627b786
2 changed files with 13 additions and 3 deletions

View File

@ -26,6 +26,8 @@ Usage of mumble-discord-bridge:
MUMBLE_PORT mumble port (default 64738)
-mumble-username string
MUMBLE_USERNAME, mumble username (default "discord-bridge")
-mumble-insecure bool
MUMBLE_INSECURE, allow connection to insecure (invalid TLS cert) mumble server
```
## Setup
@ -84,7 +86,7 @@ A simple go build command is all that is needed.
Ensure the opus library is installed.
```bash
go build *.go -o mumble-discord-bridge
go build -o mumble-discord-bridge *.go
```
## Known Issues

12
main.go
View File

@ -1,9 +1,11 @@
package main
import (
"crypto/tls"
"flag"
"fmt"
"log"
"net"
"os"
"os/signal"
"strconv"
@ -60,7 +62,7 @@ func main() {
mumblePort := flag.Int("mumble-port", lookupEnvOrInt("MUMBLE_PORT", 64738), "MUMBLE_PORT mumble port")
mumbleUsername := flag.String("mumble-username", lookupEnvOrString("MUMBLE_USERNAME", "discord-bridge"), "MUMBLE_USERNAME, mumble username")
mumblePassword := flag.String("mumble-password", lookupEnvOrString("MUMBLE_PASSWORD", ""), "MUMBLE_PASSWORD, mumble password, optional")
// mumbleInsecure := flag.Bool("mumble-insecure", lookupEnvOrBool("MUMBLE_INSECURE", false), "mumble insecure, env alt MUMBLE_INSECURE")
mumbleInsecure := flag.Bool("mumble-insecure", lookupEnvOrBool("MUMBLE_INSECURE", false), "mumble insecure, env alt MUMBLE_INSECURE")
discordToken := flag.String("discord-token", lookupEnvOrString("DISCORD_TOKEN", ""), "DISCORD_TOKEN, discord bot token")
discordGID := flag.String("discord-gid", lookupEnvOrString("DISCORD_GID", ""), "DISCORD_GID, discord gid")
@ -124,7 +126,13 @@ func main() {
m := MumbleDuplex{}
mumble, err := gumble.Dial(*mumbleAddr+":"+strconv.Itoa(*mumblePort), config)
var tlsConfig tls.Config
if *mumbleInsecure {
tlsConfig.InsecureSkipVerify = true
}
mumble, err := gumble.DialWithDialer(new(net.Dialer),*mumbleAddr+":"+strconv.Itoa(*mumblePort),config, &tlsConfig)
if err != nil {
log.Println(err)
return