Skip to content

Commit

Permalink
gfwlist & chinalist: remove root domain (#46)
Browse files Browse the repository at this point in the history
Related: #44 and #45.
  • Loading branch information
pexcn committed May 29, 2020
1 parent 48eaff4 commit b031ec2
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 248 deletions.
4 changes: 0 additions & 4 deletions scripts/_post_/02-tldlist.sh

This file was deleted.

46 changes: 0 additions & 46 deletions scripts/_post_/03-root-domain.sh

This file was deleted.

64 changes: 0 additions & 64 deletions scripts/_pre_/02-tldlist.sh

This file was deleted.

13 changes: 2 additions & 11 deletions scripts/chinalist/chinalist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@ TMP_DIR=$(mktemp -d /tmp/chinalist.XXXXXX)
SRC_URL_1="https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf"
SRC_URL_2="https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf"
SRC_URL_3="https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf"
SRC_FILE_1="$CUR_DIR/dist/toplist/toplist.txt"
SRC_FILE_2="$CUR_DIR/dist/tldlist/tldlist.txt"
SRC_FILE="$CUR_DIR/dist/toplist/toplist.txt"
DEST_FILE_1="dist/chinalist/chinalist.txt"
DEST_FILE_2="dist/chinalist/chinalist-lite.txt"
DEST_FILE_3="dist/chinalist/chinalist-root.txt"

fetch_src() {
cd $TMP_DIR

curl -sSL $SRC_URL_1 -o apple.conf
curl -sSL $SRC_URL_2 -o google.conf
curl -sSL $SRC_URL_3 -o china.conf
cp $SRC_FILE_1 .
cp $SRC_FILE_2 .
cp $SRC_FILE .

cd $CUR_DIR
}
Expand Down Expand Up @@ -50,18 +47,12 @@ gen_list() {
# lite version
cat chinalist_head.tmp > chinalist-lite.txt

# root domain version
local tlds_regex=$(cat tldlist.txt | tr '\n' '|' | sed '$ s/.$//')
local root_domain_regex="([^\.]+)\.($tlds_regex)$"
grep -Po $root_domain_regex chinalist.txt | awk '!x[$0]++' > chinalist-root.txt

cd $CUR_DIR
}

copy_dest() {
install -D -m 644 $TMP_DIR/chinalist.txt $DEST_FILE_1
install -D -m 644 $TMP_DIR/chinalist-lite.txt $DEST_FILE_2
install -D -m 644 $TMP_DIR/chinalist-root.txt $DEST_FILE_3
}

clean_up() {
Expand Down
17 changes: 4 additions & 13 deletions scripts/gfwlist/gfwlist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ TMP_DIR=$(mktemp -d /tmp/gfwlist.XXXXXX)

SRC_URL_1="https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt"
SRC_URL_2="https://raw.githubusercontent.com/pexcn/gfwlist-extras/master/gfwlist-extras.txt"
SRC_FILE_1="$CUR_DIR/dist/toplist/toplist.txt"
SRC_FILE_2="$CUR_DIR/dist/tldlist/tldlist.txt"
DEST_FILE_1="dist/gfwlist/gfwlist.txt"
DEST_FILE_2="dist/gfwlist/gfwlist-root.txt"
SRC_FILE="$CUR_DIR/dist/toplist/toplist.txt"
DEST_FILE="dist/gfwlist/gfwlist.txt"

fetch_src() {
cd $TMP_DIR

curl -sSL $SRC_URL_1 | base64 -d > gfwlist-plain.txt
curl -sSL $SRC_URL_2 -o gfwlist-extras.txt
cp $SRC_FILE_1 .
cp $SRC_FILE_2 .
cp $SRC_FILE .

cd $CUR_DIR
}
Expand Down Expand Up @@ -50,17 +47,11 @@ gen_list() {
# merge to gfwlist
cat gfwlist_head.tmp gfwlist_tail.tmp > gfwlist.txt

# root domain version
local tlds_regex=$(cat tldlist.txt | tr '\n' '|' | sed '$ s/.$//')
local root_domain_regex="([^\.]+)\.($tlds_regex)$"
grep -Po $root_domain_regex gfwlist.txt | awk '!x[$0]++' > gfwlist-root.txt

cd $CUR_DIR
}

copy_dest() {
install -D -m 644 $TMP_DIR/gfwlist.txt $DEST_FILE_1
install -D -m 644 $TMP_DIR/gfwlist-root.txt $DEST_FILE_2
install -D -m 644 $TMP_DIR/gfwlist.txt $DEST_FILE
}

clean_up() {
Expand Down
110 changes: 0 additions & 110 deletions template/tld-extras.txt

This file was deleted.

0 comments on commit b031ec2

Please sign in to comment.