Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/metacubex/geo
πΊAn easy way to manage all your Geo resources. Available as both a CLI and a Go library.
https://github.com/metacubex/geo
anticensorship clash geoip geosite routing sing-box trojan-go v2ray xray
Last synced: about 1 hour ago
JSON representation
πΊAn easy way to manage all your Geo resources. Available as both a CLI and a Go library.
- Host: GitHub
- URL: https://github.com/metacubex/geo
- Owner: MetaCubeX
- License: gpl-3.0
- Created: 2023-07-16T15:11:33.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-18T10:42:21.000Z (5 months ago)
- Last Synced: 2024-12-15T13:06:59.352Z (7 days ago)
- Topics: anticensorship, clash, geoip, geosite, routing, sing-box, trojan-go, v2ray, xray
- Language: Go
- Homepage:
- Size: 57.6 KB
- Stars: 113
- Watchers: 3
- Forks: 18
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://go.dev) 1.20+
```shell
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
```shell
geo look 223.5.5.5
``````shell
geo look 2001:250::
```#### Site
```shell
geo look example.com
``````shell
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
```shell
geo convert ip -i -o -f [output_filename] input_filename
``````shell
geo convert ip -i v2ray -o meta ./geoip.dat
```Available types:
- [MaxMind](https://github.com/Dreamacro/maxmind-geoip) (MMDB)
- [V2Ray-geoip](https://github.com/v2fly/geoip) (dat)
- [sing-geoip](https://github.com/SagerNet/sing-geoip) (MMDB)
- [Meta-geoip](https://github.com/MetaCubeX/meta-rules-dat) (MMDB)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
```shell
geo convert site -i -o -f [output_filename] -c [country code] input_filename
``````shell
geo convert site -i v2ray -o sing ./geosite.dat
```Only v2ray -> sing conversion is supported for GeoSite.
### Unpack
#### site
```shell
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. :-)