Documentation ¶
Overview ¶
Copyright (C) 2020, IrineSistiana
This file is part of mosdns.
mosdns is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
mosdns is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is a list of Nets. All Nets will be in ipv6 format, even it's ipv4 addr. Cause we use bin search.
func NewListFromReader ¶
NewListFromReader read IP list from a reader, if no valid IP addr was found, it will return a empty NetList, NOT nil. NetList will be a sorted list.
func (*List) Append ¶
Append appends new Nets to the list. This modified list, call Sort() before call next Contains()
func (*List) Contains ¶
Contains reports whether the list includes given ip. list must be sorted, or Contains will panic.
func (*List) Merge ¶
Merge merges srcList with list This modified list, call Sort() before call next Contains()
type Matcher ¶
func BatchLoad ¶ added in v0.22.0
BatchLoad is helper func to load multiple files using NewIPMatcherFromFile.
func NewIPMatcherFromFile ¶
NewIPMatcherFromFile loads a netlist file a list or geoip file. if file contains a ':' and has format like 'geoip:cn', file must be a geoip file.
func NewListFromListFile ¶
NewListFromListFile read IP list from a file, the returned NetList is already been sorted.
func NewNetListFromDAT ¶
type MatcherGroup ¶
type MatcherGroup struct {
// contains filtered or unexported fields
}
func NewMatcherGroup ¶
func NewMatcherGroup(m []Matcher) *MatcherGroup
type Net ¶
type Net struct {
// contains filtered or unexported fields
}
Net represents a ip network
func NewNet ¶
NewNet returns a new IPNet, mask should be an ipv6 mask, which means you should +96 if you have an ipv4 mask.