12#ifndef OPENVPN_COMMON_HOSTLIST_H
13#define OPENVPN_COMMON_HOSTLIST_H
33 Host(
const std::string &host_arg,
const std::string &port_arg)
58 std::ostringstream
os;
70class List :
public std::vector<Host>
78 const std::string &directive,
79 const std::string &default_port)
95 std::shuffle(begin(), end(), rng());
100 std::ostringstream
os;
101 for (
auto &h : *
this)
102 os << h.to_string() <<
'\n';
108 const std::string &
port)
110 const std::string title =
"host list";
130 template <
typename HOST>
135 if (++
index >= list.size())
bool next(const List &list, HOST &host)
void add(const std::string &host, const std::string &port)
std::string to_string() const
List(const OptionList &opt, const std::string &directive, const std::string &default_port)
void randomize(RandomAPI &rng)
const IndexList * get_index_ptr(const std::string &name) const
std::string get_default(const size_t index, const size_t max_len, const std::string &default_value) const
void touch(bool lightly=false) const
const std::string & get(const size_t index, const size_t max_len) const
Abstract base class for random number generators.
void validate_host(const std::string &host, const std::string &title)
void validate_port(const std::string &port, const std::string &title, unsigned int *value=nullptr)
Implementation of the base classes for random number generators.
Host(const std::string &host_arg, const std::string &port_arg)
std::string to_string() const
void swap(Host &rhs) noexcept