go-tsviewer/service/server.go

30 lines
832 B
Go
Raw Normal View History

2019-01-16 21:01:48 +00:00
package service
import (
"time"
2019-01-17 00:35:51 +00:00
"git.cliffbreak.de/Cliffbreak/tsviewer/features/server"
2019-01-16 21:01:48 +00:00
)
func (s Service) Info() (*server.Server, error) {
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
}