mirror of
https://github.com/kataras/iris.git
synced 2026-01-26 05:15:56 +00:00
Iris 4.0.0-alpha.4. Book is finally updated https://kataras.gitbooks.io/iris/content/ also
This commit is contained in:
@@ -13,17 +13,6 @@ const (
|
||||
|
||||
type (
|
||||
// Iris configs for the station
|
||||
// All fields can be changed before server's listen except the DisablePathCorrection field
|
||||
//
|
||||
// MaxRequestBodySize is the only options that can be changed after server listen -
|
||||
// using Config.MaxRequestBodySize = ...
|
||||
// Render's rest config can be changed after declaration but before server's listen -
|
||||
// using Config.Render.Rest...
|
||||
// Render's Template config can be changed after declaration but before server's listen -
|
||||
// using Config.Render.Template...
|
||||
// Sessions config can be changed after declaration but before server's listen -
|
||||
// using Config.Sessions...
|
||||
// and so on...
|
||||
Iris struct {
|
||||
|
||||
// DisablePathCorrection corrects and redirects the requested path to the registed path
|
||||
@@ -106,6 +95,7 @@ type (
|
||||
Websocket *Websocket
|
||||
|
||||
// Tester contains the configs for the test framework, so far we have only one because all test framework's configs are setted by the iris itself
|
||||
// You can find example on the https://github.com/kataras/iris/glob/master/context_test.go
|
||||
Tester Tester
|
||||
}
|
||||
)
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
// Default values for base Server conf, can be changed for global use
|
||||
var (
|
||||
// Default values for base Server conf
|
||||
const (
|
||||
// DefaultServerHostname returns the default hostname which is 127.0.0.1
|
||||
DefaultServerHostname = "127.0.0.1"
|
||||
// DefaultServerPort returns the default port which is 8080
|
||||
@@ -31,6 +31,9 @@ var (
|
||||
//
|
||||
// Default buffer size is 8MB
|
||||
DefaultWriteBufferSize = 8096
|
||||
|
||||
// DefaultServerName the response header of the 'Server' value when writes to the client
|
||||
DefaultServerName = "iris"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -38,9 +41,6 @@ var (
|
||||
DefaultServerAddr = DefaultServerHostname + ":" + strconv.Itoa(DefaultServerPort)
|
||||
)
|
||||
|
||||
// ServerName the response header of the 'Server' value when writes to the client
|
||||
const ServerName = "iris"
|
||||
|
||||
// Server used inside server for listening
|
||||
type Server struct {
|
||||
// ListenningAddr the addr that server listens to
|
||||
@@ -79,6 +79,9 @@ type Server struct {
|
||||
RedirectTo string
|
||||
// Virtual If this server is not really listens to a real host, it mostly used in order to achieve testing without system modifications
|
||||
Virtual bool
|
||||
// Name the server's name, defaults to "iris".
|
||||
// You're free to change it, but I will trust you to don't, this is the only setting whose somebody, like me, can see if iris web framework is used
|
||||
Name string
|
||||
}
|
||||
|
||||
// ServerParseAddr parses the listening addr and returns this
|
||||
@@ -114,7 +117,7 @@ func ServerParseAddr(listeningAddr string) string {
|
||||
|
||||
// DefaultServer returns the default configs for the server
|
||||
func DefaultServer() Server {
|
||||
return Server{ListeningAddr: DefaultServerAddr,
|
||||
return Server{ListeningAddr: DefaultServerAddr, Name: DefaultServerName,
|
||||
MaxRequestBodySize: DefaultMaxRequestBodySize,
|
||||
ReadBufferSize: DefaultReadBufferSize,
|
||||
WriteBufferSize: DefaultWriteBufferSize,
|
||||
|
||||
@@ -34,11 +34,12 @@ type (
|
||||
// DecodeCookie set it to true to decode the cookie key with base64 URLEncoding
|
||||
// Defaults to false
|
||||
DecodeCookie bool
|
||||
//Expires the date which the cookie must expires. Default infinitive/unlimited life
|
||||
Expires time.Time
|
||||
// Expires the duration of which the cookie must expires (created_time.Add(Expires)).
|
||||
// Default infinitive/unlimited life duration(0)
|
||||
Expires time.Duration
|
||||
// GcDuration every how much duration(GcDuration) the memory should be clear for unused cookies (GcDuration)
|
||||
// for example: time.Duration(2)*time.Hour. it will check every 2 hours if cookie hasn't be used for 2 hours,
|
||||
// deletes it from memory until the user comes back, then the session continue to work as it was
|
||||
// deletes it from backend memory until the user comes back, then the session continue to work as it was
|
||||
//
|
||||
// Default 2 hours
|
||||
GcDuration time.Duration
|
||||
@@ -54,7 +55,7 @@ func DefaultSessions() Sessions {
|
||||
return Sessions{
|
||||
Cookie: DefaultCookieName,
|
||||
DecodeCookie: false,
|
||||
Expires: CookieExpireNever,
|
||||
Expires: 0,
|
||||
GcDuration: DefaultSessionGcDuration,
|
||||
DisableSubdomainPersistence: false,
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"github.com/imdario/mergo"
|
||||
)
|
||||
|
||||
// Currently only these 5 values are used for real
|
||||
const (
|
||||
// DefaultWriteTimeout 15 * time.Second
|
||||
DefaultWriteTimeout = 15 * time.Second
|
||||
@@ -20,7 +19,7 @@ const (
|
||||
|
||||
//
|
||||
|
||||
// Websocket the config contains options for 'websocket' package
|
||||
// Websocket the config contains options for the ../websocket.go
|
||||
type Websocket struct {
|
||||
// WriteTimeout time allowed to write a message to the connection.
|
||||
// Default value is 15 * time.Second
|
||||
|
||||
Reference in New Issue
Block a user