HEAVY: migrate accounts and logs to service/repo architecture
This commit is contained in:
parent
5c255fb34b
commit
49e14b5bc5
37 changed files with 1019 additions and 687 deletions
|
|
@ -1,15 +1,15 @@
|
|||
package controller
|
||||
|
||||
import (
|
||||
"arimelody-web/model"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
"arimelody-web/model/app"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Returns the request's original IP address, resolving the `x-forwarded-for`
|
||||
// header if the request originates from a trusted proxy.
|
||||
func ResolveIP(app *model.AppState, r *http.Request) string {
|
||||
func ResolveIP(app *app.AppState, r *http.Request) string {
|
||||
addr := strings.Split(r.RemoteAddr, ":")[0]
|
||||
if slices.Contains(app.Config.TrustedProxies, addr) {
|
||||
forwardedFor := r.Header.Get("x-forwarded-for")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue