Fix #104: add alternate hostname to server connection config

This commit is contained in:
Drew Weymouth
2023-04-18 17:21:02 -07:00
parent 5782c97752
commit ec3cb0c36d
6 changed files with 90 additions and 32 deletions
+15 -12
View File
@@ -7,13 +7,18 @@ import (
"github.com/pelletier/go-toml"
)
type ServerConnection struct {
Hostname string
AltHostname string
Username string
LegacyAuth bool
}
type ServerConfig struct {
ID uuid.UUID
Nickname string
Hostname string
Username string
LegacyAuth bool
Default bool
ServerConnection
ID uuid.UUID
Nickname string
Default bool
}
type AppConfig struct {
@@ -172,13 +177,11 @@ func (c *Config) SetDefaultServer(serverID uuid.UUID) {
}
}
func (c *Config) AddServer(nickname, hostname, username string, legacyAuth bool) *ServerConfig {
func (c *Config) AddServer(nickname string, connection ServerConnection) *ServerConfig {
s := &ServerConfig{
ID: uuid.New(),
Nickname: nickname,
Hostname: hostname,
Username: username,
LegacyAuth: legacyAuth,
ID: uuid.New(),
Nickname: nickname,
ServerConnection: connection,
}
c.Servers = append(c.Servers, s)
return s