<commit_before>package libspf2

/*
#cgo LDFLAGS: -L/usr/local/lib -L/usr/lib -lspf2
#cgo CFLAGS: -g -O2 -Wno-error -I/usr/include -I/usr/local/include

#include <time.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <netdb.h>
#include <spf2/spf.h>
*/
import "C"

import (
	"errors"
	"net"
	"unsafe"
)

const (
	SPFResultINVALID   = Result(C.SPF_RESULT_INVALID)   // (invalid)
	SPFResultPASS      = Result(C.SPF_RESULT_PASS)      // pass
	SPFResultFAIL      = Result(C.SPF_RESULT_FAIL)      // fail
	SPFResultSOFTFAIL  = Result(C.SPF_RESULT_SOFTFAIL)  // softfail
	SPFResultNEUTRAL   = Result(C.SPF_RESULT_NEUTRAL)   // neutral
	SPFResultPERMERROR = Result(C.SPF_RESULT_PERMERROR) // permerror
	SPFResultTEMPERROR = Result(C.SPF_RESULT_TEMPERROR) // temperror
	SPFResultNONE      = Result(C.SPF_RESULT_NONE)      // none
)

type Client interface {
	Query(host string, ip net.IP) (Result, error)
	Close()
}

type clientImpl struct {
	s *C.SPF_server_t
}

// NewClient creates a new SPF client.
func NewClient() Client {
	client := new(clientImpl)
	client.s = C.SPF_server_new(C.SPF_DNS_CACHE, 0)<commit_msg>Don't use the libspf caching layer.<commit_after>package libspf2

/*
#cgo LDFLAGS: -L/usr/local/lib -L/usr/lib -lspf2
#cgo CFLAGS: -g -O2 -Wno-error -I/usr/include -I/usr/local/include

#include <time.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <netdb.h>
#include <spf2/spf.h>
*/
import "C"

import (
	"errors"
	"net"
	"unsafe"
)

const (
	SPFResultINVALID   = Result(C.SPF_RESULT_INVALID)   // (invalid)
	SPFResultPASS      = Result(C.SPF_RESULT_PASS)      // pass
	SPFResultFAIL      = Result(C.SPF_RESULT_FAIL)      // fail
	SPFResultSOFTFAIL  = Result(C.SPF_RESULT_SOFTFAIL)  // softfail
	SPFResultNEUTRAL   = Result(C.SPF_RESULT_NEUTRAL)   // neutral
	SPFResultPERMERROR = Result(C.SPF_RESULT_PERMERROR) // permerror
	SPFResultTEMPERROR = Result(C.SPF_RESULT_TEMPERROR) // temperror
	SPFResultNONE      = Result(C.SPF_RESULT_NONE)      // none
)

type Client interface {
	Query(host string, ip net.IP) (Result, error)
	Close()
}

type clientImpl struct {
	s *C.SPF_server_t
}

// NewClient creates a new SPF client.
func NewClient() Client {
	client := new(clientImpl)
	client.s = C.SPF_server_new(C.SPF_DNS_RESOLV, 0)
{'fraction_non_alphanumeric': 0.1308411214953271, 'fraction_numerical': 0.004450378282153983, 'mean_word_length': 3.693110647181628, 'pattern_counts': {'":': 0, '<': 13, '<?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': '5403221', 'n_tokens_mistral': 931, 'n_tokens_neox': 921, 'n_words': 172}