Skip to content

Commit 9b440f0

Browse files
committed
Feat: use free DB-IP lite country MMDB database
For more details, see #108
1 parent c706795 commit 9b440f0

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

.github/workflows/build.yml

+12-11
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ name: Build geoip.dat
22
on:
33
workflow_dispatch:
44
schedule:
5-
- cron: "0 0 * * 4"
5+
- cron: "0 0 5 * *"
66
push:
77
branches:
88
- master
99
paths-ignore:
1010
- "README.md"
11+
- "configuration.md"
1112
- ".gitignore"
1213
- "LICENSE"
1314
- "**/dependabot.yml"
@@ -19,7 +20,7 @@ jobs:
1920
- name: Checkout codebase
2021
uses: actions/checkout@v4
2122

22-
- name: Set up Go
23+
- name: Setup Go
2324
uses: actions/setup-go@v5
2425
with:
2526
go-version-file: go.mod
@@ -28,20 +29,20 @@ jobs:
2829
run: |
2930
echo "TAG_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
3031
echo "RELEASE_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
32+
echo "YEAR=$(date +%Y)" >> $GITHUB_ENV
33+
echo "MONTH=$(date +%m)" >> $GITHUB_ENV
3134
shell: bash
3235

33-
- name: Get GeoLite2
34-
env:
35-
LICENSE_KEY: ${{ secrets.MAXMIND_LICEHSE }}
36+
- name: Get DB-IP Lite Country MMDB database
3637
run: |
37-
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
38-
unzip GeoLite2-Country-CSV.zip
39-
rm -f GeoLite2-Country-CSV.zip
40-
mv GeoLite2* geolite2
38+
curl -L -o dbip-country-lite.mmdb.gz "https://download.db-ip.com/free/dbip-country-lite-${{ env.YEAR }}-${{ env.MONTH }}.mmdb.gz"
39+
gzip -d dbip-country-lite.mmdb.gz
40+
mkdir -p db-ip
41+
mv dbip-country-lite*.mmdb ./db-ip/dbip-country-lite.mmdb
4142
42-
- name: Build geoip.dat
43+
- name: Build GeoIP files
4344
run: |
44-
go run ./
45+
go run ./ -c ./config.json
4546
4647
- name: Generate sha256 checksum for dat files
4748
run: |

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
# vendor/
1616

1717
geolite2/
18+
db-ip/
1819
output/
1920
tmp/
2021
geoip
22+
*.mmdb
23+
*.dat
24+
*.sha256sum

README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GeoIP for V2Ray
22

3-
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.
3+
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.
44

55
## Download links
66

@@ -168,10 +168,8 @@ All available output formats:
168168
- v2rayGeoIPDat (Convert data to V2Ray GeoIP dat format)
169169
```
170170

171-
## Notice
172-
173-
This product includes GeoLite2 data created by MaxMind, available from [MaxMind](https://www.maxmind.com).
174-
175171
## License
176172

177-
[CC-BY-SA-4.0](https://creativecommons.org/licenses/by-sa/4.0/)
173+
This project is licensed under [CC-BY-SA-4.0](https://creativecommons.org/licenses/by-sa/4.0/) license.
174+
175+
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.

config.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
{
22
"input": [
33
{
4-
"type": "maxmindGeoLite2CountryCSV",
4+
"type": "dbipCountryMMDB",
55
"action": "add",
66
"args": {
7-
"country": "./geolite2/GeoLite2-Country-Locations-en.csv",
8-
"ipv4": "./geolite2/GeoLite2-Country-Blocks-IPv4.csv",
9-
"ipv6": "./geolite2/GeoLite2-Country-Blocks-IPv6.csv"
7+
"uri": "./db-ip/dbip-country-lite.mmdb"
108
}
119
},
1210
{

0 commit comments

Comments
 (0)