forked from layeh/barnard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
51 lines (43 loc) · 1.24 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"crypto/tls"
"flag"
"fmt"
"os"
"layeh.com/barnard/uiterm"
"layeh.com/gumble/gumble"
_ "layeh.com/gumble/opus"
)
func main() {
// Command line flags
server := flag.String("server", "localhost:64738", "the server to connect to")
username := flag.String("username", "", "the username of the client")
password := flag.String("password", "", "the password of the server")
insecure := flag.Bool("insecure", false, "skip server certificate verification")
certificate := flag.String("certificate", "", "PEM encoded certificate and private key")
channel := flag.String("channel", "", "the channel to join")
starttx := flag.Bool("tx", false, "start transmitting immediately")
flag.Parse()
// Initialize
b := Barnard{
Config: gumble.NewConfig(),
Address: *server,
StartTX: *starttx,
StartupChannel: *channel,
}
b.Config.Username = *username
b.Config.Password = *password
if *insecure {
b.TLSConfig.InsecureSkipVerify = true
}
if *certificate != "" {
cert, err := tls.LoadX509KeyPair(*certificate, *certificate)
if err != nil {
fmt.Fprintf(os.Stderr, "%s\n", err)
os.Exit(1)
}
b.TLSConfig.Certificates = append(b.TLSConfig.Certificates, cert)
}
b.Ui = uiterm.New(&b)
b.Ui.Run()
}