Enhance Dockerfile to build and include a new HTTP API service (mtproxy_checkerd) alongside the existing CLI tool (mtproxy_checker). Update README and documentation to reflect the new service and its usage, including environment variables and Docker run instructions.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package checkresult
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"mtproxy_checker/internal/checker"
|
||||
)
|
||||
|
||||
// Classify maps a checker error to CLI-style exit codes: 0 OK, 1 generic, 3 proxy closed, 4 timeout.
|
||||
func Classify(err error) (exitCode int, message string) {
|
||||
if err == nil {
|
||||
return 0, ""
|
||||
}
|
||||
if errors.Is(err, checker.ErrProxyClosed) {
|
||||
return 3, err.Error()
|
||||
}
|
||||
if errors.Is(err, context.DeadlineExceeded) {
|
||||
return 4, "timeout"
|
||||
}
|
||||
return 1, err.Error()
|
||||
}
|
||||
Reference in New Issue
Block a user