default to standard mumble port when not specified
This commit is contained in:
13
main.go
13
main.go
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user