default to standard mumble port when not specified

This commit is contained in:
Username
2026-02-24 09:16:19 +01:00
parent 9e1b398ff0
commit bbd809c73f

13
main.go
View File

@@ -4,6 +4,7 @@ import (
"crypto/tls"
"flag"
"fmt"
"net"
"os"
"golang.org/x/term"
@@ -12,9 +13,11 @@ import (
_ "layeh.com/gumble/opus"
)
const defaultPort = "64738"
func main() {
// Command line flags
server := flag.String("server", "localhost:64738", "the server to connect to")
server := flag.String("server", "localhost", "the server to connect to (host or host:port)")
username := flag.String("username", "", "the username of the client")
password := flag.String("password", "", "the password of the server (use MUMBLE_PASSWORD env var instead)")
passwordPrompt := flag.Bool("password-prompt", false, "prompt for server password on stdin")
@@ -39,10 +42,16 @@ func main() {
pass = string(raw)
}
// Default to standard Mumble port if not specified
addr := *server
if _, _, err := net.SplitHostPort(addr); err != nil {
addr = net.JoinHostPort(addr, defaultPort)
}
// Initialize
b := Barnard{
Config: gumble.NewConfig(),
Address: *server,
Address: addr,
}
b.Config.Username = *username