Skip to content

Commit

Permalink
remove iran.dat
Browse files Browse the repository at this point in the history
so after this you need to click on "reset to default configuration"
  • Loading branch information
MHSanaei committed Oct 18, 2023
1 parent c0ef791 commit b0aaece
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 76 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ jobs:
unzip Xray-linux-arm64-v8a.zip
rm -f Xray-linux-arm64-v8a.zip
fi
rm -f geoip.dat geosite.dat iran.dat
rm -f geoip.dat geosite.dat geoip_IR.dat geosite_IR.dat
wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
wget -O geoip_ch.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
wget -O geosite_ch.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
wget https://github.com/MasterKia/iran-hosted-domains/releases/latest/download/iran.dat
wget -O geoip_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
wget -O geosite_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
mv xray xray-linux-${{ matrix.platform }}
cd ../..
Expand Down
7 changes: 3 additions & 4 deletions DockerInit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ cd build/bin

wget "https://github.com/XTLS/Xray-core/releases/download/v1.8.4/Xray-linux-${ARCH}.zip"
unzip "Xray-linux-${ARCH}.zip"
rm -f "Xray-linux-${ARCH}.zip" geoip.dat geosite.dat iran.dat
rm -f "Xray-linux-${ARCH}.zip" geoip.dat geosite.dat geoip_IR.dat geosite_IR.dat
mv xray "xray-linux-${FNAME}"

wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
wget -O geoip_ch.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
wget -O geosite_ch.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
wget "https://github.com/MasterKia/iran-hosted-domains/releases/latest/download/iran.dat"
wget -O geoip_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
wget -O geosite_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
4 changes: 1 addition & 3 deletions media/configs/traffic+block-ads+ipv4-google.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"log": {
"loglevel": "warning",
"access": "./access.log",
"error": "./error.log"
},
"api": {
Expand Down Expand Up @@ -81,8 +80,7 @@
"type": "field",
"outboundTag": "blocked",
"domain": [
"geosite:category-ads-all",
"ext:iran.dat:ads"
"ext:geosite_IR.dat:category-ads-all"
]
},
{
Expand Down
4 changes: 1 addition & 3 deletions media/configs/traffic+block-ads+warp.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"log": {
"loglevel": "warning",
"access": "./access.log",
"error": "./error.log"
},
"api": {
Expand Down Expand Up @@ -86,8 +85,7 @@
"type": "field",
"outboundTag": "blocked",
"domain": [
"geosite:category-ads-all",
"ext:iran.dat:ads"
"ext:geosite_IR.dat:category-ads-all"
]
},
{
Expand Down
6 changes: 2 additions & 4 deletions media/configs/traffic+block-iran-domains.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"log": {
"loglevel": "warning",
"access": "./access.log",
"error": "./error.log"
},
"api": {
Expand Down Expand Up @@ -75,9 +74,8 @@
"outboundTag": "blocked",
"domain": [
"regexp:.*\\.ir$",
"ext:iran.dat:ir",
"ext:iran.dat:other",
"geosite:category-ir"
"regexp:.*\\.xn--mgba3a4f16a$",
"ext:geosite_IR.dat:ir"
]
}
]
Expand Down
3 changes: 1 addition & 2 deletions media/configs/traffic+block-iran-ip.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"log": {
"loglevel": "warning",
"access": "./access.log",
"error": "./error.log"
},
"api": {
Expand Down Expand Up @@ -61,7 +60,7 @@
"outboundTag": "blocked",
"ip": [
"geoip:private",
"geoip:ir"
"ext:geoip_IR.dat:ir"
]
},
{
Expand Down
1 change: 0 additions & 1 deletion media/configs/traffic.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"log": {
"loglevel": "warning",
"access": "./access.log",
"error": "./error.log"
},
"api": {
Expand Down
10 changes: 3 additions & 7 deletions web/html/xui/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,12 @@ <h2 class="alert-msg">
ips: {
local: ["geoip:private"],
cn: ["geoip:cn"],
ir: ["geoip:ir","ext:geoip_ch.dat:arvancloud","ext:geoip_ch.dat:derakcloud","ext:geoip_ch.dat:iranserver"],
ir: ["ext:geoip_IR.dat:ir","ext:geoip_IR.dat:arvancloud","ext:geoip_IR.dat:derakcloud","ext:geoip_IR.dat:iranserver"],
ru: ["geoip:ru"],
},
domains: {
ads: [
"geosite:category-ads-all",
"ext:iran.dat:ads",
"ext:geosite_ch.dat:ads"
"ext:geosite_IR.dat:category-ads-all"
],
speedtest: ["geosite:speedtest"],
openai: ["geosite:openai"],
Expand All @@ -497,9 +495,7 @@ <h2 class="alert-msg">
ir: [
"regexp:.*\\.ir$",
"regexp:.*\\.xn--mgba3a4f16a$", // .ایران
"ext:iran.dat:ir",
"ext:iran.dat:other",
"geosite:category-ir"
"ext:geosite_IR.dat:ir" // have rules to bypass all .ir domains.
]
},
familyProtectDNS: {
Expand Down
1 change: 0 additions & 1 deletion web/service/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"log": {
"loglevel": "warning",
"access": "./access.log",
"error": "./error.log"
},
"api": {
Expand Down
47 changes: 9 additions & 38 deletions web/service/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,50 +376,21 @@ func (s *ServerService) UpdateXray(version string) error {
return err
}

downloadFile := func(fileName string, url string) error {
os.Remove(fileName)
file, err := os.OpenFile(fileName, os.O_CREATE|os.O_RDWR|os.O_TRUNC, fs.ModePerm)
if err != nil {
return err
}
defer file.Close()
resp, err := http.Get(url)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("download file failed: %s", resp.Status)
}
_, err = io.Copy(file, resp.Body)
err = copyZipFile("xray", xray.GetBinaryPath())
if err != nil {
return err
}

copyFiles := map[string]string{
"xray": xray.GetBinaryPath(),
"geosite.dat": xray.GetGeositePath(),
"geoip.dat": xray.GetGeoipPath(),
}

downloadFiles := map[string]string{
xray.GetIranPath(): "https://github.com/MasterKia/iran-hosted-domains/releases/latest/download/iran.dat",
}

for fileName, filePath := range copyFiles {
err := copyZipFile(fileName, filePath)
if err != nil {
return err
}
err = copyZipFile("geosite.dat", xray.GetGeositePath())
if err != nil {
return err
}

for fileName, filePath := range downloadFiles {
err := downloadFile(fileName, filePath)
if err != nil {
return err
}
err = copyZipFile("geoip.dat", xray.GetGeoipPath())
if err != nil {
return err
}

return nil

}

func (s *ServerService) GetLogs(count string, level string, syslog string) []string {
Expand Down
9 changes: 4 additions & 5 deletions x-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -519,14 +519,13 @@ update_geo() {

systemctl stop x-ui
cd ${binFolder}
rm -f geoip.dat geosite.dat iran.dat
rm -f geoip.dat geosite.dat geoip_IR.dat geosite_IR.dat
wget -N https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
wget -N https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
wget -O geoip_ch.dat -N https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
wget -O geosite_ch.dat -N https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
wget -N https://github.com/MasterKia/iran-hosted-domains/releases/latest/download/iran.dat
wget -O geoip_IR.dat -N https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
wget -O geosite_IR.dat -N https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
systemctl start x-ui
echo -e "${green}Geosite.dat + Geoip.dat + Iran.dat have been updated successfully in bin folder '${binfolder}'!${plain}"
echo -e "${green}Geosite.dat + Geoip.dat + geoip_IR.dat + geosite_IR.dat have been updated successfully in bin folder '${binfolder}'!${plain}"
before_show_menu
}

Expand Down
4 changes: 0 additions & 4 deletions xray/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ func GetGeoipPath() string {
return config.GetBinFolderPath() + "/geoip.dat"
}

func GetIranPath() string {
return config.GetBinFolderPath() + "/iran.dat"
}

func GetIPLimitLogPath() string {
return config.GetLogFolder() + "/3xipl.log"
}
Expand Down

0 comments on commit b0aaece

Please sign in to comment.