<commit_before>package ipfilter

import (
	"errors"
	"fmt"
	"net"
)

type IPFilter struct {
	ipnets []net.IPNet
	ips    []net.IP
}

func (f *IPFilter) FilterIP(ip net.IP) bool {
	for _, item := range f.ipnets {
		if item.Contains(ip) {
			return true
		}
	}
	for _, item := range f.ips {
		if item.Equal(ip) {
			return true
		}
	}
	return false
}

func (f *IPFilter) FilterIPString(s string) bool {
	return f.FilterIP(net.ParseIP(s))
}

func (f *IPFilter) AddIPNet(item net.IPNet) {
	f.ipnets = append(f.ipnets, item)
}

func (f *IPFilter) AddIPNetString(s string) error {
	_, ipnet, err := net.ParseCIDR(s)<commit_msg>return false when parse ipstring fail<commit_after>package ipfilter

import (
	"errors"
	"fmt"
	"net"
)

type IPFilter struct {
	ipnets []net.IPNet
	ips    []net.IP
}

func (f *IPFilter) FilterIP(ip net.IP) bool {
	for _, item := range f.ipnets {
		if item.Contains(ip) {
			return true
		}
	}
	for _, item := range f.ips {
		if item.Equal(ip) {
			return true
		}
	}
	return false
}

func (f *IPFilter) FilterIPString(s string) bool {
	ip := net.ParseIP(s)
	if ip == nil {
		return false
	}
	return f.FilterIP(ip)
}

func (f *IPFilter) AddIPNet(item net.IPNet) {
	f.ipnets = append(f.ipnets, item)
}

func (f *IPFilter) AddIPNetString(s string) error {
	_, ipnet, err := net.ParseCIDR(s)
{'fraction_non_alphanumeric': 0.14067278287461774, 'fraction_numerical': 0.0, 'mean_word_length': 3.4523809523809526, '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': '3651252', 'n_tokens_mistral': 562, 'n_tokens_neox': 535, 'n_words': 135}