Documentation ¶
Overview ¶
Copyright (C) 2020-2021, 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 ¶
- func LoadGeoIPFromDAT(file, tag string) (*v2data.GeoIP, error)
- func LoadGeoIPListFromDAT(file string) (*v2data.GeoIPList, error)
- type IPv6
- type List
- func BatchLoad(f []string) (m *List, err error)
- func NewList() *List
- func NewListFromDAT(file, tag string) (*List, error)
- func NewListFromFile(file string) (*List, error)
- func NewListFromReader(reader io.Reader) (*List, error)
- func NewListFromTextFile(file string) (*List, error)
- func NewListFromV2CIDR(cidr []*v2data.CIDR) (*List, error)
- type Matcher
- type MatcherGroup
- type Net
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadGeoIPFromDAT ¶ added in v0.24.0
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 BatchLoad ¶ added in v0.22.0
BatchLoad is helper func to load multiple files using NewListFromFile.
func NewListFromDAT ¶ added in v0.24.0
NewListFromDAT loads ip from v2ray proto file. The returned *List is already been sorted.
func NewListFromFile ¶ added in v0.24.0
NewListFromFile loads ip from a text file or a geoip file. If file contains a ':' and has format like 'geoip:cn', it will be read as a geoip file. The returned *List is already been sorted.
func NewListFromReader ¶
NewListFromReader read IP list from a reader. The returned *List is sorted.
func NewListFromTextFile ¶ added in v0.24.0
NewListFromTextFile reads IP list from a text file. The returned *List is already been sorted.
func NewListFromV2CIDR ¶ added in v0.24.0
NewListFromV2CIDR loads ip from v2ray CIDR. The returned *List is already been sorted.
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 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.