Documentation ¶
Index ¶
- Variables
- func AddCookie(w http.ResponseWriter, name, value string, inDays int)
- func AddSecureCookie(w http.ResponseWriter, name, value string, inDays int)
- func AnError(www http.ResponseWriter, req *http.Request, httpStatus int, msg string)
- func Exists(name string) bool
- func Fopen(fn string, mode string) (file *os.File, err error)
- func GenRandBytes(nRandBytes int) (buf []byte, err error)
- func GenRandNumber(nDigits int) (buf string)
- func GenUUID() string
- func GetCookie(www http.ResponseWriter, req *http.Request, cookieName string) (val string)
- func GetMultipleVar(name []string, www http.ResponseWriter, req *http.Request) (found bool, value map[string]string)
- func GetParam(www http.ResponseWriter, req *http.Request, name string, dflt string) (rv string)
- func GetVar(name string, www http.ResponseWriter, req *http.Request) (found bool, value string)
- func HaveCookie(www http.ResponseWriter, req *http.Request, cookieName string) bool
- func IsTLS(req *http.Request) bool
- func RedisClient(gCfg *RedisConfigType) (client *redis.Client, conFlag bool)
- func SVar(v interface{}) string
- func SVarI(v interface{}) string
- func SetCookie(www http.ResponseWriter, req *http.Request, cookieName, value string, ...)
- func SetSecureCookie(www http.ResponseWriter, req *http.Request, cookieName, value string, ...)
- func SetSupport(dbf map[string]bool, lfp *os.File)
- type RedisConfigType
- type RedisConnection
- func (rCon *RedisConnection) CheckAuth(www http.ResponseWriter, req *http.Request) (ok bool)
- func (rCon *RedisConnection) CheckSetup()
- func (rCon *RedisConnection) CreateUser(un, pw string) (err error)
- func (rCon *RedisConnection) DelRedis(key string) (err error)
- func (rCon *RedisConnection) GetRedis(key string) (rv string, err error)
- func (rCon *RedisConnection) SetRedis(key, data string) (err error)
- func (rCon *RedisConnection) SetRedisTTL(key, data string, Ttl int) (err error)
Constants ¶
This section is empty.
Variables ¶
var NIterations = 50000 // # of iterations of hashing for passwords
Functions ¶
func AddCookie ¶
func AddCookie(w http.ResponseWriter, name, value string, inDays int)
addCookie will apply a new cookie to the response of a http request, with the key/value this method is passed.
func AddSecureCookie ¶
func AddSecureCookie(w http.ResponseWriter, name, value string, inDays int)
func GenRandBytes ¶
Should move to aesccm package
func GenRandNumber ¶
Generate a random number, 0..N, returned as a string with 6 to 8 non-zero digits.
func GetMultipleVar ¶
func HaveCookie ¶
func RedisClient ¶
func RedisClient(gCfg *RedisConfigType) (client *redis.Client, conFlag bool)
RedisClient makes a connection to the Redis datagbase and returns the client connection and a true/false flag. If the configuration includes an non-empty RedisConnectAuth then it will also do authenication with the AUTH command in the redis system.
func SVarI ¶
func SVarI(v interface{}) string
SVarI marshals data into a JSON string with tab indentation
func SetSecureCookie ¶
Types ¶
type RedisConfigType ¶
type RedisConnection ¶
type RedisConnection struct { TtlRedis int // contains filtered or unexported fields }
---------------------------------------------------------------------------------------------------------------------- Redis interface ----------------------------------------------------------------------------------------------------------------------
func NewRedisConnection ¶
func NewRedisConnection(gCfg *RedisConfigType) (rv *RedisConnection, err error)
func (*RedisConnection) CheckAuth ¶
func (rCon *RedisConnection) CheckAuth(www http.ResponseWriter, req *http.Request) (ok bool)
CheckAuth Checks a X-Auth header authentication to validate a user. It returns true if the user is authorized, else it creates a 401 error and returns. func (rCon *RedisConnection) GetRedis(key string) (rv string, err error) {
func (*RedisConnection) CheckSetup ¶
func (rCon *RedisConnection) CheckSetup()
CheckSetup checks to see if the Redis database has been initialized. If not -then it creates the necessary keys init.
func (*RedisConnection) CreateUser ¶
func (rCon *RedisConnection) CreateUser(un, pw string) (err error)
CreateUser will create a user in Redis with a qr-auth: and qr-salt: keys.
func (*RedisConnection) DelRedis ¶
func (rCon *RedisConnection) DelRedis(key string) (err error)
func (*RedisConnection) GetRedis ¶
func (rCon *RedisConnection) GetRedis(key string) (rv string, err error)
GetRedis queries redis to return a value.
func (*RedisConnection) SetRedis ¶
func (rCon *RedisConnection) SetRedis(key, data string) (err error)
SetRedis Sets `key` to value `data` in redis.
func (*RedisConnection) SetRedisTTL ¶
func (rCon *RedisConnection) SetRedisTTL(key, data string, Ttl int) (err error)
SetRedis Sets `key` to value `data` in redis.