chore: initial commit

This commit is contained in:
2026-07-22 17:50:33 +08:00
parent 82936a8987
commit ee9f50b859
107 changed files with 8346 additions and 0 deletions

30
internal/handler/web.go Normal file
View File

@@ -0,0 +1,30 @@
package handler
import (
"net/http"
"server/internal/pkg/httputil"
"server/internal/utils"
)
type WebHandler struct {
}
func NewWebHandler() *WebHandler {
return &WebHandler{}
}
func (h *WebHandler) GetClientInfo(w http.ResponseWriter, r *http.Request) {
ip := utils.ClientIP(r)
userAgent := r.UserAgent()
httputil.Ok(w, map[string]any{
"ip": ip,
"userAgent": userAgent,
"method": r.Method,
"host": r.Host,
"path": r.URL.Path,
"origin": r.Header.Get("Origin"),
"accept": r.Header.Get("Accept"),
"acceptLanguage": r.Header.Get("Accept-Language"),
})
}