You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.0 KiB

package server
import (
"time"
"juegoland/games2/internal/domain/catalog"
)
type CatalogReader interface {
Published() []catalog.Game
}
type Service struct {
catalog CatalogReader
now func() time.Time
}
type Features struct {
Catalog bool `json:"catalog"`
Rooms bool `json:"rooms"`
Chat bool `json:"chat"`
}
type Bootstrap struct {
ServerTime time.Time `json:"serverTime"`
PlatformProtocolVersions []int `json:"platformProtocolVersions"`
GameProtocolVersions []int `json:"gameProtocolVersions"`
Features Features `json:"features"`
}
func NewService(reader CatalogReader, now func() time.Time) *Service {
return &Service{catalog: reader, now: now}
}
func (s *Service) Bootstrap() Bootstrap {
return Bootstrap{
ServerTime: s.now().UTC(),
PlatformProtocolVersions: []int{},
GameProtocolVersions: []int{},
Features: Features{
Catalog: true,
Rooms: false,
Chat: false,
},
}
}
func (s *Service) PublishedGames() []catalog.Game {
return s.catalog.Published()
}

Powered by TurnKey Linux.