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"
|
"crypto/tls"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
@@ -12,9 +13,11 @@ import (
|
|||||||
_ "layeh.com/gumble/opus"
|
_ "layeh.com/gumble/opus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const defaultPort = "64738"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Command line flags
|
// 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")
|
username := flag.String("username", "", "the username of the client")
|
||||||
password := flag.String("password", "", "the password of the server (use MUMBLE_PASSWORD env var instead)")
|
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")
|
passwordPrompt := flag.Bool("password-prompt", false, "prompt for server password on stdin")
|
||||||
@@ -39,10 +42,16 @@ func main() {
|
|||||||
pass = string(raw)
|
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
|
// Initialize
|
||||||
b := Barnard{
|
b := Barnard{
|
||||||
Config: gumble.NewConfig(),
|
Config: gumble.NewConfig(),
|
||||||
Address: *server,
|
Address: addr,
|
||||||
}
|
}
|
||||||
|
|
||||||
b.Config.Username = *username
|
b.Config.Username = *username
|
||||||
|
|||||||
Reference in New Issue
Block a user