Enhance MTProxy checker functionality by introducing a new -probe flag for selecting between fast and deep probing modes. Update README and Docker documentation to reflect this change, including details on timeout handling and exit codes for improved clarity.
Publish mtproxy_checker Docker image / test (push) Successful in 6s
Publish mtproxy_checker Docker image / build-and-push (push) Successful in 51s

This commit is contained in:
Denozordec
2026-04-11 13:48:02 +07:00
parent 6f2dbcbca3
commit 935401b1f8
7 changed files with 105 additions and 17 deletions
+35
View File
@@ -0,0 +1,35 @@
package checker
import "strings"
// ProbeMode selects how strictly we validate after MTProxy init.
type ProbeMode int
const (
// ProbeFast: handshake + init, then any inbound data within a short window (legacy behavior; fast).
ProbeFast ProbeMode = iota
// ProbeDeep: MTProto req_pq and expect resPQ from Telegram DC through the tunnel (stricter; slower).
ProbeDeep
)
// Options configures Check. Nil or zero value uses ProbeFast.
type Options struct {
Probe ProbeMode
}
// ParseProbe maps env/flag strings: "", "fast" -> ProbeFast; "deep" -> ProbeDeep.
func ParseProbe(s string) ProbeMode {
switch strings.ToLower(strings.TrimSpace(s)) {
case "deep", "respq", "dc":
return ProbeDeep
default:
return ProbeFast
}
}
func effectiveOpts(opts *Options) *Options {
if opts == nil {
return &Options{Probe: ProbeFast}
}
return opts
}