MCPcopy Index your code
hub / github.com/V2RaySSR/RealityChecker / ClassifyStatusCode

Function ClassifyStatusCode

internal/types/types.go:40–64  ·  view source on GitHub ↗

ClassifyStatusCode 分类状态码

(statusCode int, accessible bool)

Source from the content-addressed store, hash-verified

38
39// ClassifyStatusCode 分类状态码
40func ClassifyStatusCode(statusCode int, accessible bool) string {
41 if !accessible {
42 return StatusCodeCategoryNetwork
43 }
44
45 // 安全的状态码
46 switch statusCode {
47 case 200, 301, 302, 404:
48 return StatusCodeCategorySafe
49 }
50
51 // 排除的状态码
52 switch statusCode {
53 case 401, 403, 407, 408, 429:
54 return StatusCodeCategoryExcluded
55 }
56
57 // 5xx 系列
58 if statusCode >= 500 && statusCode < 600 {
59 return StatusCodeCategoryExcluded
60 }
61
62 // 其他状态码也归类为排除
63 return StatusCodeCategoryExcluded
64}
65
66// IsStatusCodeSafe 检查状态码是否安全
67func IsStatusCodeSafe(statusCode int) bool {

Callers 4

evaluateSuitabilityMethod · 0.92
ExecuteMethod · 0.92
IsStatusCodeSafeFunction · 0.85
IsStatusCodeExcludedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected