<commit_before>package gotool

import (
	"encoding/binary"
	"errors"
	"fmt"
	"net"
)

func IPv4toUint32(ip string) (uint32, error) {
	i := net.ParseIP(ip)
	if i == nil {
		return 0, errors.New("ParseIP error")
	}
	i = i.To4()
	return binary.BigEndian.Uint32(i), nil
}
func Uint32toIPv4(ipint uint32) string {
	a := ipint >> 24
	b := (ipint - (a << 24)) >> 16
	c := (ipint - (a << 24) - (b << 16)) >> 8
	d := ipint - (a << 24) - (b << 16) - (c << 8)
	return fmt.Sprintf("%v.%v.%v.%v", a, b, c, d)
}
<commit_msg>增加GetLocalIP<commit_after>package gotool

import (
	"encoding/binary"
	"errors"
	"fmt"
	"net"
)

func IPv4toUint32(ip string) (uint32, error) {
	i := net.ParseIP(ip)
	if i == nil {
		return 0, errors.New("ParseIP error")
	}
	i = i.To4()
	return binary.BigEndian.Uint32(i), nil
}
func Uint32toIPv4(ipint uint32) string {
	a := ipint >> 24
	b := (ipint - (a << 24)) >> 16
	c := (ipint - (a << 24) - (b << 16)) >> 8
	d := ipint - (a << 24) - (b << 16) - (c << 8)
	return fmt.Sprintf("%v.%v.%v.%v", a, b, c, d)
}

//获取本机网卡IP
func GetLocalIP() ([]string, error) {
	addrs, err := net.InterfaceAddrs()
	if err != nil {
		return nil, err
	}
	var ips []string
	for _, v := range addrs {
		if ipnet, ok := v.(*net.IPNet); ok {
			ip := ipnet.IP
			if ip.To4() != nil && !ip.IsLoopback() {
				ips = append(ips, ip.String())
			}
		}
	}
	return ips, nil
}

{'fraction_non_alphanumeric': 0.2140221402214022, 'fraction_numerical': 0.045018450184501846, 'mean_word_length': 2.988235294117647, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 15, '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': '5634819', 'n_tokens_mistral': 672, 'n_tokens_neox': 609, 'n_words': 156}