geoip

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGeoIPRepoTag = "202308170052"
View Source
const GEOIPFileMainName = "Country.mmdb"
View Source
const GeoIPGitRepoUrl = "https://github.com/Loyalsoldier/geoip"
View Source
const ProxiedUrlPrefix = ""
View Source
const RepoName = "geoip"
View Source
const RepoOwner = "Loyalsoldier"

Variables

View Source
var GeoIPDBUrlTemplate = "%shttps://github.com/Loyalsoldier/geoip/releases/download/%s/Country.mmdb"

Functions

This section is empty.

Types

type GeoIPClient

type GeoIPClient struct {
	*GeoIPGitRepo
	GeoIPDb *geoip2.Reader
}
var GlobalGeoIPClient GeoIPClient

func (GeoIPClient) GetIPISOCode

func (c GeoIPClient) GetIPISOCode(ipStr string) string

type GeoIPGitRepo

type GeoIPGitRepo struct {
	GeoIPDbFileName   string `json:"geoIpDbFileName"`
	GEOIPFileMainName string `json:"geoipFileMainMame"`
	LatestTagName     string `json:"LatestTagName"`
	CurrentTagName    string `json:"currentTagName"`
}

func (*GeoIPGitRepo) DownloadLatestGEOIPDb

func (repo *GeoIPGitRepo) DownloadLatestGEOIPDb(latestTag string) (dbName string, err error)

func (*GeoIPGitRepo) GetCurrentGeoIPDbFileInfo

func (repo *GeoIPGitRepo) GetCurrentGeoIPDbFileInfo()

GetCurrentGeoIPDbFileInfo

@Description: 获取当前目录的Country.mmdb 信息
@receiver repo

func (*GeoIPGitRepo) GetRepoLatestTag

func (repo *GeoIPGitRepo) GetRepoLatestTag() Release

GetRepoLatestTag

@Description: 获取最新的geoip tag
@receiver repo
@return Release

func (*GeoIPGitRepo) KeepLatestMmdb added in v1.0.8

func (repo *GeoIPGitRepo) KeepLatestMmdb()

type Release

type Release struct {
	HtmlUrl string `json:"html_url"`
	TagName string `json:"tag_name"`
}

Jump to

Keyboard shortcuts

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