go-tsviewer/service/server.go

30 lines
834 B
Go
Raw Permalink Normal View History

2019-01-16 21:01:48 +00:00
package service
import (
"time"
"git.cliffbreak.de/haveachin/go-tsviewer/features/server"
)
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
}