mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 16:01:55 +03:00
removed unwanted log write
doctor logging per-ip
This commit is contained in:
@@ -50,6 +50,12 @@ var (
|
||||
tplEDCConnect = template.Must(
|
||||
template.New("").Parse(" ❌ DC {{ .dc }}: {{ .error }}\n"),
|
||||
)
|
||||
tplODCIPConnect = template.Must(
|
||||
template.New("").Parse(" ✅ {{ .ip }}\n"),
|
||||
)
|
||||
tplEDCIPConnect = template.Must(
|
||||
template.New("").Parse(" ❌ {{ .ip }}: {{ .error }}\n"),
|
||||
)
|
||||
|
||||
tplODNSSNIMatch = template.Must(
|
||||
template.New("").Parse(" ✅ IP address {{ .ip }} matches secret hostname {{ .hostname }}\n"),
|
||||
@@ -285,8 +291,15 @@ func (d *Doctor) checkNetworkAddresses(ntw mtglib.Network, addresses []string) e
|
||||
for _, addr := range checkAddresses {
|
||||
conn, err = ntw.DialContext(ctx, "tcp", addr)
|
||||
if err != nil {
|
||||
tplEDCIPConnect.Execute(os.Stdout, map[string]any{
|
||||
"error": err,
|
||||
"ip": addr,
|
||||
})
|
||||
continue
|
||||
}
|
||||
tplODCIPConnect.Execute(os.Stdout, map[string]any{
|
||||
"ip": addr,
|
||||
})
|
||||
|
||||
conn.Close() //nolint: errcheck
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/9seconds/mtg/v2/essentials"
|
||||
@@ -62,20 +61,18 @@ func readCustomDC(cfg *config.Config) {
|
||||
}
|
||||
if len(cfg.DCs.DC10002) > 0 {
|
||||
var ips []string
|
||||
for _, addr := range cfg.DCs.DC203 {
|
||||
for _, addr := range cfg.DCs.DC10002 {
|
||||
ips = append(ips, addr.Value)
|
||||
}
|
||||
essentials.TelegramCoreAddresses[10002] = ips
|
||||
}
|
||||
if len(cfg.DCs.DC10003) > 0 {
|
||||
var ips []string
|
||||
for _, addr := range cfg.DCs.DC203 {
|
||||
for _, addr := range cfg.DCs.DC10003 {
|
||||
ips = append(ips, addr.Value)
|
||||
}
|
||||
essentials.TelegramCoreAddresses[10003] = ips
|
||||
}
|
||||
log.Println(essentials.TelegramCoreAddresses)
|
||||
log.Println(cfg.DCs)
|
||||
}
|
||||
|
||||
func ReadConfig(path string) (*config.Config, error) {
|
||||
@@ -92,6 +89,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
|
||||
|
||||
Reference in New Issue
Block a user