This commit is contained in:
nemunaire 2021-02-13 18:34:44 +01:00
commit 2f4cc04db2
7 changed files with 30 additions and 29 deletions

View file

@ -27,7 +27,6 @@ type loginUpload struct {
Password string
}
func (l loginChecker) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if addr := r.Header.Get("X-Forwarded-For"); addr != "" {
r.RemoteAddr = addr
@ -86,7 +85,7 @@ func (l loginChecker) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var ip net.IP
spl := strings.SplitN(r.RemoteAddr, ":", 2)
if ip = net.ParseIP(spl[0]); ip == nil {
http.Error(w, "Unable to parse given IPv4: " + spl[0], http.StatusInternalServerError)
http.Error(w, "Unable to parse given IPv4: "+spl[0], http.StatusInternalServerError)
return
}
var mac *ARPEntry
@ -120,9 +119,9 @@ func (l loginChecker) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
type myIP struct {
Id int64 `json:"id"`
Login string `json:"login"`
IP string `json:"ip"`
Id int64 `json:"id"`
Login string `json:"login"`
IP string `json:"ip"`
}
func (l loginChecker) registerUser(username, remoteAddr string, ent ARPEntry) (net.IP, error) {