Remove mentioning of DC overrides

This commit is contained in:
9seconds
2026-02-24 13:32:06 +01:00
parent 94d46d2c65
commit e4a9a96309
6 changed files with 1 additions and 30 deletions
-9
View File
@@ -80,15 +80,6 @@ tolerate-time-skewness = "5s"
# Otherwise, chose a new DC.
allow-fallback-on-unknown-dc = false
# Telegram uses different DCs for different purposes. Unfortunately, most of
# DCs are not public, and dependent on a location of the current user, so
# mtg cannot know upfront about all of them, and how to access them. It has
# a default list of DCs, including some CDN IPs, but it is possible that some
# of them are not working for you. In this case, you can override them here.
[[dc-overrides]]
dc = 101
ips = ["127.0.0.1:443"]
# network defines different network-related settings
[network]
# please be aware that mtg needs to do some external requests. For
-9
View File
@@ -242,14 +242,6 @@ func runProxy(conf *config.Config, version string) error { //nolint: funlen
return fmt.Errorf("cannot build ip allowlist: %w", err)
}
dcOverrides := map[int][]string{}
for _, override := range conf.DCOverrides {
dcid := override.DC.Get()
for _, addr := range override.IPs {
dcOverrides[dcid] = append(dcOverrides[dcid], addr.Get(""))
}
}
opts := mtglib.ProxyOpts{
Logger: logger,
Network: ntw,
@@ -264,7 +256,6 @@ func runProxy(conf *config.Config, version string) error { //nolint: funlen
AllowFallbackOnUnknownDC: conf.AllowFallbackOnUnknownDC.Get(false),
TolerateTimeSkewness: conf.TolerateTimeSkewness.Value,
DCOverrides: dcOverrides,
}
proxy, err := mtglib.NewProxy(opts)
-4
View File
@@ -65,10 +65,6 @@ type Config struct {
MetricPrefix TypeMetricPrefix `json:"metricPrefix"`
} `json:"prometheus"`
} `json:"stats"`
DCOverrides []struct {
DC TypeDC `json:"dc"`
IPs []TypeHostPort `json:"ips"`
} `json:"dcOverrides"`
}
func (c *Config) Validate() error {
-4
View File
@@ -60,10 +60,6 @@ type tomlConfig struct {
MetricPrefix string `toml:"metric-prefix" json:"metricPrefix,omitempty"`
} `toml:"prometheus" json:"prometheus,omitempty"`
} `toml:"stats" json:"stats,omitempty"`
DCOverrides []struct {
DC uint `toml:"dc" json:"dc"`
IPs []string `toml:"ips" json:"ips"`
} `toml:"dc-overrides" json:"dcOverrides,omitempty"`
}
func Parse(rawData []byte) (*Config, error) {
-3
View File
@@ -2,12 +2,10 @@ package dc
type dcView struct {
publicConfigs dcAddrSet
ownConfigs dcAddrSet
}
func (d dcView) getV4(dc int) []Addr {
addrs := d.publicConfigs.getV4(dc)
addrs = append(addrs, d.ownConfigs.getV4(dc)...)
addrs = append(addrs, defaultDCAddrSet.getV4(dc)...)
return addrs
@@ -15,7 +13,6 @@ func (d dcView) getV4(dc int) []Addr {
func (d dcView) getV6(dc int) []Addr {
addrs := d.publicConfigs.getV6(dc)
addrs = append(addrs, d.ownConfigs.getV6(dc)...)
addrs = append(addrs, defaultDCAddrSet.getV6(dc)...)
return addrs
+1 -1
View File
@@ -117,7 +117,7 @@ type ProxyOpts struct {
// DCOverrides defines a set of IP addresses that should be used
// with a higher priority to those that are calculated somehow by mtg.
//
// This is an optional setting
// OBSOLETE and DEPRECATED. Ignored.
DCOverrides map[int][]string
}