Skip to content

Commit

Permalink
Feat: use free DB-IP lite country MMDB database
Browse files Browse the repository at this point in the history
For more details, see #108
  • Loading branch information
Loyalsoldier committed Jan 19, 2025
1 parent c706795 commit 9b440f0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ name: Build geoip.dat
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 4"
- cron: "0 0 5 * *"
push:
branches:
- master
paths-ignore:
- "README.md"
- "configuration.md"
- ".gitignore"
- "LICENSE"
- "**/dependabot.yml"
Expand All @@ -19,7 +20,7 @@ jobs:
- name: Checkout codebase
uses: actions/checkout@v4

- name: Set up Go
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
Expand All @@ -28,20 +29,20 @@ jobs:
run: |
echo "TAG_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "RELEASE_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "YEAR=$(date +%Y)" >> $GITHUB_ENV
echo "MONTH=$(date +%m)" >> $GITHUB_ENV
shell: bash

- name: Get GeoLite2
env:
LICENSE_KEY: ${{ secrets.MAXMIND_LICEHSE }}
- name: Get DB-IP Lite Country MMDB database
run: |
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o GeoLite2-Country-CSV.zip
unzip GeoLite2-Country-CSV.zip
rm -f GeoLite2-Country-CSV.zip
mv GeoLite2* geolite2
curl -L -o dbip-country-lite.mmdb.gz "https://download.db-ip.com/free/dbip-country-lite-${{ env.YEAR }}-${{ env.MONTH }}.mmdb.gz"
gzip -d dbip-country-lite.mmdb.gz
mkdir -p db-ip
mv dbip-country-lite*.mmdb ./db-ip/dbip-country-lite.mmdb
- name: Build geoip.dat
- name: Build GeoIP files
run: |
go run ./
go run ./ -c ./config.json
- name: Generate sha256 checksum for dat files
run: |
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# vendor/

geolite2/
db-ip/
output/
tmp/
geoip
*.mmdb
*.dat
*.sha256sum
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GeoIP for V2Ray

This project releases GeoIP files automatically every Thursday for routing purpose in Project V. It also provides a command line interface(CLI) tool for users to customize their own GeoIP files.
This project releases GeoIP files monthly for routing purpose in Project V. It also provides a command line interface(CLI) tool for users to customize their own GeoIP files.

## Download links

Expand Down Expand Up @@ -168,10 +168,8 @@ All available output formats:
- v2rayGeoIPDat (Convert data to V2Ray GeoIP dat format)
```

## Notice

This product includes GeoLite2 data created by MaxMind, available from [MaxMind](https://www.maxmind.com).

## License

[CC-BY-SA-4.0](https://creativecommons.org/licenses/by-sa/4.0/)
This project is licensed under [CC-BY-SA-4.0](https://creativecommons.org/licenses/by-sa/4.0/) license.

The free [IP Geolocation data by DB-IP](https://db-ip.com) is licensed under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) license.
6 changes: 2 additions & 4 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"input": [
{
"type": "maxmindGeoLite2CountryCSV",
"type": "dbipCountryMMDB",
"action": "add",
"args": {
"country": "./geolite2/GeoLite2-Country-Locations-en.csv",
"ipv4": "./geolite2/GeoLite2-Country-Blocks-IPv4.csv",
"ipv6": "./geolite2/GeoLite2-Country-Blocks-IPv6.csv"
"uri": "./db-ip/dbip-country-lite.mmdb"
}
},
{
Expand Down

0 comments on commit 9b440f0

Please sign in to comment.