diff --git a/README.md b/README.md index 1796401dd..f38c4ed43 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,35 @@ # GeoIP for V2Ray -This project automatically weekly releases GeoIP files for routing purpose in Project V. It also provides a command line interface(CLI) for users to customize their own GeoIP files. - -These two concepts are notable: `input` and `output`. The `input` is the data source and its input format, whereas the `output` is the destination of the converted data and its output format. What the CLI does is to aggregate all input format data, then convert them to output format and write them to GeoIP files by using the options in the config file. +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. ## Download links -- **geoip.dat**:[https://github.com/v2fly/geoip/releases/latest/download/geoip.dat](https://github.com/v2fly/geoip/releases/latest/download/geoip.dat) -- **geoip.dat.sha256sum**:[https://github.com/v2fly/geoip/releases/latest/download/geoip.dat.sha256sum](https://github.com/v2fly/geoip/releases/latest/download/geoip.dat.sha256sum) -- **geoip-only-cn-private.dat**:[https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat](https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat) -- **geoip-only-cn-private.dat.sha256sum**:[https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat.sha256sum](https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat.sha256sum) -- **cn.dat**:[https://github.com/v2fly/geoip/releases/latest/download/cn.dat](https://github.com/v2fly/geoip/releases/latest/download/cn.dat) -- **cn.dat.sha256sum**:[https://github.com/v2fly/geoip/releases/latest/download/cn.dat.sha256sum](https://github.com/v2fly/geoip/releases/latest/download/cn.dat.sha256sum) -- **private.dat**:[https://github.com/v2fly/geoip/releases/latest/download/private.dat](https://github.com/v2fly/geoip/releases/latest/download/private.dat) -- **private.dat.sha256sum**:[https://github.com/v2fly/geoip/releases/latest/download/private.dat.sha256sum](https://github.com/v2fly/geoip/releases/latest/download/private.dat.sha256sum) +For all GeoIP files released by this project, see the [release branch](https://github.com/v2fly/geoip/tree/release). Below are download URLs for some GeoIP files: + +- **geoip.dat**: + - [https://github.com/v2fly/geoip/releases/latest/download/geoip.dat](https://github.com/v2fly/geoip/releases/latest/download/geoip.dat) + - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip.dat](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip.dat) +- **geoip.dat.sha256sum**: + - [https://github.com/v2fly/geoip/releases/latest/download/geoip.dat.sha256sum](https://github.com/v2fly/geoip/releases/latest/download/geoip.dat.sha256sum) + - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip.dat.sha256sum](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip.dat.sha256sum) +- **geoip-only-cn-private.dat**: + - [https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat](https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat) + - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip-only-cn-private.dat](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip-only-cn-private.dat) +- **geoip-only-cn-private.dat.sha256sum**: + - [https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat.sha256sum](https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat.sha256sum) + - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip-only-cn-private.dat.sha256sum](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip-only-cn-private.dat.sha256sum) +- **cn.dat**: + - [https://github.com/v2fly/geoip/releases/latest/download/cn.dat](https://github.com/v2fly/geoip/releases/latest/download/cn.dat) + - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/cn.dat](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/cn.dat) +- **cn.dat.sha256sum**: + - [https://github.com/v2fly/geoip/releases/latest/download/cn.dat.sha256sum](https://github.com/v2fly/geoip/releases/latest/download/cn.dat.sha256sum) + - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/cn.dat.sha256sum](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/cn.dat.sha256sum) +- **private.dat**: + - [https://github.com/v2fly/geoip/releases/latest/download/private.dat](https://github.com/v2fly/geoip/releases/latest/download/private.dat) + - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/private.dat](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/private.dat) +- **private.dat.sha256sum**: + - [https://github.com/v2fly/geoip/releases/latest/download/private.dat.sha256sum](https://github.com/v2fly/geoip/releases/latest/download/private.dat.sha256sum) + - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/private.dat.sha256sum](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/private.dat.sha256sum) ## GeoIP usage example in V2Ray @@ -69,13 +85,35 @@ These two concepts are notable: `input` and `output`. The `input` is the data so } ``` -## Generate GeoIP files manually +## Customize GeoIP files + +### Concept explanation + +These two concepts are notable: `input` and `output`. The `input` is the data source and its input format, whereas the `output` is the destination of the converted data and its output format. What the CLI does is to aggregate all input format data, then convert them to output format and write them to GeoIP files by using the options in the config file. + +### Supported formats + +Supported `input` formats: + +- **cutter**: Remove data from previous steps +- **maxmindGeoLite2CountryCSV**: Convert MaxMind GeoLite2 country CSV data to other formats +- **maxmindMMDB**: Convert MaxMind mmdb database to other formats +- **private**: Convert LAN and private network CIDR to other formats +- **text**: Convert plaintext IP and CIDR to other formats +- **v2rayGeoIPDat**: Convert V2Ray GeoIP dat to other formats + +Supported `output` formats: + +- **text**: Convert data to plaintext CIDR format +- **v2rayGeoIPDat**: Convert data to V2Ray GeoIP dat format + +### Steps 1. Install `golang` and `git` 2. Clone project code: `git clone https://github.com/v2fly/geoip.git` 3. Navigate to project root directory: `cd geoip` 4. Install project dependencies: `go mod download` -5. Edit config file `config.json` by referencing the example configuration options in file `config-example.json` +5. Edit config file `config.json` by referencing the configuration options in [configuration.md](https://github.com/v2fly/geoip/blob/HEAD/configuration.md) 6. Generate files: `go run ./` ### Notices @@ -84,11 +122,13 @@ These two concepts are notable: `input` and `output`. The `input` is the data so - `go run ./` will use `config.json` in current directory as the default config file, or use `go run ./ -c /path/to/your/own/config/file.json` to specify your own config file. - The generated files are located at `output` directory by default. - Run `go run ./ -h` for more usage information. -- See `config-example.json` for more configuration options. +- See [configuration.md](https://github.com/v2fly/geoip/blob/HEAD/configuration.md) for all configuration options. ## CLI showcase -You can run `go install -v github.com/v2fly/geoip@latest` to install the CLI directly. +You can run `go install -v github.com/v2fly/geoip@latest` to install the CLI tool directly. + +### Show help information ```bash $ ./geoip -h @@ -96,8 +136,11 @@ Usage of ./geoip: -c string Path to the config file (default "config.json") -l List all available input and output formats +``` +### Generate GeoIP files +```bash $ ./geoip -c config.json 2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] geoip.dat --> output/dat 2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] geoip-only-cn-private.dat --> output/dat @@ -105,8 +148,11 @@ $ ./geoip -c config.json 2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] private.dat --> output/dat 2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] test.dat --> output/dat 2021/09/02 00:26:12 ✅ [text] cn.txt --> output/text +``` +### List all supported formats +```bash $ ./geoip -l All available input formats: - cutter (Remove data from previous steps) @@ -124,7 +170,7 @@ All available output formats: ## Notice -This product includes GeoLite2 data created by MaxMind, available from [MaxMind](http://www.maxmind.com). +This product includes GeoLite2 data created by MaxMind, available from [MaxMind](https://www.maxmind.com). ## License diff --git a/config-example.json b/config-example.json deleted file mode 100644 index 8313a88e1..000000000 --- a/config-example.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "input": [ - { - "type": "v2rayGeoIPDat", - "action": "add", - "args": { - "uri": "./geoip.dat", - "wantedList": ["cn", "us"], - "onlyIPType": "ipv4" - } - }, - { - "type": "v2rayGeoIPDat", - "action": "add", - "args": { - "uri": "https://raw.githubusercontent.com/v2fly/geoip/release/geoip.dat", - "onlyIPType": "ipv6" - } - }, - { - "type": "maxmindGeoLite2CountryCSV", - "action": "add", - "args": { - "country": "./geolite2/GeoLite2-Country-Locations-en.csv", - "ipv4": "./geolite2/GeoLite2-Country-Blocks-IPv4.csv", - "ipv6": "./geolite2/GeoLite2-Country-Blocks-IPv6.csv", - "wantedList": ["cn", "us"] - } - }, - { - "type": "maxmindMMDB", - "action": "add" - }, - { - "type": "maxmindMMDB", - "action": "add", - "args": { - "uri": "./path/to/your/mmdb/file", - "wantedList": ["cn", "us"], - "onlyIPType": "ipv4" - } - }, - { - "type": "maxmindMMDB", - "action": "add", - "args": { - "uri": "https://example.com/link/to/your/mmdb/file" - } - }, - { - "type": "maxmindMMDB", - "action": "remove", - "args": { - "uri": "https://example.com/link/to/your/mmdb/file", - "wantedList": ["jp", "sg"], - "onlyIPType": "ipv6" - } - }, - { - "type": "cutter", - "action": "remove", - "args": { - "wantedList": ["cn", "us"], - "onlyIPType": "ipv4" - } - }, - { - "type": "cutter", - "action": "remove", - "args": { - "onlyIPType": "ipv6" - } - }, - { - "type": "text", - "action": "add", - "args": { - "inputDir": "./data" - } - }, - { - "type": "text", - "action": "add", - "args": { - "name": "mylist", - "uri": "./an/example/dir/mycidr.txt", - "onlyIPType": "ipv6" - } - }, - { - "type": "text", - "action": "add", - "args": { - "name": "cn", - "uri": "https://raw.githubusercontent.com/17mon/china_ip_list/master/china_ip_list.txt", - "onlyIPType": "ipv4" - } - }, - { - "type": "private", - "action": "add" - }, - { - "type": "test", - "action": "add" - } - ], - "output": [ - { - "type": "v2rayGeoIPDat", - "action": "output", - "args": { - "outputName": "geoip.dat", - "outputDir": "./publish" - } - }, - { - "type": "v2rayGeoIPDat", - "action": "output", - "args": { - "outputName": "geoip-only-cn-private.dat", - "outputDir": "./publish", - "wantedList": ["cn", "private"] - } - }, - { - "type": "v2rayGeoIPDat", - "action": "output", - "args": { - "outputDir": "./publish", - "oneFilePerList": true, - "wantedList": ["cn", "private", "test"], - "onlyIPType": "ipv4" - } - }, - { - "type": "text", - "action": "output", - "args": { - "outputDir": "./publish", - "wantedList": ["cn", "us", "private"], - "onlyIPType": "ipv6" - } - } - ] -} diff --git a/configuration.md b/configuration.md new file mode 100644 index 000000000..fc0327924 --- /dev/null +++ b/configuration.md @@ -0,0 +1,430 @@ +# Configuration explanation + +## Overview + +The format of the configuration file used in this project is `json`. The JSON configuration contains two arrays, `input` and `output`, each of which contains a specific configuration for one or more input or output formats. + +```json +{ + "input": [], + "output": [] +} +``` + +## Supported formats + +Supported `input` formats: + +- **cutter**: Remove data from previous steps +- **maxmindGeoLite2CountryCSV**: Convert MaxMind GeoLite2 country CSV data to other formats +- **maxmindMMDB**: Convert MaxMind mmdb database to other formats +- **private**: Convert LAN and private network CIDR to other formats +- **text**: Convert plaintext IP and CIDR to other formats +- **v2rayGeoIPDat**: Convert V2Ray GeoIP dat to other formats + +Supported `output` formats: + +- **text**: Convert data to plaintext CIDR format +- **v2rayGeoIPDat**: Convert data to V2Ray GeoIP dat format + +## Configuration options for `input` formats + +### **cutter** + +- **type**: (required) the name of the input format +- **action**: (required) action type, the value must be `remove` (to remove IP / CIDR) +- **args**: (required) + - **wantedList**: (required, array) specified wanted lists + - **onlyIPType**: (optional) the IP address type to be processed, the value is `ipv4` or `ipv6` + +```jsonc +{ + "type": "cutter", + "action": "remove", // remove IP or CIDR + "args": { + "wantedList": ["cn", "us", "jp"] // remove IPv4 and IPv6 addresses from lists called cn, us, jp, AKA remove the three entire lists + } +} +``` + +```jsonc +{ + "type": "cutter", + "action": "remove", // remove IP or CIDR + "args": { + "wantedList": ["cn", "us", "jp"], + "onlyIPType": "ipv6" // remove IPv6 addresses from lists called cn, us, jp + } +} +``` + +### **maxmindGeoLite2CountryCSV** + +- **type**: (required) the name of the input format +- **action**: (required) action type, the value could be `add`(to add IP / CIDR) or `remove`(to remove IP / CIDR) +- **args**: (optional) + - **country**: (optional) the path to MaxMind GeoLite2 Country CSV location file (`GeoLite2-Country-Locations-en.csv`), can be local file path or remote `http` or `https` URL + - **ipv4**: (optional) the path to MaxMind GeoLite2 Country IPv4 file (`GeoLite2-Country-Blocks-IPv4.csv`), can be local file path or remote `http` or `https` URL + - **ipv6**: (optional) the path to MaxMind GeoLite2 Country IPv6 file (`GeoLite2-Country-Blocks-IPv6.csv`), can be local file path or remote `http` or `https` URL + - **wantedList**: (optional, array) specified wanted lists + - **onlyIPType**: (optional) the IP address type to be processed, the value is `ipv4` or `ipv6` + +```jsonc +// Files to be used by default: +// ./geolite2/GeoLite2-Country-Locations-en.csv +// ./geolite2/GeoLite2-Country-Blocks-IPv4.csv +// ./geolite2/GeoLite2-Country-Blocks-IPv6.csv +{ + "type": "maxmindGeoLite2CountryCSV", + "action": "add" // add IP or CIDR +} +``` + +```jsonc +{ + "type": "maxmindGeoLite2CountryCSV", + "action": "add", // add IP or CIDR + "args": { + "country": "./geolite2/GeoLite2-Country-Locations-en.csv", + "ipv4": "./geolite2/GeoLite2-Country-Blocks-IPv4.csv", + "ipv6": "./geolite2/GeoLite2-Country-Blocks-IPv6.csv" + } +} +``` + +```jsonc +{ + "type": "maxmindGeoLite2CountryCSV", + "action": "add", // add IP or CIDR + "args": { + "wantedList": ["cn", "us", "jp"] // add IPv4 and IPv6 addresses to lists called cn, us, jp + } +} +``` + +```jsonc +{ + "type": "maxmindGeoLite2CountryCSV", + "action": "remove", // remove IP or CIDR + "args": { + "wantedList": ["cn", "us", "jp"], // only to remove IPv6 addresses from lists called cn, us, jp + "onlyIPType": "ipv6" // only to remove IPv6 addresses + } +} +``` + +### **maxmindMMDB** + +- **type**: (required) the name of the input format +- **action**: (required) action type, the value could be `add`(to add IP / CIDR) or `remove`(to remove IP / CIDR) +- **args**: (optional) + - **uri**: (optional) the path to MaxMind GeoLite2 Country mmdb file(`GeoLite2-Country.mmdb`), can be local file path or remote `http` or `https` URL + - **wantedList**: (optional, array) specified wanted lists + - **onlyIPType**: (optional) the IP address type to be processed, the value is `ipv4` or `ipv6` + +```jsonc +// The file to be used by default: +// ./geolite2/GeoLite2-Country.mmdb +{ + "type": "maxmindMMDB", + "action": "add" // add IP or CIDR +} +``` + +```jsonc +{ + "type": "maxmindMMDB", + "action": "add", // add IP or CIDR + "args": { + "uri": "./geolite2/GeoLite2-Country.mmdb" + } +} +``` + +```jsonc +{ + "type": "maxmindMMDB", + "action": "add", // add IP or CIDR + "args": { + "uri": "https://example.com/my.mmdb", + "wantedList": ["cn", "us", "jp"], // add IPv4 addresses to lists called cn, us, jp + "onlyIPType": "ipv4" // only to add IPv4 addresses + } +} +``` + +```jsonc +{ + "type": "maxmindMMDB", + "action": "remove", // add IP or CIDR + "args": { + "uri": "https://example.com/my.mmdb", + "wantedList": ["cn", "us", "jp"], // only to remove IPv4 addresses from lists called cn, us, jp + "onlyIPType": "ipv4" // only to remove IPv4 addresses + } +} +``` + +### **private** + +- **type**: (required) the name of the input format +- **action**: (required) action type, the value could be `add`(to add IP / CIDR) or `remove`(to remove IP / CIDR) + +> The default CIDRs to be added to or removed from `private`, see [private.go](https://github.com/v2fly/geoip/blob/HEAD/plugin/special/private.go#L16-L36). + +```jsonc +{ + "type": "private", + "action": "add" // add IP or CIDR +} +``` + +```jsonc +{ + "type": "private", + "action": "remove" // remove IP or CIDR +} +``` + +### **text** + +- **type**: (required) the name of the input format +- **action**: (required) action type, the value could be `add`(to add IP / CIDR) or `remove`(to remove IP / CIDR) +- **args**: (required) + - **name**: the list name (cannot be used with `inputDir`; must be used with `uri`) + - **uri**: the path to plaintext txt file, can be local file path or remote `http` or `https` URL (cannot be used with `inputDir`; must be used with `name`) + - **inputDir**: the directory of the files to walk through (excluded children directories). (the filename will be the list name; cannot be used with `name` or `uri`) + - **wantedList**: (optional, array) specified wanted files. (used with `inputDir`) + - **onlyIPType**: (optional) the IP address type to be processed, the value is `ipv4` or `ipv6` + - **removePrefixesInLine**: (optional, array) the array of string prefixes to be removed in each line + - **removeSuffixesInLine**: (optional, array) the array of string suffixes to be removed in each line + +```jsonc +{ + "type": "text", + "action": "add", // add IP or CIDR + "args": { + "name": "cn", + "uri": "./cn.txt", // get IPv4 and IPv6 addresses from local file cn.txt, and add to list cn + "removePrefixesInLine": ["Host,", "IP-CIDR"], // remove all prefixes from each line of the file + "removeSuffixesInLine": [",no-resolve"] // remove all suffixes from each line of the file + } +} +``` + +```jsonc +{ + "type": "text", + "action": "add", // add IP or CIDR + "args": { + "inputDir": "./text", // walk through all files in directory ./text (excluded children directories by default) + "wantedList": ["cn", "us", "jp"], // wanted lists called cn, us, jp without file extension + "onlyIPType": "ipv6", // add IPv6 addresses only + "removePrefixesInLine": ["Host,", "IP-CIDR"], // remove all prefixes from each line of each file + "removeSuffixesInLine": [",no-resolve"] // remove all suffixes from each line of each file + } +} +``` + +```jsonc +{ + "type": "text", + "action": "remove", // remove IP or CIDR + "args": { + "name": "cn", + "uri": "https://example.com/cn.txt", // read the content of the remote file + "onlyIPType": "ipv6", // remove only IPv6 addresses from list called cn + "removePrefixesInLine": ["Host,", "IP-CIDR"], // remove all prefixes from each line of the file + } +} +``` + +```jsonc +{ + "type": "text", + "action": "remove", // remove IP or CIDR + "args": { + "name": "cn", + "uri": "https://example.com/cn.txt", // read the content of the remote file + "onlyIPType": "ipv6", // remove only IPv6 addresses from list called cn + "removeSuffixesInLine": [",no-resolve"] // remove all suffixes from each line of the file + } +} +``` + +### **v2rayGeoIPDat** + +- **type**: (required) the name of the input format +- **action**: (required) action type, the value could be `add`(to add IP / CIDR) or `remove`(to remove IP / CIDR) +- **args**: (required) + - **uri**: (required) the path to V2Ray dat format geoip file, can be local file path or remote `http` or `https` URL + - **wantedList**: (optional, array) specified wanted lists + - **onlyIPType**: (optional) the IP address type to be processed, the value is `ipv4` or `ipv6` + +```jsonc +{ + "type": "v2rayGeoIPDat", + "action": "add", // add IP or CIDR + "args": { + "uri": "./cn.dat" // add IPv4 and IPv6 addresses of local file cn.dat to lists + } +} +``` + +```jsonc +{ + "type": "v2rayGeoIPDat", + "action": "add", // add IP or CIDR + "args": { + "uri": "./geoip.dat", // read from local file geoip.dat + "wantedList": ["cn", "us", "jp"], // wanted lists called cn, us, jp + "onlyIPType": "ipv6" // only to add IPv6 addresses + } +} +``` + +```jsonc +{ + "type": "v2rayGeoIPDat", + "action": "remove", // remove IP or CIDR + "args": { + "uri": "https://example.com/geoip.dat", // read the content of the remote file + "onlyIPType": "ipv6" // remove only IPv6 addresses from all lists + } +} +``` + +## Configuration options for `output` formats + +### **text** + +- **type**: (required) the name of the output format +- **action**: (required) action type, the value must be `output` +- **args**: (optional) + - **outputDir**: (optional) path to the output directory + - **outputExtension**: (optional) the extension of the output file + - **wantedList**: (optional, array) specified wanted lists + - **onlyIPType**: (optional) the IP address type to output, the value is `ipv4` or `ipv6` + - **addPrefixInLine**: (optional) the prefix to be added in each line + - **addSuffixInLine**: (optional) the suffix to be added in each line + +```jsonc +// The output directory by default: +// ./output/text +{ + "type": "text", + "action": "output", + "args": { + "outputDir": "./text", // output files to directory ./text + "outputExtension": ".conf", // the extension of the output files are .conf + "addPrefixInLine": "IP-CIDR,", // add prefix to each line + "addSuffixInLine": ",no-resolve" // add suffix to each line + } +} +``` + +```jsonc +{ + "type": "text", + "action": "output", + "args": { + "outputDir": "./text", // output files to directory ./text + "outputExtension": ".conf", // the extension of the output files are .conf + "addPrefixInLine": "IP-CIDR,", + "addSuffixInLine": ",no-resolve" + } +} +``` + +```jsonc +{ + "type": "text", + "action": "output", + "args": { + "outputDir": "./text", // output files to directory ./text + "outputExtension": ".conf", // the extension of the output files are .conf + "wantedList": ["cn", "us", "jp"], // output IPv4 and IPv6 addresses of lists called cn, us, jp + "addPrefixInLine": "HOST," // add prefix to each line of each file + } +} +``` + +```jsonc +{ + "type": "text", + "action": "output", + "args": { + "outputDir": "./text", // output files to directory ./text + "outputExtension": ".conf", // the extension of the output files are .conf + "wantedList": ["cn", "us", "jp"], // output only IPv4 addresses of lists called cn, us, jp + "onlyIPType": "ipv4", // output IPv4 addresses only + "addSuffixInLine": ";" // add suffix to each line of each file + } +} +``` + +### **v2rayGeoIPDat** + +- **type**: (required) the name of the output format +- **action**: (required) action type, the value must be `output` +- **args**: (optional) + - **outputName**: (optional) the output filename + - **outputDir**: (optional) path to the output directory + - **wantedList**: (optional, array) specified wanted lists or files + - **onlyIPType**: (optional) the IP address type to output, the value is `ipv4` or `ipv6` + - **oneFilePerList**: (optional) output every single list to a new file, the value is `true` or `false`(default value) + +```jsonc +// The output directory by default: +// ./output/dat +{ + "type": "v2rayGeoIPDat", + "action": "output" // output all lists to one file +} +``` + +```jsonc +{ + "type": "v2rayGeoIPDat", + "action": "output", + "args": { + "oneFilePerList": true // output every single list to a new file + } +} +``` + +```jsonc +{ + "type": "v2rayGeoIPDat", + "action": "output", + "args": { + "outputDir": "./output", // output to ./output directory + "outputName": "geoip-only-cn-private.dat", // output file called geoip-only-cn-private.dat + "wantedList": ["cn", "private"] // only output lists called cn, private + } +} +``` + +```jsonc +{ + "type": "v2rayGeoIPDat", + "action": "output", + "args": { + "outputName": "geoip-asn.dat", // output file called geoip-asn.dat + "wantedList": ["telegram", "google"], // only output lists called telegram, google + "onlyIPType": "ipv4" // output only IPv4 addresses of lists called telegram, google + } +} +``` + +```jsonc +{ + "type": "v2rayGeoIPDat", + "action": "output", + "args": { + "wantedList": ["telegram", "google"], // only output lists called telegram, google + "onlyIPType": "ipv4", // output only IPv4 addresses of lists called telegram, google + "oneFilePerList": true // output every single list to a new file + } +} +```