소스 검색

Add --skip-native-check flag to mtg doctor

When proxy chaining is configured, the native network connectivity
check times out for every Telegram DC (~10s × 6 DCs = ~60s) because
direct egress is intentionally not used. This flag lets users skip
that section of the doctor output.

Refs #482
pull/484/head
dolonet 1 주 전
부모
커밋
e897a5f22a
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7
    2
      internal/cli/doctor.go

+ 7
- 2
internal/cli/doctor.go 파일 보기

69
 type Doctor struct {
69
 type Doctor struct {
70
 	conf *config.Config
70
 	conf *config.Config
71
 
71
 
72
-	ConfigPath string `kong:"arg,required,type='existingfile',help='Path to the configuration file.',name='config-path'"` //nolint: lll
72
+	ConfigPath      string `kong:"arg,required,type='existingfile',help='Path to the configuration file.',name='config-path'"` //nolint: lll
73
+	SkipNativeCheck bool   `kong:"help='Skip the native network connectivity check (useful when proxy chaining is configured and direct egress is not expected to work).',name='skip-native-check'"` //nolint: lll
73
 }
74
 }
74
 
75
 
75
 func (d *Doctor) Run(cli *CLI, version string) error {
76
 func (d *Doctor) Run(cli *CLI, version string) error {
106
 	)
107
 	)
107
 
108
 
108
 	fmt.Println("Validate native network connectivity")
109
 	fmt.Println("Validate native network connectivity")
109
-	everythingOK = d.checkNetwork(base) && everythingOK
110
+	if d.SkipNativeCheck {
111
+		fmt.Println("  ⏭ Skipped (--skip-native-check)")
112
+	} else {
113
+		everythingOK = d.checkNetwork(base) && everythingOK
114
+	}
110
 
115
 
111
 	for _, url := range conf.Network.Proxies {
116
 	for _, url := range conf.Network.Proxies {
112
 		value, err := network.NewProxyNetwork(base, url.Get(nil))
117
 		value, err := network.NewProxyNetwork(base, url.Get(nil))

Loading…
취소
저장