lookup

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PRIVATE_IP = `10.0.0.0 10.255.255.255
172.16.0.0 172.31.255.255
192.168.0.0 192.168.255.255`
)

Variables

View Source
var (
	CHN_IP = `` /* 211955-byte string literal not displayed */

)
View Source
var IPv4LookupTable [][]uint32
View Source
var IPv4PrivateLookupTable [][]uint32

Functions

func BytesToIPv4

func BytesToIPv4(buf []byte) string

func BytesToIPv6

func BytesToIPv6(buf []byte) string

func IPAddressToInteger

func IPAddressToInteger(ip string) int

func IPInLookupTable

func IPInLookupTable(ip string, table [][]uint32) bool

func IsChineseIP

func IsChineseIP(ip string) bool

func IsChineseWebsite

func IsChineseWebsite(host string) bool

Exceptions are those Chinese websites who have oversea servers or CDNs, if you lookup their IPs outside China, you get foreign IPs based on your VPS's geolocation, which are of course undesired results. Using white list to filter these exceptions

func IsPrivateIP

func IsPrivateIP(ip string) bool

func LoadOrCreateChinaList

func LoadOrCreateChinaList(raw string) bool

func LookupIPv4

func LookupIPv4(host string) (string, error)

Types

type China_list_t

type China_list_t map[string]interface{}
var ChinaList China_list_t

Jump to

Keyboard shortcuts

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