diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..30cf57e
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,10 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Ignored default folder with query files
+/queries/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/discord.xml b/.idea/discord.xml
new file mode 100644
index 0000000..30bab2a
--- /dev/null
+++ b/.idea/discord.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/go.imports.xml b/.idea/go.imports.xml
new file mode 100644
index 0000000..644cdf0
--- /dev/null
+++ b/.idea/go.imports.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/golinter.xml b/.idea/golinter.xml
new file mode 100644
index 0000000..2a196e3
--- /dev/null
+++ b/.idea/golinter.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..1746e10
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..cfbb883
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/mtg.iml b/.idea/mtg.iml
new file mode 100644
index 0000000..5e764c4
--- /dev/null
+++ b/.idea/mtg.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/essentials/addresses.go b/essentials/addresses.go
index 7a91754..4f415cd 100644
--- a/essentials/addresses.go
+++ b/essentials/addresses.go
@@ -25,6 +25,18 @@ var TelegramCoreAddresses = map[int][]string{
},
203: {
"91.105.192.100:443",
- "[2a0a:f280:0203:000a:5000:0000:0000:0100]:443",
+ "[2a0a:f280:0203:a:5000::100]:443",
+ },
+ 10001: {
+ "149.154.175.10:443",
+ "[2001:b28:f23d:f001::e]:443",
+ },
+ 10002: {
+ "149.154.167.40:443",
+ "[2001:67c:4e8:f002::e]:443",
+ },
+ 10003: {
+ "149.154.175.117:443",
+ "[2001:b28:f23d:f003::e]:443",
},
}
diff --git a/example.config.toml b/example.config.toml
index b9293c2..64020a3 100644
--- a/example.config.toml
+++ b/example.config.toml
@@ -378,3 +378,42 @@ bind-to = "127.0.0.1:3129"
http-path = "/"
# prefix for metrics for prometheus
metric-prefix = "mtg"
+
+[dc]
+dc1 = [
+ "149.154.175.59:443",
+ "149.154.175.54:443",
+ "[2001:b28:f23d:f001::a]:443"
+]
+dc2 = [
+ "149.154.167.41:443",
+ "149.154.167.151:443",
+ "[2001:67c:4e8:f002::a]:443",
+ "[2001:67c:4e8:f002::b]:443"
+]
+dc3 = [
+ "149.154.175.100:443",
+ "[2001:b28:f23d:f003::a]:443"
+]
+dc4 = [
+ "149.154.167.92:443",
+ "149.154.165.111:443",
+ "[2001:67c:4e8:f004::a]:443",
+ "[2001:67c:4e8:f004::b]:443"
+]
+dc5 = [
+ "91.108.56.115:443",
+ "[2001:b28:f23f:f005::a]:443"
+]
+dc10001 = [
+ "149.154.175.10:443",
+ "[2001:b28:f23d:f001::e]:443"
+]
+dc10002 = [
+ "149.154.167.40:443",
+ "[2001:67c:4e8:f002::e]:443"
+]
+dc10003 = [
+ "149.154.175.117:443",
+ "[2001:b28:f23d:f003::e]:443"
+]
\ No newline at end of file
diff --git a/internal/config/config.go b/internal/config/config.go
index 70e233f..cfd8a91 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -91,6 +91,17 @@ type Config struct {
MetricPrefix TypeMetricPrefix `json:"metricPrefix"`
} `json:"prometheus"`
} `json:"stats"`
+ DCs struct{
+ DC1 []TypeHostPort `json:"dc1"`
+ DC2 []TypeHostPort `json:"dc2"`
+ DC3 []TypeHostPort `json:"dc3"`
+ DC4 []TypeHostPort `json:"dc4"`
+ DC5 []TypeHostPort `json:"dc5"`
+ DC203 []TypeHostPort `json:"dc203"`
+ DC10001 []TypeHostPort `json:"dc10001"`
+ DC10002[]TypeHostPort `json:"dc10002"`
+ DC10003 []TypeHostPort `json:"dc10003"`
+ } `json:"dc"`
}
func (c *Config) GetConcurrency(defaultValue uint) uint {
diff --git a/internal/config/parse.go b/internal/config/parse.go
index bdc7616..507e327 100644
--- a/internal/config/parse.go
+++ b/internal/config/parse.go
@@ -84,6 +84,17 @@ type tomlConfig struct {
MetricPrefix string `toml:"metric-prefix" json:"metricPrefix,omitempty"`
} `toml:"prometheus" json:"prometheus,omitempty"`
} `toml:"stats" json:"stats,omitempty"`
+ DCs struct{
+ DC1 []string `toml:"dc1" json:"dc1,omitempty"`
+ DC2 []string `toml:"dc2" json:"dc2,omitempty"`
+ DC3 []string `toml:"dc3" json:"dc3,omitempty"`
+ DC4 []string `toml:"dc4" json:"dc4,omitempty"`
+ DC5 []string `toml:"dc5" json:"dc5,omitempty"`
+ DC203 []string `toml:"dc203" json:"dc203,omitempty"`
+ DC10001 []string `toml:"dc10001" json:"dc10001,omitempty"`
+ DC10002 []string `toml:"dc10002" json:"dc10002,omitempty"`
+ DC10003 []string `toml:"dc10003" json:"dc10003,omitempty"`
+ } `toml:"dc" json:"dc,omitempty"`
}
func Parse(rawData []byte) (*Config, error) {
diff --git a/internal/utils/read_config.go b/internal/utils/read_config.go
index eee7b98..7199319 100644
--- a/internal/utils/read_config.go
+++ b/internal/utils/read_config.go
@@ -2,11 +2,82 @@ package utils
import (
"fmt"
+ "log"
"os"
+ "github.com/9seconds/mtg/v2/essentials"
"github.com/9seconds/mtg/v2/internal/config"
)
+func readCustomDC(cfg *config.Config) {
+ if len(cfg.DCs.DC1) > 0 {
+ var ips []string
+ for _, addr := range cfg.DCs.DC1 {
+ ips = append(ips, addr.Value)
+ }
+ essentials.TelegramCoreAddresses[1] = ips
+ }
+ if len(cfg.DCs.DC2) > 0 {
+ var ips []string
+ for _, addr := range cfg.DCs.DC2 {
+ ips = append(ips, addr.Value)
+ }
+ essentials.TelegramCoreAddresses[2] = ips
+ }
+ if len(cfg.DCs.DC3) > 0 {
+ var ips []string
+ for _, addr := range cfg.DCs.DC3 {
+ ips = append(ips, addr.Value)
+ }
+ essentials.TelegramCoreAddresses[3] = ips
+ }
+ if len(cfg.DCs.DC4) > 0 {
+ var ips []string
+ for _, addr := range cfg.DCs.DC4 {
+ ips = append(ips, addr.Value)
+ }
+ essentials.TelegramCoreAddresses[4] = ips
+ }
+ if len(cfg.DCs.DC5) > 0 {
+ var ips []string
+ for _, addr := range cfg.DCs.DC5 {
+ ips = append(ips, addr.Value)
+ }
+ essentials.TelegramCoreAddresses[5] = ips
+ }
+ if len(cfg.DCs.DC203) > 0 {
+ var ips []string
+ for _, addr := range cfg.DCs.DC203 {
+ ips = append(ips, addr.Value)
+ }
+ essentials.TelegramCoreAddresses[203] = ips
+ }
+
+ if len(cfg.DCs.DC10001) > 0 {
+ var ips []string
+ for _, addr := range cfg.DCs.DC10001 {
+ ips = append(ips, addr.Value)
+ }
+ essentials.TelegramCoreAddresses[10001] = ips
+ }
+ if len(cfg.DCs.DC10002) > 0 {
+ var ips []string
+ for _, addr := range cfg.DCs.DC203 {
+ ips = append(ips, addr.Value)
+ }
+ essentials.TelegramCoreAddresses[10002] = ips
+ }
+ if len(cfg.DCs.DC10003) > 0 {
+ var ips []string
+ for _, addr := range cfg.DCs.DC203 {
+ ips = append(ips, addr.Value)
+ }
+ essentials.TelegramCoreAddresses[10003] = ips
+ }
+ log.Println(essentials.TelegramCoreAddresses)
+ log.Println(cfg.DCs)
+}
+
func ReadConfig(path string) (*config.Config, error) {
content, err := os.ReadFile(path)
if err != nil {
@@ -21,6 +92,7 @@ func ReadConfig(path string) (*config.Config, error) {
if err := conf.Validate(); err != nil {
return nil, fmt.Errorf("invalid config: %w", err)
}
+ readCustomDC(conf)
return conf, nil
}