Git Product home page Git Product logo

go-sessions's Introduction



Build Status License Releases Read me docs Build Status Built with GoLang Platforms

Fast http sessions manager for Go.
Simple API, while providing robust set of features such as immutability, expiration time (can be shifted), databases like badger and redis as back-end storage.

Quick view

import "github.com/kataras/go-sessions/v3"

sess := sessions.Start(http.ResponseWriter, *http.Request)
sess.
  ID() string
  Get(string) interface{}
  HasFlash() bool
  GetFlash(string) interface{}
  GetFlashString(string) string
  GetString(key string) string
  GetInt(key string) (int, error)
  GetInt64(key string) (int64, error)
  GetFloat32(key string) (float32, error)
  GetFloat64(key string) (float64, error)
  GetBoolean(key string) (bool, error)
  GetAll() map[string]interface{}
  GetFlashes() map[string]interface{}
  VisitAll(cb func(k string, v interface{}))
  Set(string, interface{})
  SetImmutable(key string, value interface{})
  SetFlash(string, interface{})
  Delete(string)
  Clear()
  ClearFlashes()

Installation

The only requirement is the Go Programming Language, at least 1.14.

$ go get github.com/kataras/go-sessions/v3

go.mod

module your_app

go 1.19

require (
	github.com/kataras/go-sessions/v3 v3.3.1
)

Features

Documentation

Take a look at the ./examples folder.

Outline

// Start starts the session for the particular net/http request
Start(w http.ResponseWriter,r *http.Request) Session
// ShiftExpiration move the expire date of a session to a new date
// by using session default timeout configuration.
ShiftExpiration(w http.ResponseWriter, r *http.Request)
// UpdateExpiration change expire date of a session to a new date
// by using timeout value passed by `expires` receiver.
UpdateExpiration(w http.ResponseWriter, r *http.Request, expires time.Duration)
// Destroy kills the net/http session and remove the associated cookie
Destroy(w http.ResponseWriter,r  *http.Request)

// Start starts the session for the particular valyala/fasthttp request
StartFasthttp(ctx *fasthttp.RequestCtx) Session
// ShiftExpirationFasthttp move the expire date of a session to a new date
// by using session default timeout configuration.
ShiftExpirationFasthttp(ctx *fasthttp.RequestCtx)
// UpdateExpirationFasthttp change expire date of a session to a new date
// by using timeout value passed by `expires` receiver.
UpdateExpirationFasthttp(ctx *fasthttp.RequestCtx, expires time.Duration)
// Destroy kills the valyala/fasthttp session and remove the associated cookie
DestroyFasthttp(ctx *fasthttp.RequestCtx)

// DestroyByID removes the session entry
// from the server-side memory (and database if registered).
// Client's session cookie will still exist but it will be reseted on the next request.
//
// It's safe to use it even if you are not sure if a session with that id exists.
// Works for both net/http & fasthttp
DestroyByID(string)
// DestroyAll removes all sessions
// from the server-side memory (and database if registered).
// Client's session cookie will still exist but it will be reseted on the next request.
// Works for both net/http & fasthttp
DestroyAll()

// UseDatabase ,optionally, adds a session database to the manager's provider,
// a session db doesn't have write access
// see https://github.com/kataras/go-sessions/tree/master/sessiondb
UseDatabase(Database)

Configuration

// Config is the configuration for sessions. Please read it before using sessions.
Config struct {
	// Cookie string, the session's client cookie name, for example: "mysessionid"
	//
	// Defaults to "irissessionid".
	Cookie string

	// CookieSecureTLS set to true if server is running over TLS
	// and you need the session's cookie "Secure" field to be setted true.
	//
	// Note: The user should fill the Decode configuation field in order for this to work.
	// Recommendation: You don't need this to be setted to true, just fill the Encode and Decode fields
	// with a third-party library like secure cookie, example is provided at the _examples folder.
	//
	// Defaults to false.
	CookieSecureTLS bool

	// AllowReclaim will allow to
	// Destroy and Start a session in the same request handler.
	// All it does is that it removes the cookie for both `Request` and `ResponseWriter` while `Destroy`
	// or add a new cookie to `Request` while `Start`.
	//
	// Defaults to false.
	AllowReclaim bool

	// Encode the cookie value if not nil.
	// Should accept as first argument the cookie name (config.Cookie)
	//         as second argument the server's generated session id.
	// Should return the new session id, if error the session id setted to empty which is invalid.
	//
	// Note: Errors are not printed, so you have to know what you're doing,
	// and remember: if you use AES it only supports key sizes of 16, 24 or 32 bytes.
	// You either need to provide exactly that amount or you derive the key from what you type in.
	//
	// Defaults to nil.
	Encode func(cookieName string, value interface{}) (string, error)
	// Decode the cookie value if not nil.
	// Should accept as first argument the cookie name (config.Cookie)
	//               as second second accepts the client's cookie value (the encoded session id).
	// Should return an error if decode operation failed.
	//
	// Note: Errors are not printed, so you have to know what you're doing,
	// and remember: if you use AES it only supports key sizes of 16, 24 or 32 bytes.
	// You either need to provide exactly that amount or you derive the key from what you type in.
	//
	// Defaults to nil.
	Decode func(cookieName string, cookieValue string, v interface{}) error

	// Encoding same as Encode and Decode but receives a single instance which
	// completes the "CookieEncoder" interface, `Encode` and `Decode` functions.
	//
	// Defaults to nil.
	Encoding Encoding

	// Expires the duration of which the cookie must expires (created_time.Add(Expires)).
	// If you want to delete the cookie when the browser closes, set it to -1.
	//
	// 0 means no expire, (24 years)
	// -1 means when browser closes
	// > 0 is the time.Duration which the session cookies should expire.
	//
	// Defaults to infinitive/unlimited life duration(0).
	Expires time.Duration

	// SessionIDGenerator should returns a random session id.
	// By default we will use a uuid impl package to generate
	// that, but developers can change that with simple assignment.
	SessionIDGenerator func() string

	// DisableSubdomainPersistence set it to true in order dissallow your subdomains to have access to the session cookie
	//
	// Defaults to false.
	DisableSubdomainPersistence bool
}

Usage NET/HTTP

Start returns a Session, Session outline

ID() string
Get(string) interface{}
HasFlash() bool
GetFlash(string) interface{}
GetString(key string) string
GetFlashString(string) string
GetInt(key string) (int, error)
GetInt64(key string) (int64, error)
GetFloat32(key string) (float32, error)
GetFloat64(key string) (float64, error)
GetBoolean(key string) (bool, error)
GetAll() map[string]interface{}
GetFlashes() map[string]interface{}
VisitAll(cb func(k string, v interface{}))
Set(string, interface{})
SetImmutable(key string, value interface{})
SetFlash(string, interface{})
Delete(string)
Clear()
ClearFlashes()
package main

