refactor: 大型重构

This commit is contained in:
ZacharyZcR
2024-12-20 03:46:09 +08:00
parent c0b7f4ca4f
commit bdeabec67e
27 changed files with 227 additions and 232 deletions

View File

@@ -37,7 +37,7 @@ func Inithttp() {
}
// 初始化HTTP客户端
err := InitHttpClient(Common.PocNum, Common.Proxy, time.Duration(Common.WebTimeout)*time.Second)
err := InitHttpClient(Common.PocNum, Common.HttpProxy, time.Duration(Common.WebTimeout)*time.Second)
if err != nil {
panic(err)
}

View File

@@ -57,7 +57,7 @@ func Evaluate(env *cel.Env, expression string, params map[string]interface{}) (r
return result, nil
}
// UrlTypeToString 将 URL 结构体转换为字符串
// UrlTypeToString 将 TargetURL 结构体转换为字符串
func UrlTypeToString(u *UrlType) string {
var builder strings.Builder
@@ -604,7 +604,7 @@ func reverseCheck(r *Reverse, timeout int64) bool {
// 提取子域名
sub := strings.Split(r.Domain, ".")[0]
// 构造 API 请求 URL
// 构造 API 请求 TargetURL
apiURL := fmt.Sprintf("http://api.ceye.io/v1/records?token=%s&type=dns&filter=%s",
ceyeApi, sub)
@@ -700,7 +700,7 @@ func DoRequest(req *http.Request, redirect bool) (*Response, error) {
return resp, err
}
// ParseUrl 解析 URL 并转换为自定义 URL 类型
// ParseUrl 解析 TargetURL 并转换为自定义 TargetURL 类型
func ParseUrl(u *url.URL) *UrlType {
return &UrlType{
Scheme: u.Scheme,
@@ -782,10 +782,10 @@ func getRespBody(oResp *http.Response) ([]byte, error) {
defer reader.Close()
decompressed, err := io.ReadAll(reader)
if err != nil && err != io.EOF && len(decompressed) == 0{
if err != nil && err != io.EOF && len(decompressed) == 0 {
return nil, err
}
if len(decompressed) == 0 && len(body) != 0{
if len(decompressed) == 0 && len(body) != 0 {
return body, nil
}
return decompressed, nil