go-tsviewer/service/server.go

29 lines
834 B
Go

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
}