import (
	"fmt"
	"net/http"
	"time"

	"github.com/kataras/go-sessions/v3"
)

type businessModel struct {
	Name string
}

func main() {
	app := http.NewServeMux()
	sess := sessions.New(sessions.Config{
		// Cookie string, the session's client cookie name, for example: "mysessionid"
		//
		// Defaults to "gosessionid"
		Cookie: "mysessionid",
		// it's time.Duration, from the time cookie is created, how long it can be alive?
		// 0 means no expire.
		// -1 means expire when browser closes
		// or set a value, like 2 hours:
		Expires: time.Hour * 2,
		// if you want to invalid cookies on different subdomains
		// of the same host, then enable it
		DisableSubdomainPersistence: false,
		// want to be crazy safe? Take a look at the "securecookie" example folder.
	})

	app.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte(fmt.Sprintf("You should navigate to the /set, /get, /delete, /clear,/destroy instead")))
	})
	app.HandleFunc("/set", func(w http.ResponseWriter, r *http.Request) {

		//set session values.
		s := sess.Start(w, r)
		s.Set("name", "iris")

		//test if setted here
		w.Write([]byte(fmt.Sprintf("All ok session setted to: %s", s.GetString("name"))))

		// Set will set the value as-it-is,
		// if it's a slice or map
		// you will be able to change it on .Get directly!
		// Keep note that I don't recommend saving big data neither slices or maps on a session
		// but if you really need it then use the `SetImmutable` instead of `Set`.
		// Use `SetImmutable` consistently, it's slower.
		// Read more about muttable and immutable go types: https://stackoverflow.com/a/8021081
	})

	app.HandleFunc("/get", func(w http.ResponseWriter, r *http.Request) {
		// get a specific value, as string, if no found returns just an empty string
		name := sess.Start(w, r).GetString("name")

		w.Write([]byte(fmt.Sprintf("The name on the /set was: %s", name)))
	})

	app.HandleFunc("/delete", func(w http.ResponseWriter, r *http.Request) {
		// delete a specific key
		sess.Start(w, r).Delete("name")
	})

	app.HandleFunc("/clear", func(w http.ResponseWriter, r *http.Request) {
		// removes all entries
		sess.Start(w, r).Clear()
	})

	app.HandleFunc("/update", func(w http.ResponseWriter, r *http.Request) {
		// updates expire date
		sess.ShiftExpiration(w, r)
	})

	app.HandleFunc("/destroy", func(w http.ResponseWriter, r *http.Request) {

		//destroy, removes the entire session data and cookie
		sess.Destroy(w, r)
	})
	// Note about Destroy:
	//
	// You can destroy a session outside of a handler too, using the:
	// mySessions.DestroyByID
	// mySessions.DestroyAll

	// remember: slices and maps are muttable by-design
	// The `SetImmutable` makes sure that they will be stored and received
	// as immutable, so you can't change them directly by mistake.
	//
	// Use `SetImmutable` consistently, it's slower than `Set`.
	// Read more about muttable and immutable go types: https://stackoverflow.com/a/8021081
	app.HandleFunc("/set_immutable", func(w http.ResponseWriter, r *http.Request) {
		business := []businessModel{{Name: "Edward"}, {Name: "value 2"}}
		s := sess.Start(w, r)
		s.SetImmutable("businessEdit", business)
		businessGet := s.Get("businessEdit").([]businessModel)

		// try to change it, if we used `Set` instead of `SetImmutable` this
		// change will affect the underline array of the session's value "businessEdit", but now it will not.
		businessGet[0].Name = "Gabriel"

	})

	app.HandleFunc("/get_immutable", func(w http.ResponseWriter, r *http.Request) {
		valSlice := sess.Start(w, r).Get("businessEdit")
		if valSlice == nil {
			w.Header().Set("Content-Type", "text/html; charset=UTF-8")
			w.Write([]byte("please navigate to the <a href='/set_immutable'>/set_immutable</a> first"))
			return
		}

		firstModel := valSlice.([]businessModel)[0]
		// businessGet[0].Name is equal to Edward initially
		if firstModel.Name != "Edward" {
			panic("Report this as a bug, immutable data cannot be changed from the caller without re-SetImmutable")
		}

		w.Write([]byte(fmt.Sprintf("[]businessModel[0].Name remains: %s", firstModel.Name)))

		// the name should remains "Edward"
	})

	http.ListenAndServe(":8080", app)
}

Usage FASTHTTP

StartFasthttp returns the same object as Start, Session.

ID() string
Get(string) interface{}
HasFlash() bool
GetFlash(string) interface{}
GetString(key string) string
GetFlashString(string) string
GetInt(key string) (int, error)
GetInt64(key string) (int64, error)
GetFloat32(key string) (float32, error)
GetFloat64(key string) (float64, error)
GetBoolean(key string) (bool, error)
GetAll() map[string]interface{}
GetFlashes() map[string]interface{}
VisitAll(cb func(k string, v interface{}))
Set(string, interface{})
SetImmutable(key string, value interface{})
SetFlash(string, interface{})
Delete(string)
Clear()
ClearFlashes()

We have only one simple example because the API is the same, the returned session is the same for both net/http and valyala/fasthttp.

Just append the word "Fasthttp", the rest of the API remains as it's with net/http.

Start for net/http, StartFasthttp for valyala/fasthttp. ShiftExpiration for net/http, ShiftExpirationFasthttp for valyala/fasthttp. UpdateExpiration for net/http, UpdateExpirationFasthttp for valyala/fasthttp. Destroy for net/http, DestroyFasthttp for valyala/fasthttp.

package main

import (
	"fmt"

	"github.com/kataras/go-sessions/v3"
	"github.com/valyala/fasthttp"
)

func main() {
// set some values to the session
setHandler := func(reqCtx *fasthttp.RequestCtx) {
	values := map[string]interface{}{
		"Name":   "go-sessions",
		"Days":   "1",
		"Secret": "dsads£2132215£%%Ssdsa",
	}

	sess := sessions.StartFasthttp(reqCtx) // init the session
	// sessions.StartFasthttp returns the, same, Session interface we saw before too

	for k, v := range values {
		sess.Set(k, v) // fill session, set each of the key-value pair
	}
	reqCtx.WriteString("Session saved, go to /get to view the results")
}

// get the values from the session
getHandler := func(reqCtx *fasthttp.RequestCtx) {
	sess := sessions.StartFasthttp(reqCtx) // init the session
	sessValues := sess.GetAll()            // get all values from this session

	reqCtx.WriteString(fmt.Sprintf("%#v", sessValues))
}

// clear all values from the session
clearHandler := func(reqCtx *fasthttp.RequestCtx) {
	sess := sessions.StartFasthttp(reqCtx)
	sess.Clear()
}

// destroys the session, clears the values and removes the server-side entry and client-side sessionid cookie
destroyHandler := func(reqCtx *fasthttp.RequestCtx) {
	sessions.DestroyFasthttp(reqCtx)
}

fmt.Println("Open a browser tab and navigate to the localhost:8080/set")
fasthttp.ListenAndServe(":8080", func(reqCtx *fasthttp.RequestCtx) {
	path := string(reqCtx.Path())

	if path == "/set" {
		setHandler(reqCtx)
	} else if path == "/get" {
		getHandler(reqCtx)
	} else if path == "/clear" {
		clearHandler(reqCtx)
	} else if path == "/destroy" {
		destroyHandler(reqCtx)
	} else {
		reqCtx.WriteString("Please navigate to /set or /get or /clear or /destroy")
	}
})
}

