<commit_before>// package cf provides a utility for interacting with CloudFlare
package cf

import (
	"crypto/tls"
	"fmt"
	"net/http"
	"time"

	"github.com/getlantern/cloudflare"
	"github.com/getlantern/golog"
)

var (
	log = golog.LoggerFor("cf")
)

type Util struct {
	Client *cloudflare.Client
	domain string
}

func New(domain string, username string, apiKey string) (*Util, error) {
	client, err := cloudflare.NewClient(username, apiKey)
	if err != nil {
		return nil, fmt.Errorf("Unable to initialize client: %v", err)
	}
	// Set a longish timeout on the HTTP client just in case
	client.Http.Timeout = 5 * time.Minute
	client.Http.Transport = &http.Transport{
		TLSClientConfig: &tls.Config{
			ClientSessionCache: tls.NewLRUClientSessionCache(1000),
		},
		DisableKeepAlives: true,
	}
	return &Util{client, domain}, nil
}
<commit_msg>Another attempt at dealing with FD leak<commit_after>// package cf provides a utility for interacting with CloudFlare
package cf

import (
	"crypto/tls"
	"fmt"
	"net/http"
	"time"

	"github.com/getlantern/cloudflare"
	"github.com/getlantern/golog"
)

var (
	log = golog.LoggerFor("cf")
)

type Util struct {
	Client *cloudflare.Client
	domain string
}

func New(domain string, username string, apiKey string) (*Util, error) {
	client, err := cloudflare.NewClient(username, apiKey)
	if err != nil {
		return nil, fmt.Errorf("Unable to initialize client: %v", err)
	}
	// Set a longish timeout on the HTTP client just in case
	client.Http = &http.Client{
		Timeout: 5 * time.Minute,
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{
				ClientSessionCache: tls.NewLRUClientSessionCache(1000),
			},
			DisableKeepAlives: true,
		},
	}
	return &Util{client, domain}, nil
}

{'fraction_non_alphanumeric': 0.11942028985507247, 'fraction_numerical': 0.005797101449275362, 'mean_word_length': 4.294478527607362, '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': '5620621', 'n_tokens_mistral': 627, 'n_tokens_neox': 585, 'n_words': 166}