Quellcode durchsuchen

refactor(cdn): 重构 CDN 日志数据结构

- 移除了 HTTPAccessLog 中的 Tags 字段
- 更新了 Header 结构,增加了新的字段并调整了现有字段
- 更新了 SentHeader 结构,增加了新的字段并调整了现有字段
- 优化了数据结构的组织方式,提高了可读性和可维护性
fusu vor 1 Woche
Ursprung
Commit
1bca27062b
1 geänderte Dateien mit 65 neuen und 41 gelöschten Zeilen
  1. 65 41
      api/v1/cdn/log.go

+ 65 - 41
api/v1/cdn/log.go

@@ -15,12 +15,12 @@ type Request struct {
 	Keyword       string `json:"keyword" form:"keyword"`
 }
 
-
 type Data struct {
 	HasMore        bool            `json:"hasMore"`
 	HTTPAccessLogs []HTTPAccessLog `json:"httpAccessLogs"`
 	RequestID      string          `json:"requestId"`
 }
+
 type HTTPAccessLog struct {
 	BodyBytesSent            int64      `json:"bodyBytesSent"`
 	BytesSent                int64      `json:"bytesSent"`
@@ -53,7 +53,6 @@ type HTTPAccessLog struct {
 	ServerPort               int64      `json:"serverPort"`
 	ServerProtocol           string     `json:"serverProtocol"`
 	Status                   int64      `json:"status"`
-	Tags                     []string   `json:"tags,omitempty"`
 	TimeISO8601              string     `json:"timeISO8601"`
 	TimeLocal                string     `json:"timeLocal"`
 	Timestamp                int64      `json:"timestamp"`
@@ -61,21 +60,27 @@ type HTTPAccessLog struct {
 }
 
 type Header struct {
-	Accept                  Accept                   `json:"Accept"`
-	AcceptEncoding          AcceptEncoding           `json:"Accept-Encoding"`
-	AcceptLanguage          AcceptLanguage           `json:"Accept-Language"`
-	CacheControl            *HeaderCacheControl      `json:"Cache-Control,omitempty"`
-	Connection              Connection               `json:"Connection"`
-	IfModifiedSince         *IfModifiedSince         `json:"If-Modified-Since,omitempty"`
-	IfNoneMatch             *IfNoneMatch             `json:"If-None-Match,omitempty"`
-	Referer                 Referer                  `json:"Referer"`
-	UpgradeInsecureRequests *UpgradeInsecureRequests `json:"Upgrade-Insecure-Requests,omitempty"`
-	UserAgent               UserAgent                `json:"User-Agent"`
-	XForwardedBy            XForwardedBy             `json:"X-Forwarded-By"`
-	XForwardedFor           XForwardedFor            `json:"X-Forwarded-For"`
-	XForwardedHost          XForwardedHost           `json:"X-Forwarded-Host"`
-	XForwardedProto         XForwardedProto          `json:"X-Forwarded-Proto"`
-	XRealIP                 XRealIP                  `json:"X-Real-IP"`
+	Accept          Accept             `json:"Accept"`
+	AcceptEncoding  AcceptEncoding     `json:"Accept-Encoding"`
+	AcceptLanguage  AcceptLanguage     `json:"Accept-Language"`
+	AdminAccess     *AdminAccess       `json:"Admin-Access,omitempty"`
+	CacheControl    HeaderCacheControl `json:"Cache-Control"`
+	Cookie          Cookie             `json:"Cookie"`
+	Priority        Priority           `json:"Priority"`
+	Referer         Referer            `json:"Referer"`
+	SECCHUA         SECCHUA            `json:"Sec-CH-UA"`
+	SECCHUAMobile   SECCHUAMobile      `json:"Sec-CH-UA-Mobile"`
+	SECCHUAPlatform SECCHUAPlatform    `json:"Sec-CH-UA-Platform"`
+	SECFetchDest    SECFetchDest       `json:"Sec-Fetch-Dest"`
+	SECFetchMode    SECFetchMode       `json:"Sec-Fetch-Mode"`
+	SECFetchSite    SECFetchSite       `json:"Sec-Fetch-Site"`
+	Token           *Token             `json:"Token,omitempty"`
+	UserAgent       UserAgent          `json:"User-Agent"`
+	XForwardedBy    XForwardedBy       `json:"X-Forwarded-By"`
+	XForwardedFor   XForwardedFor      `json:"X-Forwarded-For"`
+	XForwardedHost  XForwardedHost     `json:"X-Forwarded-Host"`
+	XForwardedProto XForwardedProto    `json:"X-Forwarded-Proto"`
+	XRealIP         XRealIP            `json:"X-Real-IP"`
 }
 
 type Accept struct {
@@ -90,19 +95,19 @@ type AcceptLanguage struct {
 	Values []string `json:"values"`
 }
 
-type HeaderCacheControl struct {
+type AdminAccess struct {
 	Values []string `json:"values"`
 }
 
-type Connection struct {
+type HeaderCacheControl struct {
 	Values []string `json:"values"`
 }
 
-type IfModifiedSince struct {
+type Cookie struct {
 	Values []string `json:"values"`
 }
 
-type IfNoneMatch struct {
+type Priority struct {
 	Values []string `json:"values"`
 }
 
@@ -110,7 +115,31 @@ type Referer struct {
 	Values []string `json:"values"`
 }
 
-type UpgradeInsecureRequests struct {
+type SECCHUA struct {
+	Values []string `json:"values"`
+}
+
+type SECCHUAMobile struct {
+	Values []string `json:"values"`
+}
+
+type SECCHUAPlatform struct {
+	Values []string `json:"values"`
+}
+
+type SECFetchDest struct {
+	Values []string `json:"values"`
+}
+
+type SECFetchMode struct {
+	Values []string `json:"values"`
+}
+
+type SECFetchSite struct {
+	Values []string `json:"values"`
+}
+
+type Token struct {
 	Values []string `json:"values"`
 }
 
@@ -150,27 +179,22 @@ type NodeCluster struct {
 }
 
 type SentHeader struct {
-	AcceptRanges  AcceptRanges           `json:"Accept-Ranges"`
-	CacheControl  SentHeaderCacheControl `json:"Cache-Control"`
-	ContentLength ContentLength          `json:"Content-Length"`
-	ContentType   ContentType            `json:"Content-Type"`
-	Date          Date                   `json:"Date"`
-	Etag          Etag                   `json:"Etag"`
-	Expires       Expires                `json:"Expires"`
-	LastModified  LastModified           `json:"Last-Modified"`
-	Location      *Location              `json:"Location,omitempty"`
-	Server        Server                 `json:"Server"`
-}
-
-type AcceptRanges struct {
-	Values []string `json:"values"`
+	CacheControl    SentHeaderCacheControl `json:"Cache-Control"`
+	ContentEncoding *ContentEncoding       `json:"Content-Encoding,omitempty"`
+	ContentType     ContentType            `json:"Content-Type"`
+	Date            Date                   `json:"Date"`
+	Etag            *Etag                  `json:"Etag,omitempty"`
+	LastModified    *LastModified          `json:"Last-Modified,omitempty"`
+	Location        *Location              `json:"Location,omitempty"`
+	Server          Server                 `json:"Server"`
+	Vary            *Vary                  `json:"Vary,omitempty"`
 }
 
 type SentHeaderCacheControl struct {
 	Values []string `json:"values"`
 }
 
-type ContentLength struct {
+type ContentEncoding struct {
 	Values []string `json:"values"`
 }
 
@@ -186,10 +210,6 @@ type Etag struct {
 	Values []string `json:"values"`
 }
 
-type Expires struct {
-	Values []string `json:"values"`
-}
-
 type LastModified struct {
 	Values []string `json:"values"`
 }
@@ -201,3 +221,7 @@ type Location struct {
 type Server struct {
 	Values []string `json:"values"`
 }
+
+type Vary struct {
+	Values []string `json:"values"`
+}