Пример #1
0
// ServerConfig returns a ZoneConfig with address information derived from s.
func ServerConfig(s *room.Server) (*ZoneConfig, error) {
	zc := NewZoneConfig(s.Room())
	err := zc.initAddr(s.Addr())
	if err != nil {
		return nil, err
	}
	return zc, nil
}
Пример #2
0
// RunDiscovery runs the discover server
func RunDiscovery(ctx context.Context, server *room.Server) {
	log.Printf("[INFO] Server running at %s", server.Addr())

	disco, err := roomdisco.NewDiscoverableServer(server)
	if err != nil {
		log.Printf("[FATAL] Discovery failed to start: %v", err)
		return
	}
	defer disco.Close()

	log.Printf("[INFO] Discovery server is running")
	<-ctx.Done()
}