Enhance MTProxy checker by introducing a new -probe mode deep-strict for stricter response validation. Update README and Docker documentation to clarify probing modes, exit codes, and the new MTPROXY_TDLIB_HELPER and MTPROXY_TDLIB_TIMEOUT environment variables for external helper integration. Refactor connection handling and error reporting to improve robustness and clarity in response verification.
Publish mtproxy_checker Docker image / test (push) Successful in 7s
Publish mtproxy_checker Docker image / build-and-push (push) Successful in 53s

This commit is contained in:
Denozordec
2026-04-11 16:12:45 +07:00
parent 24a7315a16
commit 388784eb5e
17 changed files with 902 additions and 24 deletions
+33
View File
@@ -0,0 +1,33 @@
package main
import (
"context"
"errors"
"strings"
"time"
"mtproxy_checker/internal/checker"
"mtproxy_checker/internal/tdlibexec"
)
func runTDLibBlock(proxyLine, helper string, timeout time.Duration, probe checker.ProbeMode, ent proxyEntry) tdlibProbe {
if probe != checker.ProbeFast {
return tdlibProbe{SkippedReason: "tdlib runs only with probe fast (or empty MTPROXY_PROBE)", Ran: false}
}
if ent.ParseError != "" {
return tdlibProbe{SkippedReason: "skipped: standard parse error", Ran: false}
}
if strings.TrimSpace(helper) == "" {
return tdlibProbe{SkippedReason: "MTPROXY_TDLIB_HELPER not set", Ran: false}
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
res, err := tdlibexec.Run(ctx, helper, proxyLine)
if err != nil {
if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled) {
return tdlibProbe{Ran: true, OK: false, ExitCode: 4, Error: err.Error(), DurationMs: res.DurationMs}
}
return tdlibProbe{Ran: true, OK: false, ExitCode: 1, Error: err.Error(), DurationMs: res.DurationMs}
}
return tdlibProbe{Ran: true, OK: res.OK, ExitCode: res.ExitCode, Error: res.Error, DurationMs: res.DurationMs}
}