From 9ad5f9fd0da0f03be79c572bbc9de40a563d0e90 Mon Sep 17 00:00:00 2001 From: Loyalsoldier Date: Sun, 15 Dec 2019 18:14:44 +0800 Subject: [PATCH] Remove repeat domains --- .github/workflows/build.yml | 77 ++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 935b591..304c159 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: - cron: "0 19 * * *" push: branches: - - master + - master jobs: build: @@ -25,6 +25,8 @@ jobs: echo "::set-env name=NC::\033[0m" echo "::set-env name=GEOIP_REPO::github.com/v2ray/geoip" echo "::set-env name=GEOSITE_REPO::github.com/v2ray/domain-list-community" + echo "::set-env name=GOOGLE_URL::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf" + echo "::set-env name=APPLE_URL::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf" echo "::set-env name=GFWLIST_URL::https://cokebar.github.io/gfwlist2dnsmasq/gfwlist_domain.txt" echo "::set-env name=Profiles_URL::https://raw.githubusercontent.com/ConnersHua/Profiles/master/Shadow/Pro.conf" echo "::set-env name=Blocked_DOMAINS_URL::https://raw.githubusercontent.com/wongsyrone/domain-block-list/master/domains.txt" @@ -50,35 +52,40 @@ jobs: run: | go get -u -v -insecure $GEOSITE_REPO - - name: Get and add gfwlist into geolocation-!cn + - name: Get and add gfwlist into temp-proxy.txt file run: | - cd $GOPATH/src/$GEOSITE_REPO/data - curl -sSL $GFWLIST_URL > gfwlist - echo "include:gfwlist" >> geolocation-\!cn + cd $GOPATH/src/$GEOSITE_REPO + curl -sSL $GFWLIST_URL > temp-proxy.txt + + - name: Get and add google domains into temp-proxy.txt file + run: | + cd $GOPATH/src/$GEOSITE_REPO + curl -sSL $GOOGLE_URL >> temp-proxy.txt - - name: Get and add proxy domains from @ConnersHua/Profiles into geolocation-!cn + - name: Get and add apple domains into temp-proxy.txt file run: | - cd $GOPATH/src/$GEOSITE_REPO/data - curl -sSL $Profiles_URL | awk '/^DOMAIN.+PROXY/' | cut -d ',' -f 2 > profileproxy - echo "include:profileproxy" >> geolocation-\!cn + cd $GOPATH/src/$GEOSITE_REPO + curl -sSL $APPLE_URL >> temp-proxy.txt + + - name: Get and add proxy domains from @ConnersHua/Profiles into temp-proxy.txt file + run: | + cd $GOPATH/src/$GEOSITE_REPO + curl -sSL $Profiles_URL | awk '/^DOMAIN.+PROXY/' | cut -d ',' -f 2 >> temp-proxy.txt - - name: Get and add blocked domains from @wongsyrone/domain-block-list into geolocation-!cn + - name: Get and add blocked domains from @wongsyrone/domain-block-list into temp-proxy.txt file run: | - cd $GOPATH/src/$GEOSITE_REPO/data - curl -sSL $Blocked_DOMAINS_URL > blockedlist - echo "include:blockedlist" >> geolocation-\!cn + cd $GOPATH/src/$GEOSITE_REPO + curl -sSL $Blocked_DOMAINS_URL >> temp-proxy.txt - - name: Get and add direct domains from @ConnersHua/Profiles into cn + - name: Get and add direct domains from @ConnersHua/Profiles into temp-direct.txt file run: | - cd $GOPATH/src/$GEOSITE_REPO/data - curl -sSL $Profiles_URL | awk '/^DOMAIN.+DIRECT/' | cut -d ',' -f 2 > profiledirect - echo "include:profiledirect" >> cn + cd $GOPATH/src/$GEOSITE_REPO + curl -sSL $Profiles_URL | awk '/^DOMAIN.+DIRECT/' | cut -d ',' -f 2 > temp-direct.txt - - name: Get and add chinalist into cn + - name: Get and add chinalist into temp-direct.txt file run: | - cd $GOPATH/src/$GEOSITE_REPO/data - curl -sSL $CHINA_DOMAINS_URL | awk -F '/' '{print $2}' > chinalist - echo "include:chinalist" >> cn + cd $GOPATH/src/$GEOSITE_REPO + curl -sSL $CHINA_DOMAINS_URL | awk -F '/' '{print $2}' >> temp-direct.txt - name: Get and add reject domains from @ConnersHua/Profiles into category-ads-all run: | @@ -86,6 +93,17 @@ jobs: curl -sSL $Profiles_URL | awk '/^DOMAIN.+REJECT/' | cut -d ',' -f 2 > profilereject echo "include:profilereject" >> category-ads-all + - name: Remove repeated domains and write domains to new lists + run: | + cd $GOPATH/src/$GEOSITE_REPO + cat temp-proxy.txt | sort --ignore-case -u > ./data/proxylist + cat temp-direct.txt | sort --ignore-case -u > ./data/directlist + + - name: Add lists into appropriate category + run: | + echo "include:proxylist" >> geolocation-\!cn + echo "include:directlist" >> cn + - name: Build geosite.dat file run: | domain-list-community @@ -93,32 +111,37 @@ jobs: - name: List above process results run: | - echo ">>>>>>>>>>>>>>>>>>>>>>>>" + echo "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}" + + echo "list files in geosite folder" + ls -lah $GOPATH/src/$GEOSITE_REPO + + echo "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}" echo "list files in data folder" ls -lah $GOPATH/src/$GEOSITE_REPO/data - echo ">>>>>>>>>>>>>>>>>>>>>>>>" + echo "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}" echo "list last 10 lines of cn file" tail -n 10 $GOPATH/src/$GEOSITE_REPO/data/cn - echo ">>>>>>>>>>>>>>>>>>>>>>>>" + echo "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}" echo "list last 10 lines of geolocation-!cn file" tail -n 10 $GOPATH/src/$GEOSITE_REPO/data/geolocation-\!cn - echo ">>>>>>>>>>>>>>>>>>>>>>>>" + echo "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}" echo "list last 10 lines of category-ads-all file" tail -n 10 $GOPATH/src/$GEOSITE_REPO/data/category-ads-all - echo ">>>>>>>>>>>>>>>>>>>>>>>>" + echo "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}" echo "list files in publish folder" ls -lah ./publish - echo ">>>>>>>>>>>>>>>>>>>>>>>>" + echo "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}" echo -e "${GREEN}完成啦!🌈${NC}"