1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 07:09:43 +02:00

major package structure refactoring

This commit is contained in:
Harvey Kandola 2017-07-18 21:55:17 +01:00
parent 7b8cec9a6c
commit cf58f8164d
73 changed files with 549 additions and 389 deletions

View file

@ -15,13 +15,13 @@ import (
"database/sql"
"fmt"
"net/http"
"strings"
"time"
"github.com/gorilla/context"
"github.com/jmoiron/sqlx"
"github.com/documize/community/core/log"
"github.com/documize/community/core/utility"
)
var rc = Context{}
@ -76,7 +76,12 @@ func SetContext(r *http.Request, c Context) {
c.SSL = r.TLS != nil
// get user IP from request
c.ClientIP = utility.GetRemoteIP(r.RemoteAddr)
i := strings.LastIndex(r.RemoteAddr, ":")
if i == -1 {
c.ClientIP = r.RemoteAddr
} else {
c.ClientIP = r.RemoteAddr[:i]
}
fip := r.Header.Get("X-Forwarded-For")
if len(fip) > 0 {