Documentation
¶
Index ¶
- Variables
- func CleanupValueSesionState(www http.ResponseWriter, req *http.Request)
- func CreateValueSesionState(www http.ResponseWriter, req *http.Request, v *SesionStateValueSetType)
- func DeleteValueSesionState(www http.ResponseWriter, req *http.Request, name string)
- func GenCookie(Name, Value, CookiePath, Domain, Expires string, MaxAge int, ...) (theCookie *http.Cookie)
- func GenerateSaveState(www http.ResponseWriter, req *http.Request) (rv string)
- func GetAllValueFromSesionState(www http.ResponseWriter, req *http.Request) (rv string)
- func GetRedisValues(key string) (rv string, err error)
- func GetValueFromSesionState(www http.ResponseWriter, req *http.Request, name string, uc DataScopeFlag) (found bool, val string)
- func HandleDelState(www http.ResponseWriter, req *http.Request)
- func HandleGetAllState(www http.ResponseWriter, req *http.Request)
- func HandleGetState(www http.ResponseWriter, req *http.Request)
- func HandleResetToDefault(www http.ResponseWriter, req *http.Request)
- func HandleSetState(www http.ResponseWriter, req *http.Request)
- func HandleStatus(www http.ResponseWriter, req *http.Request)
- func HasCookie(cookieName string, www http.ResponseWriter, req *http.Request) (has bool, val string)
- func IsDirtySesionState(www http.ResponseWriter, req *http.Request) bool
- func NewPageStateHandler(handler http.Handler, mux *ymux.ServeMux, out io.Writer, ...) http.Handler
- func ResetSesionState(www http.ResponseWriter, req *http.Request)
- func SetCookie(cookieName, cookieValue string, www http.ResponseWriter, req *http.Request)
- func SetJsonHdr(www http.ResponseWriter, req *http.Request)
- func SetJsonPHdr(www http.ResponseWriter, req *http.Request)
- func SetRedisSesionState(key, data string)
- func SetValueSesionState(www http.ResponseWriter, req *http.Request, name, value string, ...) (err error)
- func Setup(gcfg *ymux.BaseConfigType, dbf map[string]bool, f *os.File, gitCommit string, ...)
- func SetupMux(mux *ymux.ServeMux)
- func SetupNoDoc(b bool)
- type DataScopeFlag
- type PageStateHandler
- type PstateConfigType
- type SesionStateContextType
- type SesionStateOneValueType
- type SesionStateValueSetType
Constants ¶
This section is empty.
Variables ¶
var DbFlag = make(map[string]bool)
var GitCommit string
var SesionStateValueMux *sync.Mutex
Functions ¶
func CleanupValueSesionState ¶
func CleanupValueSesionState(www http.ResponseWriter, req *http.Request)
CleanupValueSesionState discard the sesion state at the end of processing - cleanup memory.
func CreateValueSesionState ¶
func CreateValueSesionState(www http.ResponseWriter, req *http.Request, v *SesionStateValueSetType)
func DeleteValueSesionState ¶
func DeleteValueSesionState(www http.ResponseWriter, req *http.Request, name string)
func GenCookie ¶
func GenCookie(Name, Value, CookiePath, Domain, Expires string, MaxAge int, Secure, HttpOnly bool) (theCookie *http.Cookie)
http.SetCookie(www, hdlr.GenCookie())
// --------------------------------------------------------------------------------------------------------------------------
type CookieHandlerType struct {
Next http.Handler
Paths []string
Name string // if Name starts with "-" then delete existing header before creating new one.
Value string // if Value is "" then do not set header.
CookiePath string //
Domain string //
Expires string // (time) // Xyzzy - need a time type
MaxAge int //
Secure bool //
HttpOnly bool //
LineNo int
// theCookie http.Cookie
}
func GenerateSaveState ¶
func GenerateSaveState(www http.ResponseWriter, req *http.Request) (rv string)
func GetAllValueFromSesionState ¶
func GetAllValueFromSesionState(www http.ResponseWriter, req *http.Request) (rv string)
func GetRedisValues ¶
GetRedisValue looks in redis for the `key` and gets back the value from that key or it returns an error.
func GetValueFromSesionState ¶
func GetValueFromSesionState(www http.ResponseWriter, req *http.Request, name string, uc DataScopeFlag) (found bool, val string)
func HandleDelState ¶
func HandleDelState(www http.ResponseWriter, req *http.Request)
func HandleGetAllState ¶
func HandleGetAllState(www http.ResponseWriter, req *http.Request)
func HandleGetState ¶
func HandleGetState(www http.ResponseWriter, req *http.Request)
func HandleResetToDefault ¶
func HandleResetToDefault(www http.ResponseWriter, req *http.Request)
Called setup: mux.Handle("/api/v2/resetToDefaultState", http.HandlerFunc(HandleResetToDefault)).Method("GET", "POST").DocTag("<h2>/api/v2/resetToDefaultState").Inputs([]*ymux.MuxInput{})
func HandleSetState ¶
func HandleSetState(www http.ResponseWriter, req *http.Request)
func HandleStatus ¶
func HandleStatus(www http.ResponseWriter, req *http.Request)
HandleStatus - server to respond with a working message if up.
func HasCookie ¶
func HasCookie(cookieName string, www http.ResponseWriter, req *http.Request) (has bool, val string)
HasCookie returns true, `has` and a value if the cookie exists. If not then it returns false.
func IsDirtySesionState ¶
func IsDirtySesionState(www http.ResponseWriter, req *http.Request) bool
func NewPageStateHandler ¶
func ResetSesionState ¶
func ResetSesionState(www http.ResponseWriter, req *http.Request)
func SetCookie ¶
func SetCookie(cookieName, cookieValue string, www http.ResponseWriter, req *http.Request)
SetCookie sets the header to create a cookie. If using TLS then this will be a secure HTTP-Only cookie.
func SetJsonHdr ¶
func SetJsonHdr(www http.ResponseWriter, req *http.Request)
func SetJsonPHdr ¶
func SetJsonPHdr(www http.ResponseWriter, req *http.Request)
func SetRedisSesionState ¶
func SetRedisSesionState(key, data string)
SetRedisSesionState Sets `key` to value `data` in redis.
func SetValueSesionState ¶
func SetValueSesionState(www http.ResponseWriter, req *http.Request, name, value string, uc DataScopeFlag) (err error)
func Setup ¶
func Setup(gcfg *ymux.BaseConfigType, dbf map[string]bool, f *os.File, gitCommit string, pcfg *PstateConfigType)
------------------------------------------------------------------------------------------------------------------------------------- Setup / Library stuff -------------------------------------------------------------------------------------------------------------------------------------
Types ¶
type DataScopeFlag ¶
type DataScopeFlag int
const ( ServerOnlyData DataScopeFlag = 1 ClientData DataScopeFlag = 2 )
type PageStateHandler ¶
type PageStateHandler struct {
// contains filtered or unexported fields
}
func (*PageStateHandler) ServeHTTP ¶
func (h *PageStateHandler) ServeHTTP(www http.ResponseWriter, req *http.Request)
ServeHTTP is a standard http.Handler that checks to see if this path requires authentication. If authentication is required then it is checked before going to the next layer down.
type PstateConfigType ¶
type PstateConfigType struct {
DefaultValue string `json:"pstate_default_session" default:"{}"`
CookieName string `json:"pstate_session_cookie_name" default:"X-Go-FTL-Sesion-Id"`
RedisKeyPrefix string `json:"pstate_redis_prefix" default:"pstate:"`
TtlRedis int `json:"pstate_session_persistence" default:"2592000"` // 30 days * # of sec per day ( 60 * 60 * 24 )
}
type SesionStateContextType ¶
type SesionStateContextType struct {
PerReqData map[*http.Request]*SesionStateValueSetType
}
var SesionStateValue SesionStateContextType
type SesionStateOneValueType ¶
type SesionStateOneValueType struct {
Value string `json:"value"`
Dirty bool `json:"-"`
Deleted bool `json:"-"`
UserClient DataScopeFlag `json:"uc"`
}
type SesionStateValueSetType ¶
type SesionStateValueSetType map[string]SesionStateOneValueType