qqwry

package module
v0.0.0-...-f506800 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2016 License: MIT Imports: 4 Imported by: 10

README

QQWry

纯真IP库 golang 版

有关纯真IP库的文档详见 http://lumaqq.linuxsir.org/article/qqwry_format_detail.html

1. 依赖

  • mahonia 处理 GBK 编码的地址信息 (请确保先装好 hg)
go get code.google.com/p/mahonia

update:

go get github.com/yinheli/mahonia
  • 纯真 IP 库

下载地址 http://update.cz88.net/soft/qqwry.rar

2. 使用

  • 下载
go get github.com/yinheli/qqwry
  • 在项目中引入
import (
	"github.com/yinheli/qqwry"
	"log"
)

func main() {
	q := qqwry.NewQQwry("qqwry.dat")
	q.Find("180.89.94.90")
	log.Printf("ip:%v, Country:%v, City:%v", q.Ip, q.Country, q.City)
	// output: 
	// 2014/02/22 22:10:32 ip:180.89.94.90, Country:北京市, City:长城宽带
}

3. 使用注意

  • qqwry 不是线程安全的
  • qqwry 没有使用缓存

4. license

Licensed under MIT.

Documentation

Index

Constants

View Source
const (
	INDEX_LEN       = 7
	REDIRECT_MODE_1 = 0x01
	REDIRECT_MODE_2 = 0x02
)

Variables

This section is empty.

Functions

This section is empty.

Types

type QQwry

type QQwry struct {
	Ip      string
	Country string
	City    string
	// contains filtered or unexported fields
}

@author yinheli

func NewQQwry

func NewQQwry(file string) (qqwry *QQwry)

func (*QQwry) Find

func (this *QQwry) Find(ip string)

Jump to

Keyboard shortcuts

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