libs5-go/node/services.go

33 lines
664 B
Go
Raw Normal View History

2024-01-07 09:15:28 +00:00
package node
import "git.lumeweb.com/LumeWeb/libs5-go/interfaces"
var (
_ interfaces.Services = (*ServicesImpl)(nil)
)
type ServicesImpl struct {
2024-01-10 11:21:03 +00:00
p2p interfaces.P2PService
registry interfaces.RegistryService
}
func (s *ServicesImpl) All() []interfaces.Service {
services := make([]interfaces.Service, 0)
services = append(services, s.p2p)
services = append(services, s.registry)
return services
}
2024-01-10 11:21:03 +00:00
func (s *ServicesImpl) Registry() interfaces.RegistryService {
return s.registry
2024-01-07 09:15:28 +00:00
}
func NewServices(p2p interfaces.P2PService) *ServicesImpl {
return &ServicesImpl{p2p: p2p}
}
func (s *ServicesImpl) P2P() interfaces.P2PService {
return s.p2p
}