mirror of
https://github.com/darkclip/netlist.git
synced 2026-12-06 20:58:56 +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
|
- name: Rebuild target branch
|
||||||
run: |
|
run: |
|
||||||
cp mosdns/config.yml target/config.yml
|
cp mosdns/config.yml target/config.yml
|
||||||
./raydata.py ref/geoip.dat -c cn -o target/rule/chinaip.txt geoip
|
./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 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
|
./raydata.py ref/geosite.dat -c BING -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
|
||||||
touch target/rule/hosts.txt
|
./raydata.py ref/geosite.dat -c ALIBABA -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
|
||||||
touch target/rule/whitelist.txt
|
./raydata.py ref/geosite.dat -c ALIBABACLOUD -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
|
||||||
touch target/rule/greylist.txt
|
./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
|
mkdir target/tmp
|
||||||
cd target
|
cd target
|
||||||
tar -cf mosdns.tar tmp rule *.yml
|
tar -cf mosdns.tar tmp rule *.yml
|
||||||
|
|||||||
+27
-15
@@ -30,12 +30,12 @@ def init_protobuf(data_type: str = None) -> tuple:
|
|||||||
|
|
||||||
|
|
||||||
def load_resource(
|
def load_resource(
|
||||||
|
*,
|
||||||
dat_files: typing.List[Path],
|
dat_files: typing.List[Path],
|
||||||
countries: typing.List[str],
|
countries: typing.List[str],
|
||||||
inverse: bool = False,
|
inverse: bool = False,
|
||||||
data_type: str = None,
|
data_type: str | None = None,
|
||||||
*,
|
brief_search: str | None = None,
|
||||||
only_show: bool = False,
|
|
||||||
domain_types: typing.List[int] | None = None,
|
domain_types: typing.List[int] | None = None,
|
||||||
formatter: Path | None = None,
|
formatter: Path | None = None,
|
||||||
) -> list:
|
) -> list:
|
||||||
@@ -59,7 +59,14 @@ def load_resource(
|
|||||||
else:
|
else:
|
||||||
if entry.country_code.lower() not in country_codes:
|
if entry.country_code.lower() not in country_codes:
|
||||||
continue
|
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(
|
print(
|
||||||
f"{entry.country_code}: {sum(map(lambda record: not domain_types or record.type in domain_types, getattr(entry, list_name, None)))}"
|
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', [])
|
input_files = getattr(args, 'input', [])
|
||||||
output = getattr(args, 'output', None)
|
output = getattr(args, 'output', None)
|
||||||
|
|
||||||
if getattr(args, 'show', False):
|
if (search := getattr(args, 'brief', None)) is not None:
|
||||||
load_resource(
|
load_resource(
|
||||||
input_files,
|
dat_files=input_files,
|
||||||
getattr(args, 'country', []),
|
countries=getattr(args, 'country', []),
|
||||||
getattr(args, 'inverse', False),
|
inverse=getattr(args, 'inverse', False),
|
||||||
getattr(args, 'data_type', None),
|
data_type=getattr(args, 'data_type', None),
|
||||||
domain_types=getattr(args, 'domain_types', None),
|
domain_types=getattr(args, 'domain_types', None),
|
||||||
only_show=True,
|
brief_search=search,
|
||||||
)
|
)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
data_list = load_resource(
|
data_list = load_resource(
|
||||||
input_files,
|
dat_files=input_files,
|
||||||
getattr(args, 'country', []),
|
countries=getattr(args, 'country', []),
|
||||||
getattr(args, 'inverse', False),
|
inverse=getattr(args, 'inverse', False),
|
||||||
getattr(args, 'data_type', None),
|
data_type=getattr(args, 'data_type', None),
|
||||||
formatter=getattr(args, 'formatter', None),
|
formatter=getattr(args, 'formatter', None),
|
||||||
domain_types=getattr(args, 'domain_types', None),
|
domain_types=getattr(args, 'domain_types', None),
|
||||||
)
|
)
|
||||||
@@ -164,7 +171,12 @@ if __name__ == '__main__':
|
|||||||
help='inverse match country code',
|
help='inverse match country code',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
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('-o', '--output', type=Path, help='output file to write')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|||||||
Reference in new issue
Block a user