FAQ

If you'd like to discuss this package, or ask questions about it, feel free to

Versioning

Current: v3.3.0

Read more about Semantic Versioning 2.0.0

People

The author of go-sessions is @kataras.

Contributing

If you are interested in contributing to the go-sessions project, please make a PR.

License

This project is licensed under the MIT License.

License can be found here.

go-sessions's People

Contributors

dependabot[bot] avatar frankcai4real avatar ilyabrin avatar kataras avatar monoflash avatar rikvdh avatar trim21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-sessions's Issues

Only set cookie if there is a session?

Hi, is there any way of setting the cookie to be set on the browser manually rather than with every request?

ie only if there is a value in session or once a route is requested?

Thanks

Cannot get latest version: module contains a go.mod file, so module path should be github.com/kataras/go-sessions/v3

Background

The github.com/kataras/go-sessions uses Go modules and the current release version is v3. And it’s module path is "github.com/kataras/go-sessions", instead of "github.com/kataras/go-sessions/v3". It must comply with the specification of "Releasing Modules for v2 or higher" available in the Modules documentation. Quoting the specification:

A package that has opted in to modules must include the major version in the import path to import any v2+ modules
To preserve import compatibility, the go command requires that modules with major version v2 or later use a module path with that major version as the final element. For example, version v2.0.0 of example.com/m must instead use module path example.com/m/v2.
https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher

Steps to Reproduce

GO111MODULE=on, run go get targeting any version >= v3.1.0 of the kataras/go-sessions:

$ go get github.com/kataras/[email protected]
go: finding github.com/kataras/go-sessions v3.1.0
go: finding github.com/kataras/go-sessions v3.1.0
go get github.com/kataras/[email protected]: github.com/kataras/[email protected]: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v3

run go get github.com/kataras/go-sessions, the version will stuck in v3.0.0:

$go get github.com/kataras/go-sessions
go: downloading github.com/kataras/go-sessions v0.0.7
go: downloading github.com/kataras/go-sessions v3.0.0+incompatible
go: github.com/kataras/go-sessions upgrade => v3.0.0+incompatible 

SO anyone using Go modules will not be able to easily use any newer version of kataras/go-sessions.

Solution

1. Kill the go.mod files, rolling back to GOPATH.

This would push them back to not being managed by Go modules (instead of incorrectly using Go modules).
Ensure compatibility for downstream module-aware projects and module-unaware projects projects

2. Fix module path to strictly follow SIV rules.

Patch the go.mod file to declare the module path as github.com/kataras/go-sessions/v3 as per the specs. And adjust all internal imports.
The downstream projects might be negatively affected in their building if they are module-unaware (Go versions older than 1.9.7 and 1.10.3; Or use third-party dependency management tools, such as: Dep, glide,govendor…).

[*] You can see who will be affected here: [17 module-unaware users, i.e., ttstringiot/golangiot, wjl2017/ttstringgolangiot, qnib/jupyterport ]
https://github.com/search?q=kataras%2Fgo-sessions+filename%3Avendor.conf+filename%3Avendor.json+filename%3Aglide.toml+filename%3AGodep.toml&type=Code

If you don't want to break the above repos. This method can provides better backwards-compatibility.
Release a v2 or higher module through the major subdirectory strategy: Create a new v3 subdirectory (github.com/kataras/go-sessions/v3) and place a new go.mod file in that subdirectory. The module path must end with /v3. Copy or move the code into the v3 subdirectory. Update import statements within the module to also use /v3 (import "github.com/kataras/go-sessions/v3/…"). Tag the release with v3.x.y.

3. Suggest your downstream module users use hash instead of a version tag.

If the standard rule of go modules conflicts with your development mode. Or not intended to be used as a library and does not make any guarantees about the API. So you can’t comply with the specification of "Releasing Modules for v2 or higher" available in the Modules documentation.
Regardless, since it's against one of the design choices of Go, it'll be a bit of a hack. Instead of go get github.com/kataras/go-sessions@version-tag, module users need to use this following way to get the kataras/go-sessions:
(1) Search for the tag you want (in browser)
(2) Get the commit hash for the tag you want
(3) Run go get github.com/kataras/go-sessions@commit-hash
(4) Edit the go.mod file to put a comment about which version you actually used
This will make it difficult for module users to get and upgrade kataras/go-sessions.

[*] You can see who will be affected here: [12 module users, e.g., AlexSwiss/go-login, dickyaryag6/Mini-e-wallet-using-GO, juliaveronica02/whatsapp-go]
https://github.com/search?o=desc&q=kataras%2Fgo-sessions+filename%3Ago.mod&s=indexed&type=Code

Summary

You can make a choice to fix DM issues by balancing your own development schedules/mode against the affects on the downstream projects.

For this issue, Solution 1 can maximize your benefits and with minimal impacts to your downstream projects the ecosystem.

References

session is abnormal

Why does this happen?

TXJ0QVRSdE94cEZ6V1BLU1pIUGp4S0pGcWRPd0VRaEw%252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525253D

incompatible go mod with uuid package

/pkg/mod/github.com/kataras/[email protected]+incompatible/config.go:127:10: assignment mismatch: 2 variables but uuid.NewV4 returns 1 values

github.com/satori/go.uuid v1.2.0 // indirect
github.com/kataras/go-sessions v3.0.0+incompatible

use redis and restart server

[ERRO] 2017/09/30 13:26 error while trying to load session values(1027f009-8996-47b0-bb21-fd090e07c265) from redis:
the retrieved value is not a sessions.RemoteStore type, please report that as bug, it should never occur

unknown field 'DecodeCookie' in struct literal of type sessions.Config

why no field DecodeCookie, I can find it in config.go
my code is
sess := sessions.New(sessions.Config{
Cookie: model.Cfg.CookieName,
//DecodeCookie: false,
Expires: time.Duration(model.Cfg.CookieDuration),
CookieLength: 32,
DisableSubdomainPersistence: false,
)}
I commet the DecodeCookie field line,then pass build

