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.
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user