ipfilter

package module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

README

go-ipfilter

IP Whitelist for golang

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HTTPClient = http.DefaultClient

Functions

func ParseIP

func ParseIP(addr string) (ip net.IP)

func Sum64a

func Sum64a(s []byte) (h uint64)

Types

type IPFilter

type IPFilter struct {
	// contains filtered or unexported fields
}

func Build

func Build(ips []string, blacklist bool) *IPFilter

func IPBlacklist

func IPBlacklist(ips []string) *IPFilter

func IPWhitelist

func IPWhitelist(ips []string) *IPFilter

func Read

func Read(r io.Reader, blacklist bool) (*IPFilter, error)

func ReadIPBlacklist

func ReadIPBlacklist(r io.Reader) (*IPFilter, error)

func ReadIPWhitelist

func ReadIPWhitelist(r io.Reader) (*IPFilter, error)

func ReadURL

func ReadURL(urlStr string, blacklist bool) (*IPFilter, error)

func (*IPFilter) MatchIP

func (f *IPFilter) MatchIP(ip net.IP) bool

func (IPFilter) MatchString

func (f IPFilter) MatchString(addr string) bool

func (*IPFilter) Size

func (f *IPFilter) Size() int

type IPNumber

type IPNumber uint32

func IPNumberOf

func IPNumberOf(ip net.IP) (n IPNumber)

func ParseIPNumber

func ParseIPNumber(addr string) (k uint8, n IPNumber)

func ParseIPNumberOnly

func ParseIPNumberOnly(addr string) (n IPNumber)

type IPv4Filter

type IPv4Filter struct {
	// contains filtered or unexported fields
}

func BuildIPv4

func BuildIPv4(ips []string, blacklist bool) *IPv4Filter

func IPv4Blacklist

func IPv4Blacklist(ips []string) (f *IPv4Filter)

func IPv4Whitelist

func IPv4Whitelist(ips []string) *IPv4Filter

func ReadIPv4

func ReadIPv4(r io.Reader, blacklist bool) (*IPv4Filter, error)

func ReadIPv4Blacklist

func ReadIPv4Blacklist(r io.Reader) (*IPv4Filter, error)

func ReadIPv4Whitelist

func ReadIPv4Whitelist(r io.Reader) (*IPv4Filter, error)

func ReadURLv4

func ReadURLv4(urlStr string, blacklist bool) (*IPv4Filter, error)

func (*IPv4Filter) MatchIP

func (f *IPv4Filter) MatchIP(ip net.IP) bool

func (*IPv4Filter) MatchString

func (f *IPv4Filter) MatchString(v string) bool

func (*IPv4Filter) Size added in v0.0.4

func (f *IPv4Filter) Size() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL