libnmdc: fix panic() on connection failure, owing to storing nil in an interface
This commit is contained in:
parent
27ad91bc71
commit
108b04acab
9
main.go
9
main.go
@ -15,6 +15,7 @@ var BaseDir string = "."
|
|||||||
var PMResponse string = ""
|
var PMResponse string = ""
|
||||||
var LogConnectionState bool
|
var LogConnectionState bool
|
||||||
var DebugMode bool
|
var DebugMode bool
|
||||||
|
var VerifyTLS bool
|
||||||
var CharacterMatcher *regexp.Regexp
|
var CharacterMatcher *regexp.Regexp
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -53,9 +54,10 @@ func LogMessage(hub, message string) {
|
|||||||
func HubWorker(addr, nick, password string) {
|
func HubWorker(addr, nick, password string) {
|
||||||
|
|
||||||
opts := libnmdc.HubConnectionOptions{
|
opts := libnmdc.HubConnectionOptions{
|
||||||
Address: libnmdc.HubAddress(addr),
|
Address: libnmdc.HubAddress(addr),
|
||||||
Self: libnmdc.UserInfo{Nick: nick},
|
SkipVerifyTLS: !VerifyTLS,
|
||||||
NickPassword: password,
|
Self: libnmdc.UserInfo{Nick: nick},
|
||||||
|
NickPassword: password,
|
||||||
}
|
}
|
||||||
hub := opts.Connect()
|
hub := opts.Connect()
|
||||||
|
|
||||||
@ -104,6 +106,7 @@ func main() {
|
|||||||
flag.BoolVar(&LogConnectionState, "LogConnectionState", true, "Include connection state changes in log")
|
flag.BoolVar(&LogConnectionState, "LogConnectionState", true, "Include connection state changes in log")
|
||||||
flag.StringVar(&PMResponse, "PMResponse", "This is an automated service. For enquiries, please contact an administrator.", "Message to respond with on PM")
|
flag.StringVar(&PMResponse, "PMResponse", "This is an automated service. For enquiries, please contact an administrator.", "Message to respond with on PM")
|
||||||
flag.BoolVar(&DebugMode, "Debug", false, "Print additional information on stdout")
|
flag.BoolVar(&DebugMode, "Debug", false, "Print additional information on stdout")
|
||||||
|
flag.BoolVar(&VerifyTLS, "VerifyTLS", true, "Verify TLS certificates")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
// Assert dir exists
|
// Assert dir exists
|
||||||
|
Loading…
Reference in New Issue
Block a user