mirror of
https://github.com/darkclip/netlist.git
synced 2026-11-14 00:23:50 +08:00
update
This commit is contained in:
1 parent
56f8f118e1
commit
e26533d1b7
2 files changed
+34
-21
No files matched your search
@@ -41,12 +41,13 @@ jobs:
|
||||
- name: Rebuild target branch
|
||||
run: |
|
||||
cp mosdns/config.yml target/config.yml
|
||||
./raydata.py ref/geoip.dat -c cn -o target/rule/chinaip.txt geoip
|
||||
./raydata.py ref/geosite.dat -c cn -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
|
||||
./raydata.py ref/geosite.dat -c category-ads-all -o target/rule/blocklist.txt geosite --formatter mosdns/format.json
|
||||
touch target/rule/hosts.txt
|
||||
touch target/rule/whitelist.txt
|
||||
touch target/rule/greylist.txt
|
||||
./raydata.py ref/geoip.dat -c CN -o target/rule/chinaip.txt geoip
|
||||
./raydata.py ref/geosite.dat -c CN -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
|
||||
./raydata.py ref/geosite.dat -c BING -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
|
||||
./raydata.py ref/geosite.dat -c ALIBABA -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
|
||||
./raydata.py ref/geosite.dat -c ALIBABACLOUD -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
|
||||
./raydata.py ref/geosite.dat -c ALIYUN -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
|
||||
./raydata.py ref/geosite.dat -c CATEGORY-ADS-ALL -o target/rule/blocklist.txt geosite --formatter mosdns/format.json
|
||||
mkdir target/tmp
|
||||
cd target
|
||||
tar -cf mosdns.tar tmp rule *.yml
|
||||
|
||||
+27
-15
@@ -30,12 +30,12 @@ def init_protobuf(data_type: str = None) -> tuple:
|
||||
|
||||
|
||||
def load_resource(
|
||||
*,
|
||||
dat_files: typing.List[Path],
|
||||
countries: typing.List[str],
|
||||
inverse: bool = False,
|
||||
data_type: str = None,
|
||||
*,
|
||||
only_show: bool = False,
|
||||
data_type: str | None = None,
|
||||
brief_search: str | None = None,
|
||||
domain_types: typing.List[int] | None = None,
|
||||
formatter: Path | None = None,
|
||||
) -> list:
|
||||
@@ -59,7 +59,14 @@ def load_resource(
|
||||
else:
|
||||
if entry.country_code.lower() not in country_codes:
|
||||
continue
|
||||
if only_show:
|
||||
if brief_search is not None:
|
||||
if brief_search:
|
||||
if inverse:
|
||||
if brief_search.lower() in entry.country_code.lower():
|
||||
continue
|
||||
else:
|
||||
if brief_search.lower() not in entry.country_code.lower():
|
||||
continue
|
||||
print(
|
||||
f"{entry.country_code}: {sum(map(lambda record: not domain_types or record.type in domain_types, getattr(entry, list_name, None)))}"
|
||||
)
|
||||
@@ -91,22 +98,22 @@ def main(args):
|
||||
input_files = getattr(args, 'input', [])
|
||||
output = getattr(args, 'output', None)
|
||||
|
||||
if getattr(args, 'show', False):
|
||||
if (search := getattr(args, 'brief', None)) is not None:
|
||||
load_resource(
|
||||
input_files,
|
||||
getattr(args, 'country', []),
|
||||
getattr(args, 'inverse', False),
|
||||
getattr(args, 'data_type', None),
|
||||
dat_files=input_files,
|
||||
countries=getattr(args, 'country', []),
|
||||
inverse=getattr(args, 'inverse', False),
|
||||
data_type=getattr(args, 'data_type', None),
|
||||
domain_types=getattr(args, 'domain_types', None),
|
||||
only_show=True,
|
||||
brief_search=search,
|
||||
)
|
||||
sys.exit(0)
|
||||
|
||||
data_list = load_resource(
|
||||
input_files,
|
||||
getattr(args, 'country', []),
|
||||
getattr(args, 'inverse', False),
|
||||
getattr(args, 'data_type', None),
|
||||
dat_files=input_files,
|
||||
countries=getattr(args, 'country', []),
|
||||
inverse=getattr(args, 'inverse', False),
|
||||
data_type=getattr(args, 'data_type', None),
|
||||
formatter=getattr(args, 'formatter', None),
|
||||
domain_types=getattr(args, 'domain_types', None),
|
||||
)
|
||||
@@ -164,7 +171,12 @@ if __name__ == '__main__':
|
||||
help='inverse match country code',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--show', action='store_true', help='show brief info about input'
|
||||
'-b',
|
||||
'--brief',
|
||||
type=str,
|
||||
const='',
|
||||
nargs='?',
|
||||
help='show brief info about specified keyword',
|
||||
)
|
||||
parser.add_argument('-o', '--output', type=Path, help='output file to write')
|
||||
parser.add_argument(
|
||||
|
||||
Reference in new issue
Block a user