tsviewer/service/server.go

30 lines
842 B
Go
Raw Normal View History

2019-01-16 21:01:48 +00:00
package service
import (
"time"
2019-01-21 17:53:33 +00:00
"git.cliffbreak.de/Cliffbreak/tsviewer/features/api/server"
2019-01-16 21:01:48 +00:00
)
2019-01-21 17:53:33 +00:00
func (s Service) ServerInfo() (*server.Server, error) {
2019-01-16 21:01:48 +00:00
serverInfo, err := s.TSClient.Server.Info()
if err != nil {
return nil, err
}
return &server.Server{
Name: serverInfo.Name,
Status: serverInfo.Status,
Version: serverInfo.Version,
WelcomeMessage: serverInfo.WelcomeMessage,
MaxClients: serverInfo.MaxClients,
ClientsOnline: serverInfo.ClientsOnline,
ReservedSlots: serverInfo.ReservedSlots,
Uptime: time.Duration(serverInfo.Uptime) * time.Nanosecond,
TotalPing: serverInfo.TotalPing,
MinAndroidVersion: serverInfo.MinAndroidVersion,
MinClientVersion: serverInfo.MinClientVersion,
MiniOSVersion: serverInfo.MiniOSVersion,
}, nil
}