Rename DefaultSrv* to DefaultServer*
@DerZombiiie please test this version. Feel free to upgrade to the latest proxy version in the chatcommand repo.master
parent
66498fe02b
commit
df1eecbee5
22
config.go
22
config.go
|
@ -162,10 +162,10 @@ func RmServer(name string) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultSrvInfo returns both the name of the default server
|
// DefaultServerInfo returns both the name of the default server
|
||||||
// and information about it. The return values are uninitialized
|
// and information about it. The return values are uninitialized
|
||||||
// if no servers exist.
|
// if no servers exist.
|
||||||
func (cnf Config) DefaultSrvInfo() (string, Server) {
|
func (cnf Config) DefaultServerInfo() (string, Server) {
|
||||||
for name, srv := range Conf().Servers {
|
for name, srv := range Conf().Servers {
|
||||||
return name, srv
|
return name, srv
|
||||||
}
|
}
|
||||||
|
@ -174,19 +174,19 @@ func (cnf Config) DefaultSrvInfo() (string, Server) {
|
||||||
return "", Server{}
|
return "", Server{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultSrvName returns the name of the default server.
|
// DefaultServerName returns the name of the default server.
|
||||||
// If no servers exist it returns an empty string.
|
// If no servers exist it returns an empty string.
|
||||||
func (cnf Config) DefaultSrvName() string {
|
func (cnf Config) DefaultServerName() string {
|
||||||
name, _ := cnf.DefaultSrvInfo()
|
name, _ := cnf.DefaultServerInfo()
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultSrv returns information about the default server.
|
// DefaultServer returns information about the default server.
|
||||||
// If no servers exist the returned struct will be uninitialized.
|
// If no servers exist the returned struct will be uninitialized.
|
||||||
// This is a faster shortcut for Config.Servers[Config.DefaultSrvName].
|
// This is a faster shortcut for Config.Servers[Config.DefaultServerName()].
|
||||||
// You should thus only use this method or the DefaultSrvInfo method.
|
// You should thus only use this method or the DefaultServerInfo method.
|
||||||
func (cnf Config) DefaultSrv() Server {
|
func (cnf Config) DefaultServer() Server {
|
||||||
_, srv := cnf.DefaultSrvInfo()
|
_, srv := cnf.DefaultServerInfo()
|
||||||
return srv
|
return srv
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ func FallbackServers(server string) []string {
|
||||||
return fallbacks
|
return fallbacks
|
||||||
}
|
}
|
||||||
|
|
||||||
return append(fallbacks, conf.DefaultSrvName())
|
return append(fallbacks, conf.DefaultServerName())
|
||||||
} else {
|
} else {
|
||||||
return append(fallbacks, conf.FallbackServers...)
|
return append(fallbacks, conf.FallbackServers...)
|
||||||
}
|
}
|
||||||
|
|
2
run.go
2
run.go
|
@ -107,7 +107,7 @@ func runFunc() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
srvName, srv := conf.DefaultSrvInfo()
|
srvName, srv := conf.DefaultServerInfo()
|
||||||
lastSrv, err := authIface.LastSrv(cc.Name())
|
lastSrv, err := authIface.LastSrv(cc.Name())
|
||||||
if err == nil && !Conf().ForceDefaultSrv && lastSrv != srvName {
|
if err == nil && !Conf().ForceDefaultSrv && lastSrv != srvName {
|
||||||
for name, s := range conf.Servers {
|
for name, s := range conf.Servers {
|
||||||
|
|
Loading…
Reference in New Issue