Giter Site home page Giter Site logo

metacubex / geo Goto Github PK

View Code? Open in Web Editor NEW
57.0 2.0 9.0 60 KB

🗺An easy way to manage all your Geo resources. Available as both a CLI and a Go library.

License: GNU General Public License v3.0

Go 100.00%
anticensorship clash geoip geosite routing sing-box trojan-go v2ray xray

geo's Introduction

geo

🗺An easy way to manage all your Geo resources.

Support GeoIP/GeoSite code lookup and converting among all popular GeoIP/GeoSite databases.

Install

Requirements:

  • Go 1.20+
go install -v github.com/metacubex/geo/cmd/geo@master

Usage

Type geo help for more details.

Look up codes from existing Geo databases

The default directory to find Geo databases is ~/.geo. You can specify it through -D argument.

IP

geo look 223.5.5.5
geo look 2001:250::

Site

geo look example.com
geo look --no-resolve example.com

Supported databases for look command:

  • MaxMind MMDB
  • V2Ray dat GeoIP/GeoSite
  • sing-geosite
  • sing-geoip MMDB
  • Meta-geoip MMDB

Convert

IP

geo convert ip -i <input_type> -o <output_type> -f [output_filename] input_filename
geo convert ip -i v2ray -o meta ./geoip.dat

Available types:

Supported conversion pairs: (Column=From, Row=To)

MaxMind V2Ray-geoip sing-geoip Meta-geoip
MaxMind -
V2Ray -
sing-geoip -
Meta-geoip -

Conversion to MaxMind is not available for legal reasons.
Conversion to V2Ray is on the TODO list.

Site

geo convert site -i <input_type> -o <output_type> -f [output_filename] -c [country code] input_filename
geo convert site -i v2ray -o sing ./geosite.dat

Only v2ray -> sing conversion is supported for GeoSite.

Unpack

site

geo unpack site ./geosite.dat -d output -c cn
  • -d output dir
  • -c code (optional, unpack all geosite if not set)

Frequently Asked Questions (FAQ)

Why conversion MaxMind/sing-geoip -> Meta-geoip is not available?

Meta-geoip is designed to support IP with multiple results, which will help users who use GeoIP functionality as IPList or IPSet.

For sources such as MaxMind and sing-geoip, which only have a single possible result, according to the principle of Occam's razor, there is no need to convert to Meta-geoip database.
In the other hand, when there is only a single result, the data structure of Meta-geoip and sing-geoip is completely consistent, and even compatible with the parsing logic.

Clash.Meta supports all of these databases, so everything is well. :-)

geo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

geo's Issues

geo look ip 没有显示全部的 GeoIP codes

geoip.dat 来自 https://github.com/peeweep/geoip/releases/tag/202401111336
223.119.50.147 同时在 GEOIP,CMI (223.118.0.0/15)GEOIP,CN (223.64.0.0/10) 中,使用其他工具比如 clash-meta 两个都可以匹配到,但是 geo look 只返回了 CN

实际结果

$ geo look 223.119.50.147 
🔎Querying from [/home/peeweep/.geo/geoip.dat]
🎉Query finished in 46.96831ms!
Total 1 results (GeoIP codes):
  CN %  

期望结果:

$ geo look 223.119.50.147 
🔎Querying from [/home/peeweep/.geo/geoip.dat]
🎉Query finished in 46.96831ms!
Total 2 results (GeoIP codes):
  CMI CN %  

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.