Flaw in redis backend architecture

In recent redis backend update it seems like session fields are stored as a individual key value pair where value is a JSON encoded bydefault (default encode/decoder) and are namespaced as sessionid_fieldname.

Methods like Clear uses redis SCAN with count 9999999999 to find all the fields and clear it but this is a bad approach since redis SCAN is a blocking command and in a system with reasonable number of session keys blocking time is considerably high. I have tested this by inserting few million fake session keys in redis and called Clear method which took several seconds to return.

I think the better approach is to use redis hashmap for storing session. Session fields will be individual keys in the map and values are encoded with default encoder. Clear method can just delete the hashmap to clear the session in backend instead of iterating over keys. Performance of GetAll method all will be improved by redis HGETALL command which returns all the keys for given session id.

I can send a PR to address the above issue. Please let me know what you think.

The SetFlash() function does not work

I use the redis storage engine, and execute SetFlash("test", "ok"), but I have not seen in the redis cookie and write the value, use GetFlashString("test") also does not read the value.

Concurrent map read and map write

I wrote earlier that there is an error with simultaneous access to the map [] sessions in the memory. The error occurs when a very fast access to the server with a raised session.
Use sync.lock on the map (bad idea - not a fast access)
It is best to replace the map[] on the container/list

fatal error: concurrent map read and map write

goroutine 23 [running]:
runtime.throw(0x4d0960f, 0x21)
	/usr/local/go/src/runtime/panic.go:566 +0x95 fp=0xc420e0b230 sp=0xc420e0b210
runtime.mapaccess2_faststr(0x4bde6e0, 0xc420898210, 0x4cebc85, 0x9, 0x43a2790, 0xc420776200)
	/usr/local/go/src/runtime/hashmap_fast.go:306 +0x52b fp=0xc420e0b290 sp=0xc420e0b230
