meowlib/server.go
2022-01-15 22:19:29 +01:00

31 lines
753 B
Go

package meowlib
import "time"
type InternalServer struct {
ServerData Server `json:"server_data,omitempty"`
Presence bool `json:"presence,omitempty"`
LastCheck time.Time `json:"last_check,omitempty"`
Uptime time.Duration `json:"uptime,omitempty"`
Login string `json:"login,omitempty"`
Password string `json:"password,omitempty"`
Me KeyPair `json:"me,omitempty"`
}
type ServerList struct {
Name string
Servers []InternalServer
}
func ServerFromUrl(url string) *InternalServer {
var is InternalServer
is.ServerData.Url = url
return &is
}
func (sl *ServerList) AddUrls(urls []string) {
for _, url := range urls {
sl.Servers = append(sl.Servers, *ServerFromUrl(url))
}
}