<commit_before>package awsping

import (
	"fmt"
	"net"
	"net/http"
	"sort"
	"sync"
	"time"
)

// AWSRegion description of the AWS EC2 region
type AWSRegion struct {
	Name      string
	Code      string
	Service   string
	Latencies []time.Duration
	Error     error
}

// AWSTarget describes aws region network details (host, ip)
type AWSTarget struct {
	Hostname string
	IPAddr   *net.IPAddr
}

// CheckLatencyHTTP Test Latency via HTTP
func (r *AWSRegion) CheckLatencyHTTP(wg *sync.WaitGroup, https bool) {
	defer wg.Done()
	url := fmt.Sprintf("http://%s/ping?x=%s", r.GetTarget().Hostname, mkRandoString(13))

	client := &http.Client{}

	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		r.Error = err
	}
	req.Header.Set("User-Agent", useragent)

	start := time.Now()
	resp, err := client.Do(req)
	r.Latencies = append(r.Latencies, time.Since(start))
	defer resp.Body.Close()

	r.Error = err
}

func (r *AWSRegion) GetTarget() AWSTarget {

	hostname := fmt.Sprintf("%s.%s.amazonaws.com", r.Service, r.Code)
	ipAddr, _ := net.ResolveIPAddr("ip4", hostname)

	return AWSTarget{
		Hostname: hostname,
		IPAddr:   ipAddr,<commit_msg>Make https works again; save error from resolve<commit_after>package awsping

import (
	"fmt"
	"net"
	"net/http"
	"sort"
	"sync"
	"time"
)

// AWSRegion description of the AWS EC2 region
type AWSRegion struct {
	Name      string
	Code      string
	Service   string
	Latencies []time.Duration
	Error     error
}

// AWSTarget describes aws region network details (host, ip)
type AWSTarget struct {
	Hostname string
	IPAddr   *net.IPAddr
}

// CheckLatencyHTTP Test Latency via HTTP
func (r *AWSRegion) CheckLatencyHTTP(wg *sync.WaitGroup, https bool) {
	defer wg.Done()
	proto := "http"
	if https {
		proto = "https"
	}
	url := fmt.Sprintf("%s://%s/ping?x=%s", proto, r.GetTarget().Hostname, mkRandoString(13))

	client := &http.Client{}

	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		r.Error = err
	}
	req.Header.Set("User-Agent", useragent)

	start := time.Now()
	resp, err := client.Do(req)
	r.Latencies = append(r.Latencies, time.Since(start))
	defer resp.Body.Close()

	r.Error = err
}

func (r *AWSRegion) GetTarget() AWSTarget {

	hostname := fmt.Sprintf("%s.%s.amazonaws.com", r.Service, r.Code)
	ipAddr, err := net.ResolveIPAddr("ip4", hostname)
	if err != nil {
		r.Error = err
	}

	return AWSTarget{
		Hostname: hostname,
		IPAddr:   ipAddr,
{'fraction_non_alphanumeric': 0.1433899709904683, 'fraction_numerical': 0.003315375051802735, 'mean_word_length': 3.7707509881422925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2899904', 'n_tokens_mistral': 918, 'n_tokens_neox': 891, 'n_words': 231}