vendor/github.com/kataras/go-sessions.(*session).Get(0xc420ef02a0, 0x4cebc85, 0x9, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/go-sessions/session.go:43 +0xb0 fp=0xc420e0b300 sp=0xc420e0b290
application/middlewares/minify.(*impl).Serve(0xc420dfe030, 0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/middlewares/minify/minify.go:48 +0x114 fp=0xc420e0b4c0 sp=0xc420e0b300
vendor/github.com/kataras/iris.(*Context).Next(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8 fp=0xc420e0b4f0 sp=0xc420e0b4c0
application/middlewares/variables.(*impl).Serve(0xc420dfe028, 0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/middlewares/variables/variables.go:45 +0x4aa fp=0xc420e0b620 sp=0xc420e0b4f0
vendor/github.com/kataras/iris.(*Context).Next(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8 fp=0xc420e0b650 sp=0xc420e0b620
application/routing.(*impl).RecoveryHandlerFunc.func1(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/recovery.go:23 +0x53 fp=0xc420e0b678 sp=0xc420e0b650
vendor/github.com/kataras/iris.HandlerFunc.Serve(0x4d94210, 0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30 fp=0xc420e0b690 sp=0xc420e0b678
vendor/github.com/kataras/iris.(*Context).Next(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8 fp=0xc420e0b6c0 sp=0xc420e0b690
application/routing.(*impl).LoggerHandlerFunc.func1(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/logger.go:36 +0xc7 fp=0xc420e0b9d0 sp=0xc420e0b6c0
vendor/github.com/kataras/iris.HandlerFunc.Serve(0xc420dee050, 0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30 fp=0xc420e0b9e8 sp=0xc420e0b9d0
vendor/github.com/kataras/iris.(*Context).Do(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:117 +0x59 fp=0xc420e0ba08 sp=0xc420e0b9e8
vendor/github.com/kataras/iris.(*serveMux).BuildHandler.func1(0xc420776200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:1092 +0x2e0 fp=0xc420e0bc30 sp=0xc420e0ba08
vendor/github.com/kataras/iris.(*Framework).Build.func1.1(0xc4206ee900)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:367 +0x5f fp=0xc420e0bc70 sp=0xc420e0bc30
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420dfe008, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1533 +0x736 fp=0xc420e0be00 sp=0xc420e0bc70
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420dfe008, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b fp=0xc420e0be50 sp=0xc420e0be00
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420eea060)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f fp=0xc420e0bf58 sp=0xc420e0be50
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420eea060, 0x4b7e840, 0xc420eea060)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35 fp=0xc420e0bf80 sp=0xc420e0bf58
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc420e0bf88 sp=0xc420e0bf80
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc4208956c4)
	/usr/local/go/src/runtime/sema.go:47 +0x30
sync.(*WaitGroup).Wait(0xc4208956b8)
	/usr/local/go/src/sync/waitgroup.go:131 +0x97
application/modules/worker.(*impl).Wait(0xc4208956b0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:247 +0x33
main.Main(0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/backend/main.go:143 +0x1363
main.main()
	/Users/kallisto/Projects/ServerTemplate/backend/src/backend/main.go:33 +0x22

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1

goroutine 10 [runnable]:
regexp.(*inputString).step(0xc420884318, 0x0, 0xffffffff00000000, 0x1)
	/usr/local/go/src/regexp/regexp.go:291
regexp.(*machine).tryBacktrack(0xc420884240, 0xc420d5e060, 0x52c7140, 0xc420884318, 0x1, 0x0, 0xc420f1a000)
	/usr/local/go/src/regexp/backtrack.go:222 +0x73a
regexp.(*machine).backtrack(0xc420884240, 0x52c7140, 0xc420884318, 0x0, 0x3, 0x6, 0x40151ee)
	/usr/local/go/src/regexp/backtrack.go:356 +0x193
regexp.(*Regexp).doExecute(0xc42008e3c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc420d1440c, 0x3, 0x0, 0x6, ...)
	/usr/local/go/src/regexp/exec.go:437 +0x2e5
regexp.(*Regexp).FindStringSubmatch(0xc42008e3c0, 0xc420d1440c, 0x3, 0xc420d14420, 0xc42007d600, 0x4)
	/usr/local/go/src/regexp/regexp.go:903 +0x9d
vendor/github.com/webdeskltd/log/formater.(*impl).TruncateString(0x533c2e8, 0xc420d14420, 0x4, 0xc420d1440c, 0x3, 0xc420d14420, 0x4)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/formater/formater.go:51 +0xee
vendor/github.com/webdeskltd/log/formater.(*impl).FormatedElement(0x533c2e8, 0xc420dca2a0, 0x5, 0x4b3391e, 0x1, 0x4b16e44, 0xb, 0x4b3390c, 0x5, 0xc420d1440c, ...)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/formater/formater.go:129 +0xd0d
vendor/github.com/webdeskltd/log/formater.(*impl).Text(0x533c2e8, 0x6, 0xc420dca2a0, 0x4d02eb3, 0x1c, 0xc420ef07e0, 0x6, 0x6, 0xc420898e40, 0x4d1fabd, ...)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/formater/formater.go:222 +0x60d
vendor/github.com/webdeskltd/log.(*impl).DefaultReceiver(0xc4206e6230, 0x6, 0xc420dca2a0, 0x4d02eb3, 0x1c, 0xc420ef07e0, 0x6, 0x6, 0xc420898e40)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/essence.go:61 +0xab
vendor/github.com/webdeskltd/log.(*impl).DefaultReceiver-fm(0x6, 0xc420dca2a0, 0x4d02eb3, 0x1c, 0xc420ef07e0, 0x6, 0x6, 0xc420898e40)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/essence.go:28 +0x4c
vendor/github.com/webdeskltd/log/sender.(*impl).Receiver(0xc420012480)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/sender/sender.go:61 +0x2c3
created by vendor/github.com/webdeskltd/log/sender.init.1
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/webdeskltd/log/sender/sender.go:12 +0x5f

goroutine 11 [syscall]:
os/signal.signal_recv(0x0)
	/usr/local/go/src/runtime/sigqueue.go:116 +0x157
os/signal.loop()
	/usr/local/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.1
	/usr/local/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 12 [sleep]:
time.Sleep(0x3b9aca00)
	/usr/local/go/src/runtime/time.go:59 +0xe1
vendor/github.com/valyala/fasthttp.init.1.func1()
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/header.go:1372 +0x2e
created by vendor/github.com/valyala/fasthttp.init.1
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/header.go:1375 +0x3a

goroutine 21 [chan receive]:
database/sql.(*DB).connectionOpener(0xc420d70160)
	/usr/local/go/src/database/sql/sql.go:730 +0x4a
created by database/sql.Open
	/usr/local/go/src/database/sql/sql.go:493 +0x1e9

goroutine 14 [chan receive]:
vendor/github.com/geekypanda/httpcache.(*memoryStore).startGC.func1.1(0xc420018c00, 0xc4208cfef0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/geekypanda/httpcache/store.go:138 +0x8b
created by vendor/github.com/geekypanda/httpcache.(*memoryStore).startGC.func1
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/geekypanda/httpcache/store.go:148 +0x6e

goroutine 16 [chan receive]:
vendor/github.com/kataras/iris.(*Framework).Serve(0xc420de6000, 0x52c4540, 0xc420d14100, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:457 +0x30d
application/webserver.(*impl).Serve(0xc420886000, 0x52c4540, 0xc420d14100, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/webserver/webserver.go:68 +0x56
application/workers/web.(*impl).Worker(0xc420895710, 0xc420cdd810, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/workers/web/web.go:67 +0x367
application/modules/worker.(*impl).Start.func2(0xc4208956b0, 0xc420cdd810)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:122 +0x129
created by application/modules/worker.(*impl).Start
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:123 +0x414

goroutine 50 [select]:
application/modules/worker.(*Pith).CanExit(0xc420cdd8f0, 0x34630b8a000, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/pith.go:46 +0x157
application/workers/filestore.(*impl).Worker(0x533c2e8, 0xc420cdd8f0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/workers/filestore/filestore.go:42 +0x1fe
application/modules/worker.(*impl).Start.func2(0xc4208956b0, 0xc420cdd8f0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:122 +0x129
created by application/modules/worker.(*impl).Start
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:123 +0x414

goroutine 51 [select]:
application/modules/worker.(*Pith).CanExit(0xc420cdd9d0, 0xdf8475800, 0xc42002b700)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/pith.go:46 +0x157
application/workers/session.(*impl).Worker(0x533c2e8, 0xc420cdd9d0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/workers/session/session.go:64 +0x66
application/modules/worker.(*impl).Start.func2(0xc4208956b0, 0xc420cdd9d0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:122 +0x129
created by application/modules/worker.(*impl).Start
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:123 +0x414

goroutine 52 [select]:
application/modules/worker.(*Pith).CanExit(0xc420cddab0, 0x77359400, 0xc42002bf00)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/pith.go:46 +0x157
application/workers/cleaner.(*impl).Worker(0x533c2e8, 0xc420cddab0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/workers/cleaner/cleaner.go:63 +0x5c
application/modules/worker.(*impl).Start.func2(0xc4208956b0, 0xc420cddab0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:122 +0x129
created by application/modules/worker.(*impl).Start
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/worker/worker.go:123 +0x414

goroutine 66 [select]:
vendor/github.com/kataras/go-websocket.(*server).serve(0xc420de60a0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/go-websocket/server.go:216 +0xeb3
created by vendor/github.com/kataras/go-websocket.(*server).Serve
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/go-websocket/server.go:211 +0x3f

goroutine 67 [sleep]:
time.Sleep(0x3b9aca00)
	/usr/local/go/src/runtime/time.go:59 +0xe1
main.Main.func3()
	/Users/kallisto/Projects/ServerTemplate/backend/src/backend/main.go:126 +0x33
created by main.Main
	/Users/kallisto/Projects/ServerTemplate/backend/src/backend/main.go:128 +0x1160

goroutine 68 [select, locked to thread]:
runtime.gopark(0x4d953a8, 0x0, 0x4ce85c6, 0x6, 0x18, 0x2)
	/usr/local/go/src/runtime/proc.go:259 +0x13a
runtime.selectgoImpl(0xc420ee8f30, 0x0, 0x18)
	/usr/local/go/src/runtime/select.go:423 +0x11d9
runtime.selectgo(0xc420ee8f30)
	/usr/local/go/src/runtime/select.go:238 +0x1c
runtime.ensureSigM.func1()
	/usr/local/go/src/runtime/signal1_unix.go:304 +0x2d1
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1

goroutine 69 [select]:
application/modules/interrupt.(*impl).Catcher(0xc420886c00)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/interrupt/interrupt.go:71 +0x1d7
created by application/modules/interrupt.(*impl).Start
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/modules/interrupt/interrupt.go:49 +0x3fb

goroutine 22 [IO wait]:
net.runtime_pollWait(0x60919c0, 0x72, 0x7)
	/usr/local/go/src/runtime/netpoll.go:160 +0x59
net.(*pollDesc).wait(0xc420cae060, 0x72, 0xc420a998c0, 0xc420010290)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x38
net.(*pollDesc).waitRead(0xc420cae060, 0x52bed00, 0xc420010290)
	/usr/local/go/src/net/fd_poll_runtime.go:78 +0x34
net.(*netFD).Read(0xc420cae000, 0xc420de4000, 0x1fa0, 0x1fa0, 0x0, 0x52bed00, 0xc420010290)
	/usr/local/go/src/net/fd_unix.go:243 +0x1a1
net.(*conn).Read(0xc420ef6000, 0xc420de4000, 0x1fa0, 0x1fa0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/net.go:173 +0x70
bufio.(*Reader).fill(0xc420ef00c0)
	/usr/local/go/src/bufio/bufio.go:97 +0x10c
bufio.(*Reader).Peek(0xc420ef00c0, 0x1, 0xc4206ca820, 0xc420a99a20, 0x0, 0xc420cae000, 0x4059500)
	/usr/local/go/src/bufio/bufio.go:129 +0x62
vendor/github.com/valyala/fasthttp.(*RequestHeader).tryRead(0xc4208cc480, 0xc420ef00c0, 0x1, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/header.go:1305 +0x79
vendor/github.com/valyala/fasthttp.(*RequestHeader).Read(0xc4208cc480, 0xc420ef00c0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/header.go:1291 +0x62
vendor/github.com/valyala/fasthttp.(*Request).readLimitBody(0xc4208cc480, 0xc420ef00c0, 0x800000, 0x0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/http.go:869 +0x63
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420ef6000, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1479 +0x1253
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420ef6000, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420df41a0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420df41a0, 0x4b7e840, 0xc420df41a0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb

goroutine 54 [IO wait]:
net.runtime_pollWait(0x6091b40, 0x72, 0x0)
	/usr/local/go/src/runtime/netpoll.go:160 +0x59
net.(*pollDesc).wait(0xc420cddbf0, 0x72, 0xc42003dac8, 0xc420010290)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x38
net.(*pollDesc).waitRead(0xc420cddbf0, 0x52bed00, 0xc420010290)
	/usr/local/go/src/net/fd_poll_runtime.go:78 +0x34
net.(*netFD).accept(0xc420cddb90, 0x0, 0x52bb040, 0xc420df4220)
	/usr/local/go/src/net/fd_unix.go:419 +0x238
net.(*TCPListener).accept(0xc420ac65c0, 0x163, 0x162, 0xc42003dbc8)
	/usr/local/go/src/net/tcpsock_posix.go:132 +0x2e
net.(*TCPListener).AcceptTCP(0xc420ac65c0, 0x601b000, 0xc41ffca04e, 0xc42003dc68)
	/usr/local/go/src/net/tcpsock.go:209 +0x49
application/workers/web.TCPKeepAliveListener.Accept(0xc420ac65c0, 0x3, 0x0, 0x0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/workers/web/keepalive.go:19 +0x80
application/workers/web.(*TCPKeepAliveListener).Accept(0xc420d14100, 0x0, 0x0, 0x0, 0x0)
	<autogenerated>:10 +0xaf
vendor/github.com/valyala/fasthttp.acceptConn(0xc4207b0000, 0x52c4540, 0xc420d14100, 0xc42003def8, 0x0, 0x0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1289 +0x80
vendor/github.com/valyala/fasthttp.(*Server).Serve(0xc4207b0000, 0x52c4540, 0xc420d14100, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1258 +0x2ae
vendor/github.com/kataras/iris.(*Framework).Serve.func2(0xc420de6000, 0x52c4540, 0xc420d14100)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:441 +0x45
created by vendor/github.com/kataras/iris.(*Framework).Serve
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:441 +0x1ad

goroutine 55 [chan send]:
vendor/github.com/kataras/iris.(*Framework).Serve.func3(0xc420de6000)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:454 +0x4c
created by vendor/github.com/kataras/iris.(*Framework).Serve
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:454 +0x220

goroutine 82 [sleep]:
time.Sleep(0x2540be400)
	/usr/local/go/src/runtime/time.go:59 +0xe1
vendor/github.com/valyala/fasthttp.(*workerPool).Start.func1(0xc4206bc080, 0xc420df63c0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:59 +0xb1
created by vendor/github.com/valyala/fasthttp.(*workerPool).Start
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:62 +0x103

goroutine 83 [semacquire]:
sync.runtime_Semacquire(0xc420ef02bc)
	/usr/local/go/src/runtime/sema.go:47 +0x30
sync.(*Mutex).Lock(0xc420ef02b8)
	/usr/local/go/src/sync/mutex.go:85 +0xd0
vendor/github.com/kataras/go-sessions.(*session).Set(0xc420ef02a0, 0x4ce792a, 0x6, 0x4b968a0, 0xc420a9a240)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/go-sessions/session.go:87 +0x37
application/middlewares/variables.(*impl).Serve(0xc420dfe028, 0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/middlewares/variables/variables.go:27 +0x163
vendor/github.com/kataras/iris.(*Context).Next(0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).RecoveryHandlerFunc.func1(0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/recovery.go:23 +0x53
vendor/github.com/kataras/iris.HandlerFunc.Serve(0x4d94210, 0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Next(0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).LoggerHandlerFunc.func1(0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/logger.go:36 +0xc7
vendor/github.com/kataras/iris.HandlerFunc.Serve(0xc420dee050, 0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Do(0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:117 +0x59
vendor/github.com/kataras/iris.(*serveMux).BuildHandler.func1(0xc4207e4080)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:1092 +0x2e0
vendor/github.com/kataras/iris.(*Framework).Build.func1.1(0xc4206efb00)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:367 +0x5f
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420ef6008, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1533 +0x736
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420ef6008, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420d0a020)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420d0a020, 0x4b7e840, 0xc420d0a020)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb

goroutine 56 [runnable]:
application/middlewares/variables.(*impl).Serve(0xc420dfe028, 0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/middlewares/variables/variables.go:27 +0x12a
vendor/github.com/kataras/iris.(*Context).Next(0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).RecoveryHandlerFunc.func1(0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/recovery.go:23 +0x53
vendor/github.com/kataras/iris.HandlerFunc.Serve(0x4d94210, 0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Next(0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).LoggerHandlerFunc.func1(0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/logger.go:36 +0xc7
vendor/github.com/kataras/iris.HandlerFunc.Serve(0xc420dee050, 0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Do(0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:117 +0x59
vendor/github.com/kataras/iris.(*serveMux).BuildHandler.func1(0xc4207e4200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:1092 +0x2e0
vendor/github.com/kataras/iris.(*Framework).Build.func1.1(0xc4208cc900)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:367 +0x5f
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420b12028, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1533 +0x736
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420b12028, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420df4240)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420df4240, 0x4b7e840, 0xc420df4240)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb

goroutine 24 [runnable]:
vendor/github.com/kataras/go-sessions.(*session).Set(0xc420ef02a0, 0x4ce792a, 0x6, 0x4b968a0, 0xc420b142b0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/go-sessions/session.go:88 +0x93
application/middlewares/variables.(*impl).Serve(0xc420dfe028, 0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/middlewares/variables/variables.go:27 +0x163
vendor/github.com/kataras/iris.(*Context).Next(0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).RecoveryHandlerFunc.func1(0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/recovery.go:23 +0x53
vendor/github.com/kataras/iris.HandlerFunc.Serve(0x4d94210, 0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Next(0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).LoggerHandlerFunc.func1(0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/logger.go:36 +0xc7
vendor/github.com/kataras/iris.HandlerFunc.Serve(0xc420dee050, 0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Do(0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:117 +0x59
vendor/github.com/kataras/iris.(*serveMux).BuildHandler.func1(0xc42001aa80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:1092 +0x2e0
vendor/github.com/kataras/iris.(*Framework).Build.func1.1(0xc4206ef200)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:367 +0x5f
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420dfe050, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1533 +0x736
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420dfe050, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420d0a420)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420d0a420, 0x4b7e840, 0xc420d0a420)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb

goroutine 25 [IO wait]:
net.runtime_pollWait(0x6091600, 0x72, 0xd)
	/usr/local/go/src/runtime/netpoll.go:160 +0x59
net.(*pollDesc).wait(0xc420c8c4c0, 0x72, 0xc420a958c0, 0xc420010290)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x38
net.(*pollDesc).waitRead(0xc420c8c4c0, 0x52bed00, 0xc420010290)
	/usr/local/go/src/net/fd_poll_runtime.go:78 +0x34
net.(*netFD).Read(0xc420c8c460, 0xc420e00000, 0x1fa0, 0x1fa0, 0x0, 0x52bed00, 0xc420010290)
	/usr/local/go/src/net/fd_unix.go:243 +0x1a1
net.(*conn).Read(0xc420dfe058, 0xc420e00000, 0x1fa0, 0x1fa0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/net.go:173 +0x70
bufio.(*Reader).fill(0xc420018360)
	/usr/local/go/src/bufio/bufio.go:97 +0x10c
bufio.(*Reader).Peek(0xc420018360, 0x1, 0x4037e58, 0xc42001c00c, 0x300000002, 0xc42008d860, 0x11)
	/usr/local/go/src/bufio/bufio.go:129 +0x62
vendor/github.com/valyala/fasthttp.(*RequestHeader).tryRead(0xc420cd6000, 0xc420018360, 0x1, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/header.go:1305 +0x79
vendor/github.com/valyala/fasthttp.(*RequestHeader).Read(0xc420cd6000, 0xc420018360, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/header.go:1291 +0x62
vendor/github.com/valyala/fasthttp.(*Request).readLimitBody(0xc420cd6000, 0xc420018360, 0x800000, 0x0, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/http.go:869 +0x63
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420dfe058, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1479 +0x1253
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420dfe058, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420d0a460)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420d0a460, 0x4b7e840, 0xc420d0a460)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb

goroutine 57 [semacquire]:
sync.runtime_Semacquire(0xc420ef02bc)
	/usr/local/go/src/runtime/sema.go:47 +0x30
sync.(*Mutex).Lock(0xc420ef02b8)
	/usr/local/go/src/sync/mutex.go:85 +0xd0
vendor/github.com/kataras/go-sessions.(*session).Set(0xc420ef02a0, 0x4ce792a, 0x6, 0x4b968a0, 0xc420a9a280)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/go-sessions/session.go:87 +0x37
application/middlewares/variables.(*impl).Serve(0xc420dfe028, 0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/middlewares/variables/variables.go:27 +0x163
vendor/github.com/kataras/iris.(*Context).Next(0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).RecoveryHandlerFunc.func1(0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/recovery.go:23 +0x53
vendor/github.com/kataras/iris.HandlerFunc.Serve(0x4d94210, 0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Next(0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:127 +0xa8
application/routing.(*impl).LoggerHandlerFunc.func1(0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/application/routing/logger.go:36 +0xc7
vendor/github.com/kataras/iris.HandlerFunc.Serve(0xc420dee050, 0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:245 +0x30
vendor/github.com/kataras/iris.(*Context).Do(0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/context.go:117 +0x59
vendor/github.com/kataras/iris.(*serveMux).BuildHandler.func1(0xc4207e4180)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/http.go:1092 +0x2e0
vendor/github.com/kataras/iris.(*Framework).Build.func1.1(0xc4208ccd80)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/kataras/iris/iris.go:367 +0x5f
vendor/github.com/valyala/fasthttp.(*Server).serveConn(0xc4207b0000, 0x52caec0, 0xc420e3c008, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1533 +0x736
vendor/github.com/valyala/fasthttp.(*Server).(vendor/github.com/valyala/fasthttp.serveConn)-fm(0x52caec0, 0xc420e3c008, 0x0, 0x0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/server.go:1250 +0x6b
vendor/github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc4206bc080, 0xc420df41e0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:210 +0x11f
vendor/github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc4206bc080, 0xc420df41e0, 0x4b7e840, 0xc420df41e0)
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by vendor/github.com/valyala/fasthttp.(*workerPool).getCh
	/Users/kallisto/Projects/ServerTemplate/backend/src/vendor/github.com/valyala/fasthttp/workerpool.go:184 +0x1eb
make: *** [dev] Error 2

unable to get int from boltdb database

when setting int to boltdb/badger backend, it will be decoded to float64, so there is no way to call GetInt get correct value when using boltdb as database

should use gob as default encoding and decoding?

Why need this section?

Maybe I'm say false but I really don't understand why only localhost addresses? Maybe need full check all addresses IPv4?

@

// for these type of hosts, we can't allow subdomains persistence,

Run into panic:runtime error when trying to test sessions example code with ApacheBench

Get panic error like this when trying to test sessions code example by Apache Bench with command like ab -n 10000 -c 10 http://127.0.0.1:8080/get .

  • Iris Version: v4-LTS
  • go-session version: v0.0.6

Could anyone reproduce this? Is this a bug?

Session example code like this copied from here

package main

import "gopkg.in/kataras/iris.v4"

func main() {
	iris.Get("/", func(c *iris.Context) {
		c.Write("You should navigate to the /set, /get, /delete, /clear,/destroy instead")
	})

	iris.Get("/set", func(c *iris.Context) {

		//set session values
		c.Session().Set("name", "iris")

		//test if setted here
		c.Write("All ok session setted to: %s", c.Session().GetString("name"))
	})

	iris.Get("/get", func(c *iris.Context) {
		// get a specific key as a string.
		// returns an empty string if the key was not found.
		name := c.Session().GetString("name")

		c.Write("The name on the /set was: %s", name)
	})

	iris.Get("/delete", func(c *iris.Context) {
		// delete a specific key
		c.Session().Delete("name")
	})

	iris.Get("/clear", func(c *iris.Context) {
		// removes all entries
		c.Session().Clear()
	})

	iris.Get("/destroy", func(c *iris.Context) {
		// destroy/removes the entire session and cookie
		c.SessionDestroy()
		c.Log("You have to refresh the page to completely remove the session (on browsers), so the name should NOT be empty NOW, is it?\n ame: %s\n\nAlso check your cookies in your browser's cookies, should be no field for localhost/127.0.0.1 (or whatever you use)", c.Session().GetString("name"))
		c.Write("You have to refresh the page to completely remove the session (on browsers), so the name should NOT be empty NOW, is it?\nName: %s\n\nAlso check your cookies in your browser's cookies, should be no field for localhost/127.0.0.1 (or whatever you use)", c.Session().GetString("name"))
	})

	iris.Listen(":8080")
}

Error Info:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6f4cdd]
goroutine 35 [running]:
panic(0x9cdc00, 0xc42000c140)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
container/list.(*List).PushBack(0xc42017fbf0, 0xa41220, 0xc42042fe00, 0xc42042fe00)
        /usr/local/go/src/container/list/list.go:139 +0xdd
gopkg.in/kataras/go-sessions%2ev0.(*Provider).Init(0xc42017fc50, 0xc420015770, 0x2c, 0x68c61714000, 0x0, 0x8)
        /home/szp/gowp/src/gopkg.in/kataras/go-sessions.v0/provider.go:74 +0x9b
gopkg.in/kataras/go-sessions%2ev0.(*sessions).StartFasthttp(0xc4201d7380, 0xc420274000, 0x4, 0x4)
        /home/szp/gowp/src/gopkg.in/kataras/go-sessions.v0/sessions.go:212 +0xc0
gopkg.in/kataras/iris%2ev4.(*Context).Session(0xc420438940, 0x464a1d, 0xc42000c129)
        /home/szp/gowp/src/gopkg.in/kataras/iris.v4/context.go:1102 +0x6e
main.main.func3(0xc420438940)
        /home/szp/gowp/src/sessionTest/sessions.go:53 +0x2f
gopkg.in/kataras/iris%2ev4.HandlerFunc.Serve(0xacba98, 0xc420438940)
        /home/szp/gowp/src/gopkg.in/kataras/iris.v4/http.go:245 +0x30
gopkg.in/kataras/iris%2ev4.(*Context).Do(0xc420438940)
        /home/szp/gowp/src/gopkg.in/kataras/iris.v4/context.go:117 +0x49
gopkg.in/kataras/iris%2ev4.(*serveMux).BuildHandler.func1(0xc420438940)
        /home/szp/gowp/src/gopkg.in/kataras/iris.v4/http.go:1092 +0x88b
gopkg.in/kataras/iris%2ev4.(*Framework).Build.func1.1(0xc420274000)
        /home/szp/gowp/src/gopkg.in/kataras/iris.v4/iris.go:367 +0x5a
github.com/valyala/fasthttp.(*Server).serveConn(0xc4202168c0, 0xd498e0, 0xc4202b0018, 0xc420252001, 0xc420250101)
        /home/szp/gowp/src/github.com/valyala/fasthttp/server.go:1536 +0x573
github.com/valyala/fasthttp.(*Server).(github.com/valyala/fasthttp.serveConn)-fm(0xd498e0, 0xc4202b0018, 0xc420041f48, 0x1)
        /home/szp/gowp/src/github.com/valyala/fasthttp/server.go:1250 +0x3e
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc420252000, 0xc42025e120)
        /home/szp/gowp/src/github.com/valyala/fasthttp/workerpool.go:210 +0xde
github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc420252000, 0xc42025e120, 0x97dc00, 0xc42025e120)
        /home/szp/gowp/src/github.com/valyala/fasthttp/workerpool.go:182 +0x35
created by github.com/valyala/fasthttp.(*workerPool).getCh
        /home/szp/gowp/src/github.com/valyala/fasthttp/workerpool.go:184 +0x111

Database interface should accept context.Context for all methods

The Database interface should be duplicated and modified (e.g. DatabaseWithCtx) to support receiving the request context for each method call.

For example:

type Database interface {
	Acquire(sid string, expires time.Duration) LifeTime
	// ...
}

// Should become this ↓
type DatabaseWithCtx interface {
	Acquire(ctx context.Context, sid string, expires time.Duration) LifeTime
	// ...
}

This is important for things like tracing, logging, etc...

cookie cannot work with domain "mysubsubdomain.mysubdomain.localhost.com"

in the sessions.go file ,the function updateCookie with sub code:

// RFC2109, we allow level 1 subdomains, but no further
			// if we have localhost.com , we want the localhost.cos.
			// so if we have something like: mysubdomain.localhost.com we want the localhost here
			// if we have mysubsubdomain.mysubdomain.localhost.com we want the .mysubdomain.localhost.com here
			// slow things here, especially the 'replace' but this is a good and understable( I hope) way to get the be able to set cookies from subdomains & domain with 1-level limit
			if dotIdx := strings.LastIndexByte(requestDomain, '.'); dotIdx > 0 {
				// is mysubdomain.localhost.com || mysubsubdomain.mysubdomain.localhost.com
				s := requestDomain[0:dotIdx] // set mysubdomain.localhost || mysubsubdomain.mysubdomain.localhost
				if secondDotIdx := strings.LastIndexByte(s, '.'); secondDotIdx > 0 {
					//is mysubdomain.localhost ||  mysubsubdomain.mysubdomain.localhost
					s = s[secondDotIdx+1:] // set to localhost || mysubdomain.localhost
				}
				// replace the s with the requestDomain before the domain's siffux
				subdomainSuff := strings.LastIndexByte(requestDomain, '.')
				if subdomainSuff > len(s) { // if it is actual exists as subdomain suffix
					requestDomain = strings.Replace(requestDomain, requestDomain[0:subdomainSuff], s, 1) // set to localhost.com || mysubdomain.localhost.com
				}
			}
			// finally set the .localhost.com (for(1-level) || .mysubdomain.localhost.com (for 2-level subdomain allow)
			cookie.Domain = "." + requestDomain // . to allow persistence

but , i found requestDomain with value "mysubsubdomain.mysubdomain.localhost.com" or "mysubdomain.localhost.com", all come out "localhost.com" ,not as the note says 。

Provide option to always load sessions from database

Hi
Thanks for your work on this library, @kataras .

This is regarding the in-memory session state stored by this library(after the first Start()).

Many multi-process/multi-node app setups share a common backend database to persist sessions. Only loading the sessions for the first time into memory leads to inconsistent state across multiple instances of the application. This request has been raised few times already by users of this library(or its fork in Iris framework): #12 , kataras/iris#885 .

The proposal is to add a Config flag(defaults to false) to enable always looking up the session in the backend database. This way, users that have multiple instances sharing the same database can still have consistent state across instances without disturbing the current in-memory behaviour.

This being a standalone sessions library(not tied to any framework) should definitely have a way to use the library in a multi-machine with common backend setup as most users would expect the library to have consistent state in such situations. Here's an easy fix for this issue. Your thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.