diff --git a/Config.go b/Config.go index 86d1ee0..0cdb1fb 100644 --- a/Config.go +++ b/Config.go @@ -17,7 +17,7 @@ type Config struct { Hub struct { Address string `json:"address"` - Port int `json:"port"` + Port int `json:"port,omitempty"` Tag string `json:"tag"` } } diff --git a/main.go b/main.go index ef228b5..87f7eb3 100644 --- a/main.go +++ b/main.go @@ -48,8 +48,13 @@ func (this *App) HubWorker(Nick, Pass string, so socketio.Socket, done chan stru selfUser.ClientTag = this.cfg.Hub.Tag selfUser.ClientVersion = libnmdc.DEFAULT_CLIENT_VERSION + url := this.cfg.Hub.Address + if this.cfg.Hub.Port == 0 { + url = fmt.Sprintf("%s:%d", this.cfg.Hub.Address, this.cfg.Hub.Port) + } + hco := libnmdc.HubConnectionOptions{ - Address: libnmdc.HubAddress(fmt.Sprintf("%s:%d", this.cfg.Hub.Address, this.cfg.Hub.Port)), + Address: libnmdc.HubAddress(url), Self: selfUser, NickPassword: Pass, }