Documentation ¶
Index ¶
- Constants
- Variables
- func RandomString() string
- type Config
- func (c *Config) SetBodyLimit(bodyLimit int)
- func (c *Config) SetConcurrency(concurrency int)
- func (c *Config) SetDBPath(dbPath string)
- func (c *Config) SetDisableStartMessage(disableStartupMessage bool)
- func (c *Config) SetEnablePrintRoutes(enablePrintRoutes bool)
- func (c *Config) SetIdleTimeout(idleTimeout int)
- func (c *Config) SetLogLevel(logLevel string)
- func (c *Config) SetPrefork(prefork bool)
- func (c *Config) SetReadBufferSize(readBufferSize int)
- func (c *Config) SetReadTimeout(readTimeout int)
- func (c *Config) SetReduceMemoryUsage(reduceMemoryUsage bool)
- func (c *Config) SetTimezone(timezone string)
- func (c *Config) SetWriteBufferSize(writeBufferSize int)
- func (c *Config) SetWriteTimeout(writeTimeout int)
Constants ¶
const RAND_INT_MAX = 9999999999
Maximum bound for random integer
const RAND_INT_MIN = 1000000000
Minimum bound for random integer
const STRING_LENGTH = 10
Length of random string
Variables ¶
var DefaultConfig = Config{ DBPath: fmt.Sprintf( "file::memory:?mode=memory&cache=shared&_auth&_auth_user=%s&_auth_pass=%s&_auth_salt=%s&_auth_crypt=sha512", __USERNAME__, __PASSWORD__, __SALT__), Timezone: "UTC", LogLevel: "SILENT", EnablePrintRoutes: false, ReduceMemoryUsage: true, DisableStartupMessage: true, Prefork: false, BodyLimit: 4 * 1024 * 1024, Concurrency: 256 * 1024, ReadBufferSize: 4096, WriteBufferSize: 4096, ReadTimeout: 15, WriteTimeout: 15, IdleTimeout: 60, }
DefaultConfig is the default configuration.
Functions ¶
Types ¶
type Config ¶
type Config struct { // DBPath is the path to sqlite. DBPath string // Timezone is the timezone used for the database. Timezone string // LogLevel is the log level used for the database. LogLevel string // EnablePrintRoutes is the flag to enable print routes. EnablePrintRoutes bool // ReduceMemoryUsage is the flag to reduce memory usage. ReduceMemoryUsage bool // DisableStartupMessage is the flag to disable startup message. DisableStartupMessage bool // BodyLimit is the maximum request body size. BodyLimit int // Concurrency is the maximum number of concurrent connections. Concurrency int // ReadBufferSize is the maximum buffer size for reading. ReadBufferSize int // WriteBufferSize is the maximum buffer size for writing. WriteBufferSize int // ReadTimeout is the maximum duration for reading the entire request, including the body. ReadTimeout int // WriteTimeout is the maximum duration before timing out writes of the response. WriteTimeout int // IdleTimeout is the maximum amount of time to wait for the next request when keep-alives are enabled. IdleTimeout int // Prefork is the flag to enable prefork Prefork bool }
func (*Config) SetBodyLimit ¶
It sets the maximum request body size.
func (*Config) SetConcurrency ¶
It sets the maximum number of concurrent connections.
func (*Config) SetDisableStartMessage ¶
It sets the flag to disable startup message.
func (*Config) SetEnablePrintRoutes ¶
It sets the flag to enable print routes.
func (*Config) SetIdleTimeout ¶
It sets the maximum amount of time to wait for the next request when keep-alives are enabled.
func (*Config) SetPrefork ¶
It sets the flag to enable prefork.
func (*Config) SetReadBufferSize ¶
It sets the maximum buffer size for reading.
func (*Config) SetReadTimeout ¶
It sets the maximum duration for reading the entire request, including the body.
func (*Config) SetReduceMemoryUsage ¶
It sets the flag to reduce memory usage.
func (*Config) SetWriteBufferSize ¶
It sets the maximum buffer size for writing.
func (*Config) SetWriteTimeout ¶
It sets the maximum duration before timing out writes of the response.