<commit_before>package ipmanager

import (
	"fmt"
	"log"
	"net"
	"strings"
	"time"

	arp "github.com/mdlayher/arp"
)

//  The BasicConfigurer can be used to enable vip-management on nodes
//  that handle their own network connection, in setups where it is
//  sufficient to add the virtual ip using `ip addr add ...` .
//  After adding the virtual ip to the specified interface,
//  a gratuitous ARP package is sent out to update the tables of
//  nearby routers and other devices.

const (
	arpRequestOp = 1
	arpReplyOp   = 2
)

type BasicConfigurer struct {
	*IPConfiguration
	arpClient  *arp.Client
	ntecontext uint32 //used by Windows to delete IP address
}

func NewBasicConfigurer(config *IPConfiguration) (*BasicConfigurer, error) {
	c := &BasicConfigurer{IPConfiguration: config}

	// //this should never error out, otherwise we have bigger problems
	// local_hardware_addr, err := net.ParseMAC("00:00:00:00:00:00")
	// if err != nil {
	// 	log.Fatalf("Couldn't create a local hardware address: %s", err)
	// }

	err := c.createArpClient()
	if err != nil {
		log.Fatalf("Couldn't create an Arp client: %s", err)<commit_msg>fix `ntecontext` is unused (structcheck)<commit_after>package ipmanager

import (
	"fmt"
	"log"
	"net"
	"strings"
	"time"

	arp "github.com/mdlayher/arp"
)

//  The BasicConfigurer can be used to enable vip-management on nodes
//  that handle their own network connection, in setups where it is
//  sufficient to add the virtual ip using `ip addr add ...` .
//  After adding the virtual ip to the specified interface,
//  a gratuitous ARP package is sent out to update the tables of
//  nearby routers and other devices.

const (
	arpRequestOp = 1
	arpReplyOp   = 2
)

type BasicConfigurer struct {
	*IPConfiguration
	arpClient  *arp.Client
	ntecontext uint32 //used by Windows to delete IP address
}

func NewBasicConfigurer(config *IPConfiguration) (*BasicConfigurer, error) {
	c := &BasicConfigurer{IPConfiguration: config, ntecontext: 0}

	// //this should never error out, otherwise we have bigger problems
	// local_hardware_addr, err := net.ParseMAC("00:00:00:00:00:00")
	// if err != nil {
	// 	log.Fatalf("Couldn't create a local hardware address: %s", err)
	// }

	err := c.createArpClient()
	if err != nil {
		log.Fatalf("Couldn't create an Arp client: %s", err)
{'fraction_non_alphanumeric': 0.109375, 'fraction_numerical': 0.014322916666666666, 'mean_word_length': 3.752577319587629, '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': '491265', 'n_tokens_mistral': 768, 'n_tokens_neox': 743, 'n_words': 267}