<commit_before>#include "custom_static_cluster.h"

namespace Envoy {

// ClusterImplBase
void CustomStaticCluster::startPreInit() {
  printf("startPreInit");
  Upstream::HostSharedPtr host = makeHost();
  Upstream::HostVector hosts{host};
  auto hosts_ptr = std::make_shared<Upstream::HostVector>(hosts);

  this->priority_set_.updateHosts(
      priority_,
      Upstream::HostSetImpl::partitionHosts(hosts_ptr, Upstream::HostsPerLocalityImpl::empty()), {},
      hosts, {}, absl::nullopt);

  onPreInitComplete();
}

inline Upstream::HostSharedPtr CustomStaticCluster::makeHost() {
  Network::Address::InstanceConstSharedPtr address =
      Network::Utility::parseInternetAddress(address_, port_, false);
  return Upstream::HostSharedPtr{new Upstream::HostImpl(
      this->info(), "", address, this->info()->metadata(), 1,
      envoy::api::v2::core::Locality::default_instance(),
      envoy::api::v2::endpoint::Endpoint::HealthCheckConfig::default_instance(), priority_,
      envoy::api::v2::core::HealthStatus::UNKNOWN)};
}

REGISTER_FACTORY(CustomStaticClusterFactory, Upstream::ClusterFactory);

} // namespace Envoy<commit_msg>test: use ipv6_only IPv6 addresses in custom cluster integration tests. (#6260)<commit_after>#include "custom_static_cluster.h"

namespace Envoy {

// ClusterImplBase
void CustomStaticCluster::startPreInit() {
  printf("startPreInit");
  Upstream::HostSharedPtr host = makeHost();
  Upstream::HostVector hosts{host};
  auto hosts_ptr = std::make_shared<Upstream::HostVector>(hosts);

  this->priority_set_.updateHosts(
      priority_,
      Upstream::HostSetImpl::partitionHosts(hosts_ptr, Upstream::HostsPerLocalityImpl::empty()), {},
      hosts, {}, absl::nullopt);

  onPreInitComplete();
}

inline Upstream::HostSharedPtr CustomStaticCluster::makeHost() {
  Network::Address::InstanceConstSharedPtr address =
      Network::Utility::parseInternetAddress(address_, port_, true);
  return Upstream::HostSharedPtr{new Upstream::HostImpl(
      this->info(), "", address, this->info()->metadata(), 1,
      envoy::api::v2::core::Locality::default_instance(),
      envoy::api::v2::endpoint::Endpoint::HealthCheckConfig::default_instance(), priority_,
      envoy::api::v2::core::HealthStatus::UNKNOWN)};
}

REGISTER_FACTORY(CustomStaticClusterFactory, Upstream::ClusterFactory);

} // namespace Envoy
{'fraction_non_alphanumeric': 0.15006412997007268, 'fraction_numerical': 0.005985463873450192, 'mean_word_length': 7.013698630136986, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '670485', 'n_tokens_mistral': 699, 'n_tokens_neox': 683, 'n_words': 101}