<commit_before>package main

import (
	"crypto/x509"
	"net"
)

// Listener accepts connections from devices.
type Listener struct {
	tls *net.Listener
}

// Listen creates a listener with the given PEM encoded X.509 certificate and the private key. Debug mode logs all communications.
func Listen(cert, priv []byte, debug bool) (*Listener, error) {
	c, err := x509.ParseCertificate(cert)
	p, err := x509.ParsePKCS1PrivateKey(priv)
	if err != nil {
		return nil, err
	}
	return nil, nil
}<commit_msg>add internal debug field<commit_after>package main

import (
	"crypto/tls"
	"crypto/x509"
	"net"
)

// Listener accepts connections from devices.
type Listener struct {
	debug    bool
	listener *net.Listener
}

// Listen creates a listener with the given PEM encoded X.509 certificate and the private key on the local network address laddr.
// Debug mode logs all server activity.
func Listen(cert, priv []byte, laddr string, debug bool) (*Listener, error) {
	c, err := x509.ParseCertificate(cert)
	p, err := x509.ParsePKCS1PrivateKey(priv)
	if err != nil {
		return nil, err
	}

	pool := x509.NewCertPool()
	pool.AddCert(c)

	tlsCert := tls.Certificate{
		Certificate: [][]byte{cert},
		PrivateKey:  p,
	}

	config := tls.Config{
		Certificates: []tls.Certificate{tlsCert},
		ClientCAs:    pool,
	}

	listener, err := tls.Listen("tcp", laddr, &config)
	if err != nil {
		return nil, err
	}

	return &Listener{
		debug:    debug,
		listener: &listener,
	}, nil
}
{'fraction_non_alphanumeric': 0.11704312114989733, 'fraction_numerical': 0.019849418206707735, 'mean_word_length': 3.9225589225589226, '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': '4167232', 'n_tokens_mistral': 514, 'n_tokens_neox': 480, 'n_words': 161}