Browse Source

auto update script executed

Toby Chui 1 year ago
parent
commit
3dc24ddbc2
100 changed files with 656 additions and 50 deletions
  1. 2 2
      main.go
  2. 13 0
      mod/geodb/clean.py
  3. 17 0
      mod/geodb/codebuild.py
  4. 36 0
      mod/geodb/convert.py
  5. 24 48
      mod/geodb/geodb.go
  6. 261 0
      mod/geodb/geodb.go_backup
  7. 50 0
      mod/geodb/geodb_test.go
  8. 8 0
      mod/geodb/geoip/1/0.txt
  9. 5 0
      mod/geodb/geoip/1/1.txt
  10. 4 0
      mod/geodb/geoip/1/10.txt
  11. 1 0
      mod/geodb/geoip/1/11.txt
  12. 1 0
      mod/geodb/geoip/1/112.txt
  13. 1 0
      mod/geodb/geoip/1/116.txt
  14. 1 0
      mod/geodb/geoip/1/118.txt
  15. 1 0
      mod/geodb/geoip/1/119.txt
  16. 1 0
      mod/geodb/geoip/1/12.txt
  17. 1 0
      mod/geodb/geoip/1/120.txt
  18. 1 0
      mod/geodb/geoip/1/16.txt
  19. 1 0
      mod/geodb/geoip/1/160.txt
  20. 1 0
      mod/geodb/geoip/1/176.txt
  21. 9 0
      mod/geodb/geoip/1/178.txt
  22. 9 0
      mod/geodb/geoip/1/179.txt
  23. 1 0
      mod/geodb/geoip/1/180.txt
  24. 1 0
      mod/geodb/geoip/1/186.txt
  25. 1 0
      mod/geodb/geoip/1/188.txt
  26. 4 0
      mod/geodb/geoip/1/2.txt
  27. 1 0
      mod/geodb/geoip/1/20.txt
  28. 1 0
      mod/geodb/geoip/1/200.txt
  29. 1 0
      mod/geodb/geoip/1/201.txt
  30. 1 0
      mod/geodb/geoip/1/202.txt
  31. 1 0
      mod/geodb/geoip/1/208.txt
  32. 1 0
      mod/geodb/geoip/1/21.txt
  33. 1 0
      mod/geodb/geoip/1/22.txt
  34. 1 0
      mod/geodb/geoip/1/24.txt
  35. 1 0
      mod/geodb/geoip/1/3.txt
  36. 23 0
      mod/geodb/geoip/1/32.txt
  37. 1 0
      mod/geodb/geoip/1/33.txt
  38. 1 0
      mod/geodb/geoip/1/34.txt
  39. 1 0
      mod/geodb/geoip/1/36.txt
  40. 1 0
      mod/geodb/geoip/1/37.txt
  41. 1 0
      mod/geodb/geoip/1/38.txt
  42. 3 0
      mod/geodb/geoip/1/4.txt
  43. 1 0
      mod/geodb/geoip/1/40.txt
  44. 1 0
      mod/geodb/geoip/1/45.txt
  45. 1 0
      mod/geodb/geoip/1/46.txt
  46. 1 0
      mod/geodb/geoip/1/48.txt
  47. 1 0
      mod/geodb/geoip/1/5.txt
  48. 1 0
      mod/geodb/geoip/1/52.txt
  49. 1 0
      mod/geodb/geoip/1/56.txt
  50. 1 0
      mod/geodb/geoip/1/6.txt
  51. 1 0
      mod/geodb/geoip/1/64.txt
  52. 1 0
      mod/geodb/geoip/1/66.txt
  53. 1 0
      mod/geodb/geoip/1/68.txt
  54. 1 0
      mod/geodb/geoip/1/72.txt
  55. 1 0
      mod/geodb/geoip/1/8.txt
  56. 1 0
      mod/geodb/geoip/1/80.txt
  57. 1 0
      mod/geodb/geoip/1/9.txt
  58. 1 0
      mod/geodb/geoip/1/96.txt
  59. 1 0
      mod/geodb/geoip/100/0.txt
  60. 1 0
      mod/geodb/geoip/100/128.txt
  61. 1 0
      mod/geodb/geoip/100/42.txt
  62. 3 0
      mod/geodb/geoip/100/43.txt
  63. 11 0
      mod/geodb/geoip/101/0.txt
  64. 5 0
      mod/geodb/geoip/101/1.txt
  65. 2 0
      mod/geodb/geoip/101/100.txt
  66. 6 0
      mod/geodb/geoip/101/101.txt
  67. 7 0
      mod/geodb/geoip/101/102.txt
  68. 1 0
      mod/geodb/geoip/101/103.txt
  69. 1 0
      mod/geodb/geoip/101/104.txt
  70. 1 0
      mod/geodb/geoip/101/108.txt
  71. 5 0
      mod/geodb/geoip/101/110.txt
  72. 1 0
      mod/geodb/geoip/101/112.txt
  73. 1 0
      mod/geodb/geoip/101/120.txt
  74. 1 0
      mod/geodb/geoip/101/127.txt
  75. 5 0
      mod/geodb/geoip/101/128.txt
  76. 1 0
      mod/geodb/geoip/101/129.txt
  77. 1 0
      mod/geodb/geoip/101/136.txt
  78. 1 0
      mod/geodb/geoip/101/140.txt
  79. 1 0
      mod/geodb/geoip/101/144.txt
  80. 1 0
      mod/geodb/geoip/101/16.txt
  81. 1 0
      mod/geodb/geoip/101/160.txt
  82. 7 0
      mod/geodb/geoip/101/167.txt
  83. 1 0
      mod/geodb/geoip/101/192.txt
  84. 7 0
      mod/geodb/geoip/101/2.txt
  85. 1 0
      mod/geodb/geoip/101/202.txt
  86. 7 0
      mod/geodb/geoip/101/203.txt
  87. 1 0
      mod/geodb/geoip/101/204.txt
  88. 1 0
      mod/geodb/geoip/101/208.txt
  89. 1 0
      mod/geodb/geoip/101/224.txt
  90. 10 0
      mod/geodb/geoip/101/234.txt
  91. 1 0
      mod/geodb/geoip/101/235.txt
  92. 1 0
      mod/geodb/geoip/101/236.txt
  93. 1 0
      mod/geodb/geoip/101/250.txt
  94. 3 0
      mod/geodb/geoip/101/251.txt
  95. 1 0
      mod/geodb/geoip/101/255.txt
  96. 1 0
      mod/geodb/geoip/101/3.txt
  97. 8 0
      mod/geodb/geoip/101/32.txt
  98. 23 0
      mod/geodb/geoip/101/33.txt
  99. 10 0
      mod/geodb/geoip/101/36.txt
  100. 1 0
      mod/geodb/geoip/101/4.txt

+ 2 - 2
main.go

@@ -31,8 +31,8 @@ import (
 var noauth = flag.Bool("noauth", false, "Disable authentication for management interface")
 var showver = flag.Bool("version", false, "Show version of this server")
 var allowSshLoopback = flag.Bool("sshlb", false, "Allow loopback web ssh connection (DANGER)")
-var ztAuthToken = flag.String("ztauth", "", "Zerotier authtoken for the local node")
-
+var ztAuthToken = flag.String("ztauth", "", "ZeroTier authtoken for the local node")
+var ztAPIPort = flag.Int("ztport", 9993, "ZeroTier controller API port")
 var (
 	name        = "Zoraxy"
 	version     = "2.2"

+ 13 - 0
mod/geodb/clean.py

@@ -0,0 +1,13 @@
+import os
+
+# Define the root directory
+root_dir = "geoip/"
+
+# Loop through all subdirectories in the root directory
+for subdir in os.listdir(root_dir):
+    subdir_path = os.path.join(root_dir, subdir)
+    
+    # Check if the subdirectory contains any txt files
+    if not any(fname.endswith(".txt") for fname in os.listdir(subdir_path)):
+        # If not, remove the subdirectory
+        os.rmdir(subdir_path)

+ 17 - 0
mod/geodb/codebuild.py

@@ -0,0 +1,17 @@
+import csv
+import os
+
+out = open("geoipx.go", "w")
+out.write("package geodb\n\n")
+out.write("func search(ip string) string{\n")
+with open('geoipv4.csv', 'r') as csvfile:
+    csvreader = csv.reader(csvfile)
+    for row in csvreader:
+        start_ip = row[0]
+        end_ip = row[1]
+        country = row[2]
+
+        out.write("if isIPInRange(ip, \"" + start_ip + "\", \"" + end_ip + "\"){\n  return \"" + country + "\"\n}\n")
+
+out.write("return \"\"\n}")
+out.close()

+ 36 - 0
mod/geodb/convert.py

@@ -0,0 +1,36 @@
+import csv
+import os
+
+# Create folders for each first digit of IP address
+for i in range(256):
+    folder_path = f"geoip/{i}"
+    if not os.path.exists(folder_path):
+        os.makedirs(folder_path)
+
+# Read CSV file and create text files
+with open('geoipv4.csv', 'r') as csvfile:
+    csvreader = csv.reader(csvfile)
+    for row in csvreader:
+        start_ip = row[0]
+        end_ip = row[1]
+        country = row[2]
+        first_digit, second_digit, _, _ = start_ip.split(".")
+        file_path = f"geoip/{first_digit}/{second_digit}.txt"
+        if os.path.exists(file_path):
+            append_write = 'a' # append if already exists
+        else:
+            append_write = 'w' # make a new file if not
+        with open(file_path, append_write) as file:
+            file.write(f"{start_ip},{end_ip},{country}\n")
+
+# Clean empty folders
+root_dir = "geoip/"
+
+# Loop through all subdirectories in the root directory
+for subdir in os.listdir(root_dir):
+    subdir_path = os.path.join(root_dir, subdir)
+    
+    # Check if the subdirectory contains any txt files
+    if not any(fname.endswith(".txt") for fname in os.listdir(subdir_path)):
+        # If not, remove the subdirectory
+        os.rmdir(subdir_path)

+ 24 - 48
mod/geodb/geodb.go

@@ -1,23 +1,16 @@
 package geodb
 
 import (
-	"embed"
+	"log"
 	"net"
 	"net/http"
-	"os"
 	"strings"
 
-	"github.com/oschwald/geoip2-golang"
 	"imuslab.com/zoraxy/mod/database"
-	"imuslab.com/zoraxy/mod/utils"
 )
 
-//go:embed GeoLite2-Country.mmdb
-var geodb embed.FS
-
 type Store struct {
 	Enabled bool
-	geodb   *geoip2.Reader
 	sysdb   *database.Database
 }
 
@@ -26,44 +19,32 @@ type CountryInfo struct {
 	ContinetCode   string
 }
 
-func NewGeoDb(sysdb *database.Database, dbfile string) (*Store, error) {
-	if !utils.FileExists(dbfile) {
-		//Unzip it from binary
-		geodbFile, err := geodb.ReadFile("GeoLite2-Country.mmdb")
+func NewGeoDb(sysdb *database.Database) (*Store, error) {
+
+	var err error
+	blacklistEnabled := false
+	if sysdb != nil {
+		err = sysdb.NewTable("blacklist-cn")
 		if err != nil {
 			return nil, err
 		}
-		err = os.WriteFile(dbfile, geodbFile, 0775)
+
+		err = sysdb.NewTable("blacklist-ip")
 		if err != nil {
 			return nil, err
 		}
-	}
-	db, err := geoip2.Open(dbfile)
-	if err != nil {
-		return nil, err
-	}
-
-	err = sysdb.NewTable("blacklist-cn")
-	if err != nil {
-		return nil, err
-	}
-
-	err = sysdb.NewTable("blacklist-ip")
-	if err != nil {
-		return nil, err
-	}
 
-	err = sysdb.NewTable("blacklist")
-	if err != nil {
-		return nil, err
+		err = sysdb.NewTable("blacklist")
+		if err != nil {
+			return nil, err
+		}
+		sysdb.Read("blacklist", "enabled", &blacklistEnabled)
+	} else {
+		log.Println("Database pointer set to nil: Entering debug mode")
 	}
 
-	blacklistEnabled := false
-	sysdb.Read("blacklist", "enabled", &blacklistEnabled)
-
 	return &Store{
 		Enabled: blacklistEnabled,
-		geodb:   db,
 		sysdb:   sysdb,
 	}, nil
 }
@@ -74,20 +55,15 @@ func (s *Store) ToggleBlacklist(enabled bool) {
 }
 
 func (s *Store) ResolveCountryCodeFromIP(ipstring string) (*CountryInfo, error) {
-	// If you are using strings that may be invalid, check that ip is not nil
-	ip := net.ParseIP(ipstring)
-	record, err := s.geodb.City(ip)
-	if err != nil {
-		return nil, err
-	}
+	cc := search(ipstring)
 	return &CountryInfo{
-		record.Country.IsoCode,
-		record.Continent.Code,
+		CountryIsoCode: cc,
+		ContinetCode:   "",
 	}, nil
 }
 
 func (s *Store) Close() {
-	s.geodb.Close()
+
 }
 
 func (s *Store) AddCountryCodeToBlackList(countryCode string) {
@@ -168,7 +144,7 @@ func (s *Store) GetAllBlacklistedIp() []string {
 	return bannedIps
 }
 
-//Check if a IP address is blacklisted, in either country or IP blacklist
+// Check if a IP address is blacklisted, in either country or IP blacklist
 func (s *Store) IsBlacklisted(ipAddr string) bool {
 	if !s.Enabled {
 		//Blacklist not enabled. Always return false
@@ -209,7 +185,7 @@ func (s *Store) GetRequesterCountryISOCode(r *http.Request) string {
 	return countryCode.CountryIsoCode
 }
 
-//Utilities function
+// Utilities function
 func GetRequesterIP(r *http.Request) string {
 	ip := r.Header.Get("X-Forwarded-For")
 	if ip == "" {
@@ -221,7 +197,7 @@ func GetRequesterIP(r *http.Request) string {
 	return ip
 }
 
-//Match the IP address with a wildcard string
+// Match the IP address with a wildcard string
 func MatchIpWildcard(ipAddress, wildcard string) bool {
 	// Split IP address and wildcard into octets
 	ipOctets := strings.Split(ipAddress, ".")
@@ -245,7 +221,7 @@ func MatchIpWildcard(ipAddress, wildcard string) bool {
 	return true
 }
 
-//Match ip address with CIDR
+// Match ip address with CIDR
 func MatchIpCIDR(ip string, cidr string) bool {
 	// parse the CIDR string
 	_, cidrnet, err := net.ParseCIDR(cidr)

+ 261 - 0
mod/geodb/geodb.go_backup

@@ -0,0 +1,261 @@
+package geodb
+
+import (
+	"embed"
+	"net"
+	"net/http"
+	"os"
+	"strings"
+
+	"github.com/oschwald/geoip2-golang"
+	"imuslab.com/zoraxy/mod/database"
+	"imuslab.com/zoraxy/mod/utils"
+)
+
+//go:embed GeoLite2-Country.mmdb
+var geodb embed.FS
+
+type Store struct {
+	Enabled bool
+	geodb   *geoip2.Reader
+	sysdb   *database.Database
+}
+
+type CountryInfo struct {
+	CountryIsoCode string
+	ContinetCode   string
+}
+
+func NewGeoDb(sysdb *database.Database, dbfile string) (*Store, error) {
+	if !utils.FileExists(dbfile) {
+		//Unzip it from binary
+		geodbFile, err := geodb.ReadFile("GeoLite2-Country.mmdb")
+		if err != nil {
+			return nil, err
+		}
+		err = os.WriteFile(dbfile, geodbFile, 0775)
+		if err != nil {
+			return nil, err
+		}
+	}
+	db, err := geoip2.Open(dbfile)
+	if err != nil {
+		return nil, err
+	}
+
+	err = sysdb.NewTable("blacklist-cn")
+	if err != nil {
+		return nil, err
+	}
+
+	err = sysdb.NewTable("blacklist-ip")
+	if err != nil {
+		return nil, err
+	}
+
+	err = sysdb.NewTable("blacklist")
+	if err != nil {
+		return nil, err
+	}
+
+	blacklistEnabled := false
+	sysdb.Read("blacklist", "enabled", &blacklistEnabled)
+
+	return &Store{
+		Enabled: blacklistEnabled,
+		geodb:   db,
+		sysdb:   sysdb,
+	}, nil
+}
+
+func (s *Store) ToggleBlacklist(enabled bool) {
+	s.sysdb.Write("blacklist", "enabled", enabled)
+	s.Enabled = enabled
+}
+
+func (s *Store) ResolveCountryCodeFromIP(ipstring string) (*CountryInfo, error) {
+	// If you are using strings that may be invalid, check that ip is not nil
+	ip := net.ParseIP(ipstring)
+	record, err := s.geodb.City(ip)
+	if err != nil {
+		return nil, err
+	}
+	return &CountryInfo{
+		record.Country.IsoCode,
+		record.Continent.Code,
+	}, nil
+}
+
+func (s *Store) Close() {
+	s.geodb.Close()
+}
+
+func (s *Store) AddCountryCodeToBlackList(countryCode string) {
+	countryCode = strings.ToLower(countryCode)
+	s.sysdb.Write("blacklist-cn", countryCode, true)
+}
+
+func (s *Store) RemoveCountryCodeFromBlackList(countryCode string) {
+	countryCode = strings.ToLower(countryCode)
+	s.sysdb.Delete("blacklist-cn", countryCode)
+}
+
+func (s *Store) IsCountryCodeBlacklisted(countryCode string) bool {
+	countryCode = strings.ToLower(countryCode)
+	var isBlacklisted bool = false
+	s.sysdb.Read("blacklist-cn", countryCode, &isBlacklisted)
+	return isBlacklisted
+}
+
+func (s *Store) GetAllBlacklistedCountryCode() []string {
+	bannedCountryCodes := []string{}
+	entries, err := s.sysdb.ListTable("blacklist-cn")
+	if err != nil {
+		return bannedCountryCodes
+	}
+	for _, keypairs := range entries {
+		ip := string(keypairs[0])
+		bannedCountryCodes = append(bannedCountryCodes, ip)
+	}
+
+	return bannedCountryCodes
+}
+
+func (s *Store) AddIPToBlackList(ipAddr string) {
+	s.sysdb.Write("blacklist-ip", ipAddr, true)
+}
+
+func (s *Store) RemoveIPFromBlackList(ipAddr string) {
+	s.sysdb.Delete("blacklist-ip", ipAddr)
+}
+
+func (s *Store) IsIPBlacklisted(ipAddr string) bool {
+	var isBlacklisted bool = false
+	s.sysdb.Read("blacklist-ip", ipAddr, &isBlacklisted)
+	if isBlacklisted {
+		return true
+	}
+
+	//Check for IP wildcard and CIRD rules
+	AllBlacklistedIps := s.GetAllBlacklistedIp()
+	for _, blacklistRule := range AllBlacklistedIps {
+		wildcardMatch := MatchIpWildcard(ipAddr, blacklistRule)
+		if wildcardMatch {
+			return true
+		}
+
+		cidrMatch := MatchIpCIDR(ipAddr, blacklistRule)
+		if cidrMatch {
+			return true
+		}
+	}
+
+	return false
+}
+
+func (s *Store) GetAllBlacklistedIp() []string {
+	bannedIps := []string{}
+	entries, err := s.sysdb.ListTable("blacklist-ip")
+	if err != nil {
+		return bannedIps
+	}
+
+	for _, keypairs := range entries {
+		ip := string(keypairs[0])
+		bannedIps = append(bannedIps, ip)
+	}
+
+	return bannedIps
+}
+
+//Check if a IP address is blacklisted, in either country or IP blacklist
+func (s *Store) IsBlacklisted(ipAddr string) bool {
+	if !s.Enabled {
+		//Blacklist not enabled. Always return false
+		return false
+	}
+
+	if ipAddr == "" {
+		//Unable to get the target IP address
+		return false
+	}
+
+	countryCode, err := s.ResolveCountryCodeFromIP(ipAddr)
+	if err != nil {
+		return false
+	}
+
+	if s.IsCountryCodeBlacklisted(countryCode.CountryIsoCode) {
+		return true
+	}
+
+	if s.IsIPBlacklisted(ipAddr) {
+		return true
+	}
+
+	return false
+}
+
+func (s *Store) GetRequesterCountryISOCode(r *http.Request) string {
+	ipAddr := GetRequesterIP(r)
+	if ipAddr == "" {
+		return ""
+	}
+	countryCode, err := s.ResolveCountryCodeFromIP(ipAddr)
+	if err != nil {
+		return ""
+	}
+
+	return countryCode.CountryIsoCode
+}
+
+//Utilities function
+func GetRequesterIP(r *http.Request) string {
+	ip := r.Header.Get("X-Forwarded-For")
+	if ip == "" {
+		ip = r.Header.Get("X-Real-IP")
+		if ip == "" {
+			ip = strings.Split(r.RemoteAddr, ":")[0]
+		}
+	}
+	return ip
+}
+
+//Match the IP address with a wildcard string
+func MatchIpWildcard(ipAddress, wildcard string) bool {
+	// Split IP address and wildcard into octets
+	ipOctets := strings.Split(ipAddress, ".")
+	wildcardOctets := strings.Split(wildcard, ".")
+
+	// Check that both have 4 octets
+	if len(ipOctets) != 4 || len(wildcardOctets) != 4 {
+		return false
+	}
+
+	// Check each octet to see if it matches the wildcard or is an exact match
+	for i := 0; i < 4; i++ {
+		if wildcardOctets[i] == "*" {
+			continue
+		}
+		if ipOctets[i] != wildcardOctets[i] {
+			return false
+		}
+	}
+
+	return true
+}
+
+//Match ip address with CIDR
+func MatchIpCIDR(ip string, cidr string) bool {
+	// parse the CIDR string
+	_, cidrnet, err := net.ParseCIDR(cidr)
+	if err != nil {
+		return false
+	}
+
+	// parse the IP address
+	ipAddr := net.ParseIP(ip)
+
+	// check if the IP address is within the CIDR range
+	return cidrnet.Contains(ipAddr)
+}

+ 50 - 0
mod/geodb/geodb_test.go

@@ -0,0 +1,50 @@
+package geodb_test
+
+import (
+	"testing"
+
+	"imuslab.com/zoraxy/mod/geodb"
+)
+
+func TestResolveCountryCodeFromIP(t *testing.T) {
+	// Create a new store
+	store, err := geodb.NewGeoDb(nil)
+	if err != nil {
+		t.Errorf("error creating store: %v", err)
+		return
+	}
+
+	/*
+		result, err := store.Search("7.8.8.8")
+		if err != nil {
+			t.Error(err.Error())
+			return
+		}
+		fmt.Println(">> ", result, err)
+		return
+	*/
+
+	// Test an IP address that should return a valid country code
+	ip := "8.8.8.8"
+	expected := "US"
+	info, err := store.ResolveCountryCodeFromIP(ip)
+	if err != nil {
+		t.Errorf("error resolving country code for IP %s: %v", ip, err)
+		return
+	}
+	if info.CountryIsoCode != expected {
+		t.Errorf("expected country code %s, but got %s for IP %s", expected, info.CountryIsoCode, ip)
+	}
+
+	// Test an IP address that should return an empty country code
+	ip = "127.0.0.1"
+	expected = ""
+	info, err = store.ResolveCountryCodeFromIP(ip)
+	if err != nil {
+		t.Errorf("error resolving country code for IP %s: %v", ip, err)
+		return
+	}
+	if info.CountryIsoCode != expected {
+		t.Errorf("expected country code %s, but got %s for IP %s", expected, info.CountryIsoCode, ip)
+	}
+}

+ 8 - 0
mod/geodb/geoip/1/0.txt

@@ -0,0 +1,8 @@
+1.0.0.0,1.0.0.255,AU
+1.0.1.0,1.0.3.255,CN
+1.0.4.0,1.0.7.255,AU
+1.0.8.0,1.0.15.255,CN
+1.0.16.0,1.0.31.255,JP
+1.0.32.0,1.0.63.255,CN
+1.0.64.0,1.0.127.255,JP
+1.0.128.0,1.0.255.255,TH

+ 5 - 0
mod/geodb/geoip/1/1.txt

@@ -0,0 +1,5 @@
+1.1.0.0,1.1.0.255,CN
+1.1.1.0,1.1.1.255,AU
+1.1.2.0,1.1.63.255,CN
+1.1.64.0,1.1.127.255,JP
+1.1.128.0,1.1.255.255,TH

+ 4 - 0
mod/geodb/geoip/1/10.txt

@@ -0,0 +1,4 @@
+1.10.0.0,1.10.9.255,CN
+1.10.10.0,1.10.10.255,IN
+1.10.11.0,1.10.127.255,CN
+1.10.128.0,1.10.255.255,TH

+ 1 - 0
mod/geodb/geoip/1/11.txt

@@ -0,0 +1 @@
+1.11.0.0,1.11.255.255,KR

+ 1 - 0
mod/geodb/geoip/1/112.txt

@@ -0,0 +1 @@
+1.112.0.0,1.115.255.255,JP

+ 1 - 0
mod/geodb/geoip/1/116.txt

@@ -0,0 +1 @@
+1.116.0.0,1.117.255.255,CN

+ 1 - 0
mod/geodb/geoip/1/118.txt

@@ -0,0 +1 @@
+1.118.0.0,1.118.255.255,HK

+ 1 - 0
mod/geodb/geoip/1/119.txt

@@ -0,0 +1 @@
+1.119.0.0,1.119.255.255,CN

+ 1 - 0
mod/geodb/geoip/1/12.txt

@@ -0,0 +1 @@
+1.12.0.0,1.15.255.255,CN

+ 1 - 0
mod/geodb/geoip/1/120.txt

@@ -0,0 +1 @@
+1.120.0.0,1.159.255.255,AU

+ 1 - 0
mod/geodb/geoip/1/16.txt

@@ -0,0 +1 @@
+1.16.0.0,1.19.255.255,KR

+ 1 - 0
mod/geodb/geoip/1/160.txt

@@ -0,0 +1 @@
+1.160.0.0,1.175.255.255,TW

+ 1 - 0
mod/geodb/geoip/1/176.txt

@@ -0,0 +1 @@
+1.176.0.0,1.177.255.255,KR

+ 9 - 0
mod/geodb/geoip/1/178.txt

@@ -0,0 +1,9 @@
+1.178.0.0,1.178.31.255,AU
+1.178.32.0,1.178.47.255,BR
+1.178.48.0,1.178.63.255,AR
+1.178.64.0,1.178.111.255,AU
+1.178.112.0,1.178.143.255,PS
+1.178.144.0,1.178.207.255,AU
+1.178.208.0,1.178.215.255,HK
+1.178.216.0,1.178.223.255,SG
+1.178.224.0,1.178.255.255,ES

+ 9 - 0
mod/geodb/geoip/1/179.txt

@@ -0,0 +1,9 @@
+1.179.0.0,1.179.39.255,AU
+1.179.40.0,1.179.47.255,PS
+1.179.48.0,1.179.71.255,AU
+1.179.72.0,1.179.79.255,PS
+1.179.80.0,1.179.87.255,AU
+1.179.88.0,1.179.95.255,PS
+1.179.96.0,1.179.111.255,AU
+1.179.112.0,1.179.127.255,FR
+1.179.128.0,1.179.255.255,TH

+ 1 - 0
mod/geodb/geoip/1/180.txt

@@ -0,0 +1 @@
+1.180.0.0,1.185.255.255,CN

+ 1 - 0
mod/geodb/geoip/1/186.txt

@@ -0,0 +1 @@
+1.186.0.0,1.187.255.255,IN

+ 1 - 0
mod/geodb/geoip/1/188.txt

@@ -0,0 +1 @@
+1.188.0.0,1.199.255.255,CN

+ 4 - 0
mod/geodb/geoip/1/2.txt

@@ -0,0 +1,4 @@
+1.2.0.0,1.2.2.255,CN
+1.2.3.0,1.2.3.255,AU
+1.2.4.0,1.2.127.255,CN
+1.2.128.0,1.2.255.255,TH

+ 1 - 0
mod/geodb/geoip/1/20.txt

@@ -0,0 +1 @@
+1.20.0.0,1.20.255.255,TH

+ 1 - 0
mod/geodb/geoip/1/200.txt

@@ -0,0 +1 @@
+1.200.0.0,1.200.255.255,TW

+ 1 - 0
mod/geodb/geoip/1/201.txt

@@ -0,0 +1 @@
+1.201.0.0,1.201.255.255,KR

+ 1 - 0
mod/geodb/geoip/1/202.txt

@@ -0,0 +1 @@
+1.202.0.0,1.207.255.255,CN

+ 1 - 0
mod/geodb/geoip/1/208.txt

@@ -0,0 +1 @@
+1.208.0.0,1.255.255.255,KR

+ 1 - 0
mod/geodb/geoip/1/21.txt

@@ -0,0 +1 @@
+1.21.0.0,1.21.255.255,JP

+ 1 - 0
mod/geodb/geoip/1/22.txt

@@ -0,0 +1 @@
+1.22.0.0,1.23.255.255,IN

+ 1 - 0
mod/geodb/geoip/1/24.txt

@@ -0,0 +1 @@
+1.24.0.0,1.31.255.255,CN

+ 1 - 0
mod/geodb/geoip/1/3.txt

@@ -0,0 +1 @@
+1.3.0.0,1.3.255.255,CN

+ 23 - 0
mod/geodb/geoip/1/32.txt

@@ -0,0 +1,23 @@
+1.32.0.0,1.32.127.255,MY
+1.32.128.0,1.32.191.255,SG
+1.32.192.0,1.32.199.255,HK
+1.32.200.0,1.32.201.255,SG
+1.32.202.0,1.32.202.127,TW
+1.32.202.128,1.32.202.255,SG
+1.32.203.0,1.32.203.127,TW
+1.32.203.128,1.32.203.255,SG
+1.32.204.0,1.32.204.127,TW
+1.32.204.128,1.32.204.255,SG
+1.32.205.0,1.32.205.255,HK
+1.32.206.0,1.32.207.255,SG
+1.32.208.0,1.32.215.255,TW
+1.32.216.0,1.32.217.255,KR
+1.32.218.0,1.32.218.255,HK
+1.32.219.0,1.32.220.255,KR
+1.32.221.0,1.32.221.255,HK
+1.32.222.0,1.32.223.255,KR
+1.32.224.0,1.32.231.255,JP
+1.32.232.0,1.32.239.255,US
+1.32.240.0,1.32.251.255,HK
+1.32.252.0,1.32.252.255,KH
+1.32.253.0,1.32.255.255,HK

+ 1 - 0
mod/geodb/geoip/1/33.txt

@@ -0,0 +1 @@
+1.33.0.0,1.33.255.255,JP

+ 1 - 0
mod/geodb/geoip/1/34.txt

@@ -0,0 +1 @@
+1.34.0.0,1.35.255.255,TW

+ 1 - 0
mod/geodb/geoip/1/36.txt

@@ -0,0 +1 @@
+1.36.0.0,1.36.255.255,HK

+ 1 - 0
mod/geodb/geoip/1/37.txt

@@ -0,0 +1 @@
+1.37.0.0,1.37.255.255,PH

+ 1 - 0
mod/geodb/geoip/1/38.txt

@@ -0,0 +1 @@
+1.38.0.0,1.39.255.255,IN

+ 3 - 0
mod/geodb/geoip/1/4.txt

@@ -0,0 +1,3 @@
+1.4.0.0,1.4.0.255,AU
+1.4.1.0,1.4.127.255,CN
+1.4.128.0,1.4.255.255,TH

+ 1 - 0
mod/geodb/geoip/1/40.txt

@@ -0,0 +1 @@
+1.40.0.0,1.44.255.255,AU

+ 1 - 0
mod/geodb/geoip/1/45.txt

@@ -0,0 +1 @@
+1.45.0.0,1.45.255.255,CN

+ 1 - 0
mod/geodb/geoip/1/46.txt

@@ -0,0 +1 @@
+1.46.0.0,1.47.255.255,TH

+ 1 - 0
mod/geodb/geoip/1/48.txt

@@ -0,0 +1 @@
+1.48.0.0,1.51.255.255,CN

+ 1 - 0
mod/geodb/geoip/1/5.txt

@@ -0,0 +1 @@
+1.5.0.0,1.5.255.255,JP

+ 1 - 0
mod/geodb/geoip/1/52.txt

@@ -0,0 +1 @@
+1.52.0.0,1.55.255.255,VN

+ 1 - 0
mod/geodb/geoip/1/56.txt

@@ -0,0 +1 @@
+1.56.0.0,1.63.255.255,CN

+ 1 - 0
mod/geodb/geoip/1/6.txt

@@ -0,0 +1 @@
+1.6.0.0,1.7.255.255,IN

+ 1 - 0
mod/geodb/geoip/1/64.txt

@@ -0,0 +1 @@
+1.64.0.0,1.65.255.255,HK

+ 1 - 0
mod/geodb/geoip/1/66.txt

@@ -0,0 +1 @@
+1.66.0.0,1.67.255.255,JP

+ 1 - 0
mod/geodb/geoip/1/68.txt

@@ -0,0 +1 @@
+1.68.0.0,1.71.255.255,CN

+ 1 - 0
mod/geodb/geoip/1/72.txt

@@ -0,0 +1 @@
+1.72.0.0,1.79.255.255,JP

+ 1 - 0
mod/geodb/geoip/1/8.txt

@@ -0,0 +1 @@
+1.8.0.0,1.8.255.255,CN

+ 1 - 0
mod/geodb/geoip/1/80.txt

@@ -0,0 +1 @@
+1.80.0.0,1.95.255.255,CN

+ 1 - 0
mod/geodb/geoip/1/9.txt

@@ -0,0 +1 @@
+1.9.0.0,1.9.255.255,MY

+ 1 - 0
mod/geodb/geoip/1/96.txt

@@ -0,0 +1 @@
+1.96.0.0,1.111.255.255,KR

+ 1 - 0
mod/geodb/geoip/100/0.txt

@@ -0,0 +1 @@
+100.0.0.0,100.42.239.255,US

+ 1 - 0
mod/geodb/geoip/100/128.txt

@@ -0,0 +1 @@
+100.128.0.0,100.255.255.255,US

+ 1 - 0
mod/geodb/geoip/100/42.txt

@@ -0,0 +1 @@
+100.42.240.0,100.42.255.255,CA

+ 3 - 0
mod/geodb/geoip/100/43.txt

@@ -0,0 +1,3 @@
+100.43.0.0,100.43.95.255,US
+100.43.96.0,100.43.127.255,CA
+100.43.128.0,100.63.255.255,US

+ 11 - 0
mod/geodb/geoip/101/0.txt

@@ -0,0 +1,11 @@
+101.0.0.0,101.0.3.255,CN
+101.0.4.0,101.0.7.255,ID
+101.0.8.0,101.0.11.255,PH
+101.0.12.0,101.0.19.255,JP
+101.0.20.0,101.0.21.255,TH
+101.0.22.0,101.0.23.255,PH
+101.0.24.0,101.0.25.255,HK
+101.0.26.0,101.0.31.255,JP
+101.0.32.0,101.0.63.255,IN
+101.0.64.0,101.0.127.255,AU
+101.0.128.0,101.0.255.255,TW

+ 5 - 0
mod/geodb/geoip/101/1.txt

@@ -0,0 +1,5 @@
+101.1.0.0,101.1.3.255,CN
+101.1.4.0,101.1.7.255,HK
+101.1.8.0,101.1.15.255,KR
+101.1.32.0,101.1.63.255,KR
+101.1.64.0,101.1.255.255,JP

+ 2 - 0
mod/geodb/geoip/101/100.txt

@@ -0,0 +1,2 @@
+101.100.0.0,101.100.159.255,NZ
+101.100.160.0,101.100.255.255,SG

+ 6 - 0
mod/geodb/geoip/101/101.txt

@@ -0,0 +1,6 @@
+101.101.0.0,101.101.63.255,NC
+101.101.64.0,101.101.95.255,CN
+101.101.100.0,101.101.100.255,CN
+101.101.101.0,101.101.101.255,TW
+101.101.102.0,101.101.127.255,CN
+101.101.128.0,101.101.255.255,KR

+ 7 - 0
mod/geodb/geoip/101/102.txt

@@ -0,0 +1,7 @@
+101.102.0.0,101.102.63.255,JP
+101.102.64.0,101.102.95.255,CN
+101.102.96.0,101.102.99.255,JP
+101.102.100.0,101.102.102.255,CN
+101.102.103.0,101.102.103.255,TW
+101.102.104.0,101.102.127.255,CN
+101.102.128.0,101.102.255.255,JP

+ 1 - 0
mod/geodb/geoip/101/103.txt

@@ -0,0 +1 @@
+101.103.0.0,101.103.255.255,AU

+ 1 - 0
mod/geodb/geoip/101/104.txt

@@ -0,0 +1 @@
+101.104.0.0,101.107.255.255,CN

+ 1 - 0
mod/geodb/geoip/101/108.txt

@@ -0,0 +1 @@
+101.108.0.0,101.109.255.255,TH

+ 5 - 0
mod/geodb/geoip/101/110.txt

@@ -0,0 +1,5 @@
+101.110.0.0,101.110.63.255,JP
+101.110.64.0,101.110.111.255,CN
+101.110.112.0,101.110.115.255,NZ
+101.110.116.0,101.110.127.255,CN
+101.110.128.0,101.111.255.255,JP

+ 1 - 0
mod/geodb/geoip/101/112.txt

@@ -0,0 +1 @@
+101.112.0.0,101.119.255.255,AU

+ 1 - 0
mod/geodb/geoip/101/120.txt

@@ -0,0 +1 @@
+101.120.0.0,101.126.255.255,CN

+ 1 - 0
mod/geodb/geoip/101/127.txt

@@ -0,0 +1 @@
+101.127.0.0,101.127.255.255,SG

+ 5 - 0
mod/geodb/geoip/101/128.txt

@@ -0,0 +1,5 @@
+101.128.0.0,101.128.3.255,CN
+101.128.4.0,101.128.7.255,AU
+101.128.8.0,101.128.63.255,CN
+101.128.64.0,101.128.127.255,ID
+101.128.128.0,101.128.255.255,JP

+ 1 - 0
mod/geodb/geoip/101/129.txt

@@ -0,0 +1 @@
+101.129.0.0,101.135.255.255,CN

+ 1 - 0
mod/geodb/geoip/101/136.txt

@@ -0,0 +1 @@
+101.136.0.0,101.139.255.255,TW

+ 1 - 0
mod/geodb/geoip/101/140.txt

@@ -0,0 +1 @@
+101.140.0.0,101.143.255.255,JP

+ 1 - 0
mod/geodb/geoip/101/144.txt

@@ -0,0 +1 @@
+101.144.0.0,101.159.255.255,CN

+ 1 - 0
mod/geodb/geoip/101/16.txt

@@ -0,0 +1 @@
+101.16.0.0,101.31.255.255,CN

+ 1 - 0
mod/geodb/geoip/101/160.txt

@@ -0,0 +1 @@
+101.160.0.0,101.167.175.255,AU

+ 7 - 0
mod/geodb/geoip/101/167.txt

@@ -0,0 +1,7 @@
+101.167.176.0,101.167.179.255,HK
+101.167.180.0,101.167.183.255,SG
+101.167.184.0,101.167.187.255,GB
+101.167.188.0,101.167.199.255,HK
+101.167.200.0,101.167.211.255,SG
+101.167.212.0,101.167.223.255,GB
+101.167.224.0,101.191.255.255,AU

+ 1 - 0
mod/geodb/geoip/101/192.txt

@@ -0,0 +1 @@
+101.192.0.0,101.201.255.255,CN

+ 7 - 0
mod/geodb/geoip/101/2.txt

@@ -0,0 +1,7 @@
+101.2.0.0,101.2.127.255,IN
+101.2.128.0,101.2.159.255,JP
+101.2.160.0,101.2.167.255,BD
+101.2.168.0,101.2.171.255,AU
+101.2.172.0,101.2.175.255,CN
+101.2.176.0,101.2.191.255,LK
+101.2.192.0,101.2.255.255,AU

+ 1 - 0
mod/geodb/geoip/101/202.txt

@@ -0,0 +1 @@
+101.202.0.0,101.202.255.255,KR

+ 7 - 0
mod/geodb/geoip/101/203.txt

@@ -0,0 +1,7 @@
+101.203.0.0,101.203.83.255,JP
+101.203.84.0,101.203.85.255,US
+101.203.86.0,101.203.127.255,JP
+101.203.128.0,101.203.167.255,CN
+101.203.168.0,101.203.171.255,ID
+101.203.172.0,101.203.191.255,CN
+101.203.192.0,101.203.255.255,JP

+ 1 - 0
mod/geodb/geoip/101/204.txt

@@ -0,0 +1 @@
+101.204.0.0,101.207.255.255,CN

+ 1 - 0
mod/geodb/geoip/101/208.txt

@@ -0,0 +1 @@
+101.208.0.0,101.223.255.255,IN

+ 1 - 0
mod/geodb/geoip/101/224.txt

@@ -0,0 +1 @@
+101.224.0.0,101.233.255.255,CN

+ 10 - 0
mod/geodb/geoip/101/234.txt

@@ -0,0 +1,10 @@
+101.234.0.0,101.234.26.255,SG
+101.234.27.0,101.234.27.255,JP
+101.234.28.0,101.234.63.255,SG
+101.234.64.0,101.234.71.255,CN
+101.234.72.0,101.234.75.255,AU
+101.234.76.0,101.234.127.255,CN
+101.234.128.0,101.234.147.255,AU
+101.234.148.0,101.234.149.255,SG
+101.234.150.0,101.234.151.255,NZ
+101.234.152.0,101.234.255.255,AU

+ 1 - 0
mod/geodb/geoip/101/235.txt

@@ -0,0 +1 @@
+101.235.0.0,101.235.255.255,KR

+ 1 - 0
mod/geodb/geoip/101/236.txt

@@ -0,0 +1 @@
+101.236.0.0,101.249.255.255,CN

+ 1 - 0
mod/geodb/geoip/101/250.txt

@@ -0,0 +1 @@
+101.250.0.0,101.250.255.255,KR

+ 3 - 0
mod/geodb/geoip/101/251.txt

@@ -0,0 +1,3 @@
+101.251.0.0,101.251.3.255,CN
+101.251.4.0,101.251.7.255,NP
+101.251.8.0,101.254.255.255,CN

+ 1 - 0
mod/geodb/geoip/101/255.txt

@@ -0,0 +1 @@
+101.255.0.0,101.255.255.255,ID

+ 1 - 0
mod/geodb/geoip/101/3.txt

@@ -0,0 +1 @@
+101.3.0.0,101.3.255.255,TW

+ 8 - 0
mod/geodb/geoip/101/32.txt

@@ -0,0 +1,8 @@
+101.32.0.0,101.32.79.255,HK
+101.32.80.0,101.32.95.255,IN
+101.32.96.0,101.32.111.255,JP
+101.32.112.0,101.32.175.255,SG
+101.32.176.0,101.32.223.255,HK
+101.32.224.0,101.32.227.255,TH
+101.32.228.0,101.32.237.255,IN
+101.32.238.0,101.33.1.255,SG

+ 23 - 0
mod/geodb/geoip/101/33.txt

@@ -0,0 +1,23 @@
+101.33.2.0,101.33.3.255,IN
+101.33.4.0,101.33.7.255,ID
+101.33.8.0,101.33.9.255,BR
+101.33.10.0,101.33.11.255,DE
+101.33.12.0,101.33.16.255,IN
+101.33.17.0,101.33.17.255,JP
+101.33.18.0,101.33.19.255,PH
+101.33.20.0,101.33.21.255,US
+101.33.22.0,101.33.22.255,BR
+101.33.23.0,101.33.23.255,SG
+101.33.24.0,101.33.24.255,BR
+101.33.25.0,101.33.27.255,SG
+101.33.28.0,101.33.29.255,NL
+101.33.30.0,101.33.31.255,VN
+101.33.32.0,101.33.40.255,HK
+101.33.41.0,101.33.51.255,SG
+101.33.52.0,101.33.55.255,JP
+101.33.56.0,101.33.59.255,KR
+101.33.60.0,101.33.63.255,IN
+101.33.64.0,101.33.99.255,KR
+101.33.100.0,101.33.115.255,SG
+101.33.116.0,101.33.127.255,HK
+101.33.128.0,101.36.95.255,CN

+ 10 - 0
mod/geodb/geoip/101/36.txt

@@ -0,0 +1,10 @@
+101.36.96.0,101.36.97.255,GB
+101.36.98.0,101.36.99.255,US
+101.36.100.0,101.36.101.255,PH
+101.36.102.0,101.36.103.255,VN
+101.36.104.0,101.36.105.255,JP
+101.36.106.0,101.36.113.255,HK
+101.36.114.0,101.36.114.255,KR
+101.36.115.0,101.36.115.255,US
+101.36.116.0,101.36.127.255,HK
+101.36.128.0,101.43.255.255,CN

+ 1 - 0
mod/geodb/geoip/101/4.txt

@@ -0,0 +1 @@
+101.4.0.0,101.7.255.255,CN

Some files were not shown because too many files changed in this diff