初始化

This commit is contained in:
2024-08-27 14:51:15 +08:00
parent 5bda797839
commit 2919f32729
91 changed files with 5691 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
package service
import (
"net/http"
)
type PublicService struct {
}
// GetUserIP 获取用户ip
func (r *PublicService) GetUserIP(h *http.Request) string {
forwarded := h.Header.Get("X-FORWARDED-FOR")
if forwarded != "" {
return forwarded
}
return h.RemoteAddr
}