func (s *PresenceService) GetReverseTunnels() ([]services.ReverseTunnel, error) {
	keys, err := s.backend.GetKeys([]string{reverseTunnelsPrefix})
	if err != nil {
		return nil, trace.Wrap(err)
	}
	tunnels := make([]services.ReverseTunnel, len(keys))
	for i, key := range keys {
		data, err := s.backend.GetVal([]string{reverseTunnelsPrefix}, key)
		if err != nil {
			return nil, trace.Wrap(err)
		}
		if err := json.Unmarshal(data, &tunnels[i]); err != nil {
			return nil, trace.Wrap(err)
		}
	}
	// sorting helps with tests and makes it all deterministic
	sort.Sort(sortedReverseTunnels(tunnels))
	return tunnels, nil
}
// GetReverseTunnels returns a list of registered servers
GetReverseTunnels returns a list of registered servers
// GetReverseTunnels returns a list of registered servers
func (s *PresenceService) GetReverseTunnels() ([]services.ReverseTunnel, error) {
	keys, err := s.backend.GetKeys([]string{reverseTunnelsPrefix})
	if err != nil {
		return nil, trace.Wrap(err)
	}
	tunnels := make([]services.ReverseTunnel, len(keys))
	for i, key := range keys {
		data, err := s.backend.GetVal([]string{reverseTunnelsPrefix}, key)
		if err != nil {
			return nil, trace.Wrap(err)
		}
		if err := json.Unmarshal(data, &tunnels[i]); err != nil {
			return nil, trace.Wrap(err)
		}
	}
	sort.Sort(sortedReverseTunnels(tunnels))
	return tunnels, nil
}
func ( s * PresenceService ) GetReverseTunnels ( ) ( [ ] services . ReverseTunnel , error ) { keys , err := s . backend . GetKeys ( [ ] string { reverseTunnelsPrefix } ) if err != nil { return nil , trace . Wrap ( err ) } tunnels := make ( [ ] services . ReverseTunnel , len ( keys ) ) for i , key := range keys { data , err := s . backend . GetVal ( [ ] string { reverseTunnelsPrefix } , key ) if err != nil { return nil , trace . Wrap ( err ) } if err := json . Unmarshal ( data , & tunnels [ i ] ) ; err != nil { return nil , trace . Wrap ( err ) } } sort . Sort ( sortedReverseTunnels ( tunnels ) ) return tunnels , nil }
GetReverseTunnels returns a list of registered servers
GetReverseTunnels returns a list of registered servers
// sorting helps with tests and makes it all deterministic