iris

package module
v0.0.0-...-6b71452 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2016 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 40 Imported by: 0

README

Iris Logo

Travis Widget Release Widget Report Widget License Widget Chat Widget Documentation Widget

The fastest web framework for Go.

$ cat render_json.go
package main
import "github.com/kataras/iris"

func main() {
	iris.Get("/hi_json", func(c *iris.Context) {
		c.JSON(iris.StatusOK, iris.Map{
			"Name":  "Iris",
			"Born":  "13 March 2016",
			"Stars": 4420,
		})
	})
	iris.Listen(":8080")
}

Learn more about render

Installation

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

$ go get -u github.com/kataras/iris/iris

If you have installation issues or you are connected to the Internet through China please, click here.

FAQ

Explore these questions or navigate to the community chat.

Features

  • Focus on high performance
  • Robust routing supports static and wildcard subdomains
  • View system supporting 6+ template engines
  • Add custom renders/responses or customize & replace the defaults (context.JSON/JSONP/XML/Markdown/Text/Binary(...))
  • Highly scalable Websocket API with custom events
  • Sessions support with GC, memory & redis providers
  • Middlewares & Plugins were never be easier
  • Full REST API
  • Custom HTTP Errors
  • Typescript compiler + Browser-based editor
  • Content negotiation & streaming
  • Transport Layer Security
  • Reload on source code changes
  • OAuth, OAuth2 supporting 27+ API providers
  • JSON Web Tokens
  • and more
Name Description Usage
JSON JSON Response Engine (Default) example 1,example 2, book section
JSONP JSONP Response Engine (Default) example 1,example 2, book section
XML XML Response Engine (Default) example 1,example 2, book section
Markdown Markdown Response Engine (Default) example 1,example 2, book section
Text Text Response Engine (Default) example 1, book section
Binary Data Binary Data Response Engine (Default) example 1, book section
HTML/Default Engine HTML Template Engine (Default) example , book section
Django Engine Django Template Engine example , book section
Pug/Jade Engine Pug Template Engine example , book section
Handlebars Engine Handlebars Template Engine example , book section
Amber Engine Amber Template Engine example , book section
Markdown Engine Markdown Template Engine example , book section
Basicauth Middleware HTTP Basic authentication example 1, example 2, book section
JWT Middleware JSON Web Tokens example , book section
Cors Middleware Cross Origin Resource Sharing W3 specification how to use
Secure Middleware Facilitates some quick security wins example
I18n Middleware Simple internationalization example, book section
Recovery Middleware Safety recover the station from panic example
Logger Middleware Logs every request example, book section
Editor Plugin Alm-tools, a typescript online IDE/Editor book section
Typescript Plugin Auto-compile client-side typescript files book section
OAuth,OAuth2 Plugin User Authentication was never be easier, supports >27 providers example, book section
Iris control Plugin Basic (browser-based) control over your Iris station example, book section

Docs & Community

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

Open debates

Philosophy

The Iris philosophy is to provide robust tooling for HTTP, making it a great solution for single page applications, web sites, hybrids, or public HTTP APIs.

Iris does not force you to use any specific ORM or template engine. With support for the most used template engines, you can quickly craft the perfect application.

Benchmarks

This Benchmark suite aims to compare the whole HTTP request processing between Go web frameworks.

New results just came out:

Benchmark Wizzard July 21, 2016- Processing Time Horizontal Graph

The results have been updated on July 21, 2016

Please click here to view all detailed benchmarks.

Testing

Community should write third-party or iris base tests to the iris-contrib/tests repository. I recommend writing your API tests using this new library, httpexpect which supports Iris and fasthttp now, after my request here.

Versioning

Current: v4.0.0-alpha.4

Iris is an active project

Todo

for 'v4'

  • Refactor & extend view engine, separate the engines from the main code base, easier for the community to create new view engines*
  • Refactor & extend sessions, split the different databases functionality to the iris-contrib*
  • Refactor & extends the rest render engine in order to be able to developer to use their own implemention for rendering restful types, like, for example a custom JSON implementation using no-standard go package for encode/decode*
  • Move the iris/websocket package's source code inside iris/websocket.go one file, to be easier to use by users without import a new package*
  • configs package should be removed after all these, we will not need big configurations because of different packages splitted & moved to the iris-contrib, we will keep interfaces and all required things inside kataras/iris.go.
  • Implement all opened community's feature requests
  • Extend i18n middleware for easier and better internalization support
  • Create a router as optional plugin, for optional path parts. Its name, 'ryan', taken from the community-member and donator who requested this feature
  • Extend the iris control plugin
  • Remove deprecated functions
  • Will think more :)

If you're willing to donate click here!

People

The big thanks goes to all people who help building this framework with feature-requests & bug reports!

The author of Iris is @kataras.

Contributing

If you are interested in contributing to the Iris project, please see the document CONTRIBUTING.

License

This project is licensed under the MIT License.

License can be found here.

Documentation

Overview

Package iris the fastest go web framework in (this) Earth. /NOTE: When you see 'framework' or 'station' we mean the Iris web framework's main implementation.

Basic usage ----------------------------------------------------------------------

package main

import "github.com/kataras/iris"

func main() {
    iris.Get("/hi_json", func(c *iris.Context) {
        c.JSON(200, iris.Map{
            "Name": "Iris",
            "Age":  2,
        })
    })
    iris.Listen(":8080")
}

----------------------------------------------------------------------

package main

import "github.com/kataras/iris"

func main() {
	s1 := iris.New()
	s1.Get("/hi_json", func(c *iris.Context) {
		c.JSON(200, iris.Map{
			"Name": "Iris",
			"Age":  2,
		})
	})

	s2 := iris.New()
	s2.Get("/hi_raw_html", func(c *iris.Context) {
		c.HTML(iris.StatusOK, "<b> Iris </b> welcomes <h1>you!</h1>")
	})

	go s1.Listen(":8080")
	s2.Listen(":1993")
}

-----------------------------DOCUMENTATION---------------------------- ----------------------------_______________--------------------------- For middleware, template engines, response engines, sessions, websockets, mails, subdomains, dynamic subdomains, routes, party of subdomains & routes and much more visit https://www.gitbook.com/book/kataras/iris/details

Index

Constants

View Source
const (
	// MethodGet "GET"
	MethodGet = "GET"
	// MethodPost "POST"
	MethodPost = "POST"
	// MethodPut "PUT"
	MethodPut = "PUT"
	// MethodDelete "DELETE"
	MethodDelete = "DELETE"
	// MethodConnect "CONNECT"
	MethodConnect = "CONNECT"
	// MethodHead "HEAD"
	MethodHead = "HEAD"
	// MethodPatch "PATCH"
	MethodPatch = "PATCH"
	// MethodOptions "OPTIONS"
	MethodOptions = "OPTIONS"
	// MethodTrace "TRACE"
	MethodTrace = "TRACE"
)
View Source
const (
	// StatusContinue http status '100'
	StatusContinue = 100
	// StatusSwitchingProtocols http status '101'
	StatusSwitchingProtocols = 101

	// StatusOK http status '200'
	StatusOK = 200
	// StatusCreated http status '201'
	StatusCreated = 201
	// StatusAccepted http status '202'
	StatusAccepted = 202
	// StatusNonAuthoritativeInfo http status '203'
	StatusNonAuthoritativeInfo = 203
	// StatusNoContent http status '204'
	StatusNoContent = 204
	// StatusResetContent http status '205'
	StatusResetContent = 205
	// StatusPartialContent http status '206'
	StatusPartialContent = 206

	// StatusMultipleChoices http status '300'
	StatusMultipleChoices = 300
	// StatusMovedPermanently http status '301'
	StatusMovedPermanently = 301
	// StatusFound http status '302'
	StatusFound = 302
	// StatusSeeOther http status '303'
	StatusSeeOther = 303
	// StatusNotModified http status '304'
	StatusNotModified = 304
	// StatusUseProxy http status '305'
	StatusUseProxy = 305
	// StatusTemporaryRedirect http status '307'
	StatusTemporaryRedirect = 307

	// StatusBadRequest http status '400'
	StatusBadRequest = 400
	// StatusUnauthorized http status '401'
	StatusUnauthorized = 401
	// StatusPaymentRequired http status '402'
	StatusPaymentRequired = 402
	// StatusForbidden http status '403'
	StatusForbidden = 403
	// StatusNotFound http status '404'
	StatusNotFound = 404
	// StatusMethodNotAllowed http status '405'
	StatusMethodNotAllowed = 405
	// StatusNotAcceptable http status '406'
	StatusNotAcceptable = 406
	// StatusProxyAuthRequired http status '407'
	StatusProxyAuthRequired = 407
	// StatusRequestTimeout http status '408'
	StatusRequestTimeout = 408
	// StatusConflict http status '409'
	StatusConflict = 409
	// StatusGone http status '410'
	StatusGone = 410
	// StatusLengthRequired http status '411'
	StatusLengthRequired = 411
	// StatusPreconditionFailed http status '412'
	StatusPreconditionFailed = 412
	// StatusRequestEntityTooLarge http status '413'
	StatusRequestEntityTooLarge = 413
	// StatusRequestURITooLong http status '414'
	StatusRequestURITooLong = 414
	// StatusUnsupportedMediaType http status '415'
	StatusUnsupportedMediaType = 415
	// StatusRequestedRangeNotSatisfiable http status '416'
	StatusRequestedRangeNotSatisfiable = 416
	// StatusExpectationFailed http status '417'
	StatusExpectationFailed = 417
	// StatusTeapot http status '418'
	StatusTeapot = 418
	// StatusPreconditionRequired http status '428'
	StatusPreconditionRequired = 428
	// StatusTooManyRequests http status '429'
	StatusTooManyRequests = 429
	// StatusRequestHeaderFieldsTooLarge http status '431'
	StatusRequestHeaderFieldsTooLarge = 431
	// StatusUnavailableForLegalReasons http status '451'
	StatusUnavailableForLegalReasons = 451

	// StatusInternalServerError http status '500'
	StatusInternalServerError = 500
	// StatusNotImplemented http status '501'
	StatusNotImplemented = 501
	// StatusBadGateway http status '502'
	StatusBadGateway = 502
	// StatusServiceUnavailable http status '503'
	StatusServiceUnavailable = 503
	// StatusGatewayTimeout http status '504'
	StatusGatewayTimeout = 504
	// StatusHTTPVersionNotSupported http status '505'
	StatusHTTPVersionNotSupported = 505
	// StatusNetworkAuthenticationRequired http status '511'
	StatusNetworkAuthenticationRequired = 511
)
View Source
const (

	// DefaultTemplateExtension the default file extension if empty setted
	DefaultTemplateExtension = ".html"
	// NoLayout to disable layout for a particular template file
	NoLayout = "@.|.@iris_no_layout@.|.@"
	// TemplateLayoutContextKey is the name of the user values which can be used to set a template layout from a middleware and override the parent's
	TemplateLayoutContextKey = "templateLayout"
)
View Source
const (
	// All is the string which the WebsocketEmmiter use to send a message to all
	All = ""
	// NotMe is the string which the WebsocketEmmiter use to send a message to all except this websocketConnection
	NotMe = ";iris;to;all;except;me;"
	// Broadcast is the string which the WebsocketEmmiter use to send a message to all except this websocketConnection, same as 'NotMe'
	Broadcast = NotMe
)
View Source
const (
	// Version of the iris
	Version = "4.0.0-alpha.4"
)

Variables

View Source
var (
	Default   *Framework
	Config    *config.Iris
	Logger    *logger.Logger
	Plugins   PluginContainer
	Websocket WebsocketServer
	Servers   *ServerList
	// Available is a channel type of bool, fired to true when the server is opened and all plugins ran
	// never fires false, if the .Close called then the channel is re-allocating.
	// the channel is closed only when .ListenVirtual is used, otherwise it remains open until you close it.
	//
	// Note: it is a simple channel and decided to put it here and no inside HTTPServer, doesn't have statuses just true and false, simple as possible
	// Where to use that?
	// this is used on extreme cases when you don't know which .Listen/.ListenVirtual will be called
	// and you want to run/declare something external-not-Iris (all Iris functionality declared before .Listen/.ListenVirtual) AFTER the server is started and plugins finished.
	// see the server_test.go for an example
	Available chan bool
)

Default entry, use it with iris.$anyPublicFunc

View Source
var (
	// AllMethods "GET", "POST", "PUT", "DELETE", "CONNECT", "HEAD", "PATCH", "OPTIONS", "TRACE"
	AllMethods = [...]string{MethodGet, MethodPost, MethodPut, MethodDelete, MethodConnect, MethodHead, MethodPatch, MethodOptions, MethodTrace}
)
View Source
var (

	// DefaultTemplateDirectory the default directory if empty setted
	DefaultTemplateDirectory = "." + utils.PathSeparator + "templates"
)

Functions

func API

func API(path string, restAPI HandlerAPI, middleware ...HandlerFunc)

API converts & registers a custom struct to the router receives two parameters first is the request path (string) second is the custom struct (interface{}) which can be anything that has a *iris.Context as field. third is the common middlewares, it's optional

Note that API's routes have their default-name to the full registed path, no need to give a special name for it, because it's not supposed to be used inside your templates.

Recommend to use when you retrieve data from an external database, and the router-performance is not the (only) thing which slows the server's overall performance.

This is a slow method, if you care about router-performance use the Handle/HandleFunc/Get/Post/Put/Delete/Trace/Options... instead

func Any

func Any(registedPath string, handlersFn ...HandlerFunc)

Any registers a route for ALL of the http methods (Get,Post,Put,Head,Patch,Options,Connect,Delete)

func Close

func Close() error

Close terminates all the registered servers and returns an error if any if you want to panic on this error use the iris.Must(iris.Close())

func EmitError

func EmitError(statusCode int, ctx *Context)

EmitError fires a custom http error handler to the client

if no custom error defined with this statuscode, then iris creates one, and once at runtime

func Go

func Go() error

Go starts the iris station, listens to all registered servers, and prepare only if Virtual

func Listen

func Listen(addr string)

Listen starts the standalone http server which listens to the addr parameter which as the form of host:port

It panics on error if you need a func to return an error, use the ListenTo ex: err := iris.ListenTo(config.Server{ListeningAddr:":8080"})

func ListenTLS

func ListenTLS(addr string, certFile string, keyFile string)

ListenTLS Starts a https server with certificates, if you use this method the requests of the form of 'http://' will fail only https:// connections are allowed which listens to the addr parameter which as the form of host:port

It panics on error if you need a func to return an error, use the ListenTo ex: err := iris.ListenTo(":8080","yourfile.cert","yourfile.key")

func ListenTo

func ListenTo(cfg config.Server) error

ListenTo listens to a server but accepts the full server's configuration returns an error, you're responsible to handle that or use the iris.Must(iris.ListenTo(config.Server{}))

it's a blocking func

func ListenUNIX

func ListenUNIX(addr string, mode os.FileMode)

ListenUNIX starts the process of listening to the new requests using a 'socket file', this works only on unix

It panics on error if you need a func to return an error, use the ListenTo ex: err := iris.ListenTo(":8080", Mode: os.FileMode)

func Must

func Must(err error)

Must panics on error, it panics on registed iris' logger

func NewTester

func NewTester(api *Framework, t *testing.T) *httpexpect.Expect

NewTester Prepares and returns a new test framework based on the api is useful when you need to have more than one test framework for the same iris insttance, otherwise you can use the iris.Tester(t *testing.T)/variable.Tester(t *testing.T)

func OnError

func OnError(statusCode int, handlerFn HandlerFunc)

OnError registers a custom http error handler

func Path

func Path(routeName string, args ...interface{}) string

Path used to check arguments with the route's named parameters and return the correct url if parse failed returns empty string

func RegisterWebsocketServer

func RegisterWebsocketServer(station FrameworkAPI, server WebsocketServer, logger *logger.Logger)

RegisterWebsocketServer registers the handlers for the websocket server it's a bridge between station and websocket server

func ResponseString

func ResponseString(keyOrContentType string, obj interface{}, options ...map[string]interface{}) string

ResponseString returns the string of a response engine, does not render it to the client returns empty string on error

func RouteConflicts

func RouteConflicts(r *route, with string) bool

RouteConflicts checks for route's middleware conflicts

func StatusText

func StatusText(code int) string

StatusText returns a text for the HTTP status code. It returns the empty string if the code is unknown.

func TemplateString

func TemplateString(templateFile string, pageContext interface{}, options ...map[string]interface{}) string

TemplateString executes a template from the default template engine and returns its result as string, useful when you want it for sending rich e-mails returns empty string on error

func Tester

func Tester(t *testing.T) *httpexpect.Expect

Tester returns the test framework for this default insance

func URL

func URL(routeName string, args ...interface{}) (url string)

URL returns the subdomain+ host + Path(...optional named parameters if route is dynamic) returns an empty string if parse is failed

func URLEncode

func URLEncode(path string) string

URLEncode returns the path encoded as url useful when you want to pass something to a database and be valid to retrieve it via context.Param use it only for special cases, when the default behavior doesn't suits you.

http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

Credits to Manish Singh @kryptodev for URLEncode by post issue share code

func Use

func Use(handlers ...Handler)

Use registers Handler middleware

func UseFunc

func UseFunc(handlersFn ...HandlerFunc)

UseFunc registers HandlerFunc middleware

func UseGlobal

func UseGlobal(handlers ...Handler)

UseGlobal registers Handler middleware to the beginning, prepends them instead of append

Use it when you want to add a global middleware to all parties, to all routes in all subdomains It can be called after other, (but before .Listen of course)

func UseGlobalFunc

func UseGlobalFunc(handlersFn ...HandlerFunc)

UseGlobalFunc registers HandlerFunc middleware to the beginning, prepends them instead of append

Use it when you want to add a global middleware to all parties, to all routes in all subdomains It can be called after other, (but before .Listen of course)

func UseResponse

func UseResponse(e ResponseEngine, forContentTypesOrKeys ...string) func(string)

UseResponse accepts a ResponseEngine and the key or content type on which the developer wants to register this response engine the gzip and charset are automatically supported by Iris, by passing the iris.RenderOptions{} map on the context.Render context.Render renders this response or a template engine if no response engine with the 'key' found with these engines you can inject the context.JSON,Text,Data,JSONP,XML also to do that just register with UseResponse(myEngine,"application/json") and so on look at the https://github.com/iris-contrib/response for examples

if more than one respone engine with the same key/content type exists then the results will be appended to the final request's body this allows the developer to be able to create 'middleware' responses engines

Note: if you pass an engine which contains a dot('.') as key, then the engine will not be registered. you don't have to import and use github.com/iris-contrib/json, jsonp, xml, data, text, markdown because iris uses these by default if no other response engine is registered for these content types

Note 2: one key has one content type but many response engines ( one to many)

returns a function(string) which you can set the content type, if it's not already declared from the key. careful you should call this in the same execution. one last thing, you can have unlimited number of response engines for the same key and same content type. key and content type may be different, but one key is only for one content type, Do not use different content types with more than one response engine on the same key

func UseSessionDB

func UseSessionDB(db SessionDatabase)

UseSessionDB registers a session database, you can register more than one accepts a session database which implements a Load(sid string) map[string]interface{} and an Update(sid string, newValues map[string]interface{}) the only reason that a session database will be useful for you is when you want to keep the session's values/data after the app restart a session database doesn't have write access to the session, it doesn't accept the context, so forget 'cookie database' for sessions, I will never allow that, for your protection.

Note: Don't worry if no session database is registered, your context.Session will continue to work.

Types

type Context

type Context struct {
	*fasthttp.RequestCtx
	Params PathParameters
	// contains filtered or unexported fields
}

Context is resetting every time a request is coming to the server it is not good practice to use this object in goroutines, for these cases use the .Clone()

func (*Context) Clone

func (ctx *Context) Clone() context.IContext

Clone use that method if you want to use the context inside a goroutine

func (*Context) Data

func (ctx *Context) Data(status int, v []byte) error

Data writes out the raw bytes as binary data.

func (*Context) Do

func (ctx *Context) Do()

Do calls the first handler only, it's like Next with negative pos, used only on Router&MemoryRouter

func (*Context) EmitError

func (ctx *Context) EmitError(statusCode int)

EmitError executes the custom error by the http status code passed to the function

func (*Context) FormValueString

func (ctx *Context) FormValueString(name string) string

FormValueString returns a single value, as string, from post request's data

func (*Context) FormValues

func (ctx *Context) FormValues(name string) []string

FormValues returns a slice of string from post request's data

func (*Context) Get

func (ctx *Context) Get(key string) interface{}

Get returns the user's value from a key if doesn't exists returns nil

func (*Context) GetCookie

func (ctx *Context) GetCookie(name string) (val string)

GetCookie returns cookie's value by it's name returns empty string if nothing was found

func (*Context) GetFlash

func (ctx *Context) GetFlash(key string) (string, error)

GetFlash get a flash message by it's key returns the value as string and an error

if the cookie doesn't exists the string is empty and the error is filled after the request's life the value is removed

func (*Context) GetFlashes

func (ctx *Context) GetFlashes() map[string]string

GetFlashes returns all the flash messages for available for this request

func (*Context) GetFmt

func (ctx *Context) GetFmt(key string) func(format string, args ...interface{}) string

GetFmt returns a value which has this format: func(format string, args ...interface{}) string if doesn't exists returns nil

func (*Context) GetHandlerName

func (ctx *Context) GetHandlerName() string

GetHandlerName as requested returns the stack-name of the function which the Middleware is setted from

func (*Context) GetInt

func (ctx *Context) GetInt(key string) int

GetInt same as Get but returns the value as int if nothing founds returns -1

func (*Context) GetRequestCtx

func (ctx *Context) GetRequestCtx() *fasthttp.RequestCtx

GetRequestCtx returns the current fasthttp context

func (*Context) GetString

func (ctx *Context) GetString(key string) string

GetString same as Get but returns the value as string if nothing founds returns empty string ""

func (*Context) Gzip

func (ctx *Context) Gzip(b []byte, status int)

Gzip accepts bytes, which are compressed to gzip format and sent to the client

func (*Context) HTML

func (ctx *Context) HTML(status int, htmlContents string)

HTML writes html string with a http status

func (*Context) HostString

func (ctx *Context) HostString() string

HostString returns the Host of the request( the url as string )

func (*Context) IsStopped

func (ctx *Context) IsStopped() bool

IsStopped checks and returns true if the current position of the Context is 255, means that the StopExecution has called

func (*Context) JSON

func (ctx *Context) JSON(status int, v interface{}) error

JSON marshals the given interface object and writes the JSON response.

func (*Context) JSONP

func (ctx *Context) JSONP(status int, callback string, v interface{}) error

JSONP marshals the given interface object and writes the JSON response.

func (*Context) Log

func (ctx *Context) Log(format string, a ...interface{})

Log logs to the iris defined logger

func (*Context) Markdown

func (ctx *Context) Markdown(status int, markdown string)

Markdown parses and renders to the client a particular (dynamic) markdown string accepts two parameters first is the http status code second is the markdown string

func (*Context) MarkdownString

func (ctx *Context) MarkdownString(markdownText string) string

MarkdownString parses the (dynamic) markdown string and returns the converted html string

func (*Context) MethodString

func (ctx *Context) MethodString() string

MethodString returns the HTTP Method

func (*Context) MustRender

func (ctx *Context) MustRender(name string, binding interface{}, options ...map[string]interface{})

MustRender same as .Render but returns 500 internal server http status (error) if rendering fail builds up the response from the specified template or a response engine. Note: the options: "gzip" and "charset" are built'n support by Iris, so you can pass these on any template engine or response engine

func (*Context) Next

func (ctx *Context) Next()

Next calls all the next handler from the middleware stack, it used inside a middleware

func (*Context) NotFound

func (ctx *Context) NotFound()

NotFound emits an error 404 to the client, using the custom http errors if no custom errors provided then it sends the default error message

func (*Context) Panic

func (ctx *Context) Panic()

Panic emits an error 500 to the client, using the custom http errors if no custom errors rpovided then it sends the default error message

func (*Context) Param

func (ctx *Context) Param(key string) string

Param returns the string representation of the key's path named parameter's value

func (*Context) ParamInt

func (ctx *Context) ParamInt(key string) (int, error)

ParamInt returns the int representation of the key's path named parameter's value

func (*Context) ParamInt64

func (ctx *Context) ParamInt64(key string) (int64, error)

ParamInt64 returns the int64 representation of the key's path named parameter's value

func (*Context) PathString

func (ctx *Context) PathString() string

PathString returns the full escaped path as string for unescaped use: ctx.RequestCtx.RequestURI() or RequestPath(escape bool)

func (*Context) ReadForm

func (ctx *Context) ReadForm(formObject interface{}) error

ReadForm binds the formObject with the form data it supports any kind of struct

func (*Context) ReadJSON

func (ctx *Context) ReadJSON(jsonObject interface{}) error

ReadJSON reads JSON from request's body

func (*Context) ReadXML

func (ctx *Context) ReadXML(xmlObject interface{}) error

ReadXML reads XML from request's body

func (*Context) Redirect

func (ctx *Context) Redirect(urlToRedirect string, statusHeader ...int)

Redirect redirect sends a redirect response the client accepts 2 parameters string and an optional int first parameter is the url to redirect second parameter is the http status should send, default is 302 (StatusFound), you can set it to 301 (Permant redirect), if that's nessecery

func (*Context) RedirectTo

func (ctx *Context) RedirectTo(routeName string, args ...interface{})

RedirectTo does the same thing as Redirect but instead of receiving a uri or path it receives a route name

func (*Context) RemoteAddr

func (ctx *Context) RemoteAddr() string

RemoteAddr is like RequestIP but it checks for proxy servers also, tries to get the real client's request IP

func (*Context) RemoveCookie

func (ctx *Context) RemoveCookie(name string)

RemoveCookie deletes a cookie by it's name/key

func (*Context) Render

func (ctx *Context) Render(name string, binding interface{}, options ...map[string]interface{}) error

Render same as .RenderWithStatus but with status to iris.StatusOK (200) if no previous status exists builds up the response from the specified template or a response engine. Note: the options: "gzip" and "charset" are built'n support by Iris, so you can pass these on any template engine or response engine

func (*Context) RenderWithStatus

func (ctx *Context) RenderWithStatus(status int, name string, binding interface{}, options ...map[string]interface{}) error

RenderWithStatus builds up the response from the specified template or a response engine. Note: the options: "gzip" and "charset" are built'n support by Iris, so you can pass these on any template engine or response engine

func (*Context) RequestHeader

func (ctx *Context) RequestHeader(k string) string

RequestHeader returns the request header's value accepts one parameter, the key of the header (string) returns string

func (*Context) RequestIP

func (ctx *Context) RequestIP() string

RequestIP gets just the Remote Address from the client.

func (*Context) RequestPath

func (ctx *Context) RequestPath(escape bool) string

RequestPath returns the requested path

func (*Context) Reset

func (ctx *Context) Reset(reqCtx *fasthttp.RequestCtx)

Reset resets the Context with a given domain.Response and domain.Request the context is ready-to-use after that, just like a new Context I use it for zero rellocation memory

func (*Context) SendFile

func (ctx *Context) SendFile(filename string, destinationName string) error

SendFile sends file for force-download to the client

You can define your own "Content-Type" header also, after this function call for example: ctx.Response.Header.Set("Content-Type","thecontent/type")

func (*Context) ServeContent

func (ctx *Context) ServeContent(content io.ReadSeeker, filename string, modtime time.Time, gzipCompression bool) error

ServeContent serves content, headers are autoset receives three parameters, it's low-level function, instead you can use .ServeFile(string)

You can define your own "Content-Type" header also, after this function call

func (*Context) ServeFile

func (ctx *Context) ServeFile(filename string, gzipCompression bool) error

ServeFile serves a view file, to send a file ( zip for example) to the client you should use the SendFile(serverfilename,clientfilename) receives two parameters filename/path (string) gzipCompression (bool)

You can define your own "Content-Type" header also, after this function call

func (*Context) Session

func (ctx *Context) Session() interface {
	ID() string
	Get(string) interface{}
	GetString(key string) string
	GetInt(key string) int
	GetAll() map[string]interface{}
	VisitAll(cb func(k string, v interface{}))
	Set(string, interface{})
	Delete(string)
	Clear()
}

Session returns the current session

func (*Context) SessionDestroy

func (ctx *Context) SessionDestroy()

SessionDestroy destroys the whole session, calls the provider's destroy and remove the cookie

func (*Context) Set

func (ctx *Context) Set(key string, value interface{})

Set sets a value to a key in the values map

func (*Context) SetContentType

func (ctx *Context) SetContentType(s string)

SetContentType sets the response writer's header key 'Content-Type' to a given value(s)

func (*Context) SetCookie

func (ctx *Context) SetCookie(cookie *fasthttp.Cookie)

SetCookie adds a cookie

func (*Context) SetCookieKV

func (ctx *Context) SetCookieKV(key, value string)

SetCookieKV adds a cookie, receives just a key(string) and a value(string)

func (*Context) SetFlash

func (ctx *Context) SetFlash(key string, value string)

SetFlash sets a flash message, accepts 2 parameters the key(string) and the value(string) the value will be available on the NEXT request

func (*Context) SetHeader

func (ctx *Context) SetHeader(k string, v string)

SetHeader write to the response writer's header to a given key the given value(s)

Note: If you want to send a multi-line string as header's value use: strings.TrimSpace first.

func (*Context) StopExecution

func (ctx *Context) StopExecution()

StopExecution just sets the .pos to 255 in order to not move to the next middlewares(if any)

func (*Context) Stream

func (ctx *Context) Stream(cb func(writer *bufio.Writer))

Stream same as StreamWriter

func (*Context) StreamReader

func (ctx *Context) StreamReader(bodyStream io.Reader, bodySize int)

StreamReader sets response body stream and, optionally body size.

If bodySize is >= 0, then the bodyStream must provide exactly bodySize bytes before returning io.EOF.

If bodySize < 0, then bodyStream is read until io.EOF.

bodyStream.Close() is called after finishing reading all body data if it implements io.Closer.

See also StreamReader.

func (*Context) StreamWriter

func (ctx *Context) StreamWriter(cb func(writer *bufio.Writer))

StreamWriter registers the given stream writer for populating response body.

This function may be used in the following cases:

  • if response body is too big (more than 10MB).
  • if response body is streamed from slow external sources.
  • if response body must be streamed to the client in chunks. (aka `http server push`).

func (*Context) Subdomain

func (ctx *Context) Subdomain() (subdomain string)

Subdomain returns the subdomain (string) of this request, if any

func (*Context) TemplateString

func (ctx *Context) TemplateString(name string, binding interface{}, options ...map[string]interface{}) string

TemplateString accepts a template filename, its context data and returns the result of the parsed template (string) if any error returns empty string

func (*Context) Text

func (ctx *Context) Text(status int, v string) error

Text writes out a string as plain text.

func (*Context) URLParam

func (ctx *Context) URLParam(key string) string

URLParam returns the get parameter from a request , if any

func (*Context) URLParamInt

func (ctx *Context) URLParamInt(key string) (int, error)

URLParamInt returns the url query parameter as int value from a request , returns error on parse fail

func (*Context) URLParamInt64

func (ctx *Context) URLParamInt64(key string) (int64, error)

URLParamInt64 returns the url query parameter as int64 value from a request , returns error on parse fail

func (*Context) URLParams

func (ctx *Context) URLParams() map[string]string

URLParams returns a map of a list of each url(query) parameter

func (*Context) VirtualHostname

func (ctx *Context) VirtualHostname() string

VirtualHostname returns the hostname that user registers, host path maybe differs from the real which is HostString, which taken from a net.listener

func (*Context) VisitAllCookies

func (ctx *Context) VisitAllCookies(visitor func(key string, value string))

VisitAllCookies takes a visitor which loops on each (request's) cookie key and value

Note: the method ctx.Request.Header.VisitAllCookie by fasthttp, has a strange bug which I cannot solve at the moment. This is the reason which this function exists and should be used instead of fasthttp's built'n.

func (*Context) Write

func (ctx *Context) Write(format string, a ...interface{})

Write writes a string to the client, something like fmt.Printf but for the web

func (*Context) XML

func (ctx *Context) XML(status int, v interface{}) error

XML marshals the given interface object and writes the XML response.

type Framework

type Framework struct {
	Config *config.Iris

	// fields which are useful to the user/dev
	// the last  added server is the main server
	Servers *ServerList
	// configuration by instance.Logger.Config
	Logger    *logger.Logger
	Plugins   PluginContainer
	Websocket WebsocketServer
	Available chan bool
	// contains filtered or unexported fields
}

Framework is our God |\| Google.Search('Greek mythology Iris')

Implements the FrameworkAPI

func New

func New(cfg ...config.Iris) *Framework

New creates and returns a new Iris station aka Framework.

Receives an optional config.Iris as parameter If empty then config.Default() is used instead

func (Framework) API

func (api Framework) API(path string, restAPI HandlerAPI, middleware ...HandlerFunc)

API converts & registers a custom struct to the router receives two parameters first is the request path (string) second is the custom struct (interface{}) which can be anything that has a *iris.Context as field. third is the common middleware, it's optional

Note that API's routes have their default-name to the full registed path, no need to give a special name for it, because it's not supposed to be used inside your templates.

Recommend to use when you retrieve data from an external database, and the router-performance is not the (only) thing which slows the server's overall performance.

This is a slow method, if you care about router-performance use the Handle/HandleFunc/Get/Post/Put/Delete/Trace/Options... instead

func (*Framework) AcquireGzip

func (s *Framework) AcquireGzip(w io.Writer) *gzip.Writer

AcquireGzip prepares a gzip writer and returns it

Note that: each iris station has its own pool see ReleaseGzip

func (*Framework) AddServer

func (s *Framework) AddServer(cfg config.Server) *Server

AddServer same as .Servers.Add(config.Server)

AddServer starts a server which listens to this station Note that the view engine's functions {{ url }} and {{ urlpath }} will return the last registered server's scheme (http/https)

this is useful mostly when you want to have two or more listening ports ( two or more servers ) for the same station

receives one parameter which is the config.Server for the new server returns the new standalone server( you can close this server by the returning reference)

If you need only one server you can use the blocking-funcs: .Listen/ListenTLS/ListenUNIX/ListenTo

this is a NOT A BLOCKING version, the main .Listen/ListenTLS/ListenUNIX/ListenTo should be always executed LAST, so this function goes before the main .Listen/ListenTLS/ListenUNIX/ListenTo

func (Framework) Any

func (api Framework) Any(registedPath string, handlersFn ...HandlerFunc)

Any registers a route for ALL of the http methods (Get,Post,Put,Head,Patch,Options,Connect,Delete)

func (*Framework) Close

func (s *Framework) Close() error

Close terminates all the registered servers and returns an error if any if you want to panic on this error use the iris.Must(iris.Close())

func (Framework) Connect

func (api Framework) Connect(path string, handlersFn ...HandlerFunc) RouteNameFunc

Connect registers a route for the Connect http method

func (Framework) Delete

func (api Framework) Delete(path string, handlersFn ...HandlerFunc) RouteNameFunc

Delete registers a route for the Delete http method

func (*Framework) EmitError

func (s *Framework) EmitError(statusCode int, ctx *Context)

EmitError fires a custom http error handler to the client

if no custom error defined with this statuscode, then iris creates one, and once at runtime

func (Framework) Favicon

func (api Framework) Favicon(favPath string, requestPath ...string) RouteNameFunc

Favicon serves static favicon accepts 2 parameters, second is optional favPath (string), declare the system directory path of the __.ico requestPath (string), it's the route's path, by default this is the "/favicon.ico" because some browsers tries to get this by default first, you can declare your own path if you have more than one favicon (desktop, mobile and so on)

this func will add a route for you which will static serve the /yuorpath/yourfile.ico to the /yourfile.ico (nothing special that you can't handle by yourself) Note that you have to call it on every favicon you have to serve automatically (dekstop, mobile and so on)

panics on error

func (Framework) Get

func (api Framework) Get(path string, handlersFn ...HandlerFunc) RouteNameFunc

Get registers a route for the Get http method

func (*Framework) Go

func (s *Framework) Go() error

Go starts the iris station, listens to all registered servers, and prepare only if Virtual

func (Framework) H_

func (api Framework) H_(method string, registedPath string, fn func(context.IContext)) func(string)

H_ is used to convert a context.IContext handler func to iris.HandlerFunc, is used only inside iris internal package to avoid import cycles

func (Framework) Handle

func (api Framework) Handle(method string, registedPath string, handlers ...Handler) RouteNameFunc

Handle registers a route to the server's router if empty method is passed then registers handler(s) for all methods, same as .Any, but returns nil as result

func (Framework) HandleFunc

func (api Framework) HandleFunc(method string, registedPath string, handlersFn ...HandlerFunc) RouteNameFunc

HandleFunc registers and returns a route with a method string, path string and a handler registedPath is the relative url path

func (Framework) Head

func (api Framework) Head(path string, handlersFn ...HandlerFunc) RouteNameFunc

Head registers a route for the Head http method

func (Framework) Layout

func (api Framework) Layout(tmplLayoutFile string) MuxAPI

Layout oerrides the parent template layout with a more specific layout for this Party returns this Party, to continue as normal example: my := iris.Party("/my").Layout("layouts/mylayout.html")

{
	my.Get("/", func(ctx *iris.Context) {
		ctx.MustRender("page1.html", nil)
	})
}

func (*Framework) Listen

func (s *Framework) Listen(addr string)

Listen starts the standalone http server which listens to the addr parameter which as the form of host:port

It panics on error if you need a func to return an error, use the ListenTo ex: err := iris.ListenTo(config.Server{ListeningAddr:":8080"})

func (*Framework) ListenTLS

func (s *Framework) ListenTLS(addr string, certFile, keyFile string)

ListenTLS Starts a https server with certificates, if you use this method the requests of the form of 'http://' will fail only https:// connections are allowed which listens to the addr parameter which as the form of host:port

It panics on error if you need a func to return an error, use the ListenTo ex: err := iris.ListenTo(":8080","yourfile.cert","yourfile.key")

func (*Framework) ListenTo

func (s *Framework) ListenTo(cfg config.Server) (err error)

ListenTo listens to a server but acceots the full server's configuration returns an error, you're responsible to handle that or use the iris.Must(iris.ListenTo(config.Server{}))

it's a blocking func

func (*Framework) ListenUNIX

func (s *Framework) ListenUNIX(addr string, mode os.FileMode)

ListenUNIX starts the process of listening to the new requests using a 'socket file', this works only on unix

It panics on error if you need a func to return an error, use the ListenTo ex: err := iris.ListenTo(":8080", Mode: os.FileMode)

func (*Framework) ListenVirtual

func (s *Framework) ListenVirtual(optionalAddr ...string) *Server

ListenVirtual is useful only when you want to test Iris, it doesn't starts the server but it configures and returns it initializes the whole framework but server doesn't listens to a specific net.Listener it is not blocking the app

func (*Framework) Lookup

func (s *Framework) Lookup(routeName string) Route

Lookup returns a registed route by its name

func (*Framework) Lookups

func (s *Framework) Lookups() (routes []Route)

Lookups returns all registed routes

func (*Framework) Must

func (s *Framework) Must(err error)

Must panics on error, it panics on registed iris' logger

func (*Framework) OnError

func (s *Framework) OnError(statusCode int, handlerFn HandlerFunc)

OnError registers a custom http error handler

func (Framework) Options

func (api Framework) Options(path string, handlersFn ...HandlerFunc) RouteNameFunc

Options registers a route for the Options http method

func (Framework) Party

func (api Framework) Party(relativePath string, handlersFn ...HandlerFunc) MuxAPI

Party is just a group joiner of routes which have the same prefix and share same middleware(s) also. Party can also be named as 'Join' or 'Node' or 'Group' , Party chosen because it has more fun

func (Framework) Patch

func (api Framework) Patch(path string, handlersFn ...HandlerFunc) RouteNameFunc

Patch registers a route for the Patch http method

func (*Framework) Path

func (s *Framework) Path(routeName string, args ...interface{}) string

Path used to check arguments with the route's named parameters and return the correct url if parse failed returns empty string

func (Framework) Post

func (api Framework) Post(path string, handlersFn ...HandlerFunc) RouteNameFunc

Post registers a route for the Post http method

func (Framework) Put

func (api Framework) Put(path string, handlersFn ...HandlerFunc) RouteNameFunc

Put registers a route for the Put http method

func (*Framework) ReleaseGzip

func (s *Framework) ReleaseGzip(gzipWriter *gzip.Writer)

ReleaseGzip called when flush/close and put the gzip writer back to the pool

Note that: each iris station has its own pool see AcquireGzip

func (*Framework) ResponseString

func (s *Framework) ResponseString(keyOrContentType string, obj interface{}, options ...map[string]interface{}) string

ResponseString returns the string of a response engine, does not render it to the client returns empty string on error

func (Framework) Static

func (api Framework) Static(relative string, systemPath string, stripSlashes int) RouteNameFunc

Static registers a route which serves a system directory this doesn't generates an index page which list all files no compression is used also, for these features look at StaticFS func accepts three parameters first parameter is the request url path (string) second parameter is the system directory (string) third parameter is the level (int) of stripSlashes * stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar" * stripSlashes = 1, original path: "/foo/bar", result: "/bar" * stripSlashes = 2, original path: "/foo/bar", result: ""

func (Framework) StaticContent

func (api Framework) StaticContent(reqPath string, cType string, content []byte) func(string)

StaticContent serves bytes, memory cached, on the reqPath a good example of this is how the websocket server uses that to auto-register the /iris-ws.js

func (Framework) StaticFS

func (api Framework) StaticFS(reqPath string, systemPath string, stripSlashes int) RouteNameFunc

StaticFS registers a route which serves a system directory this is the fastest method to serve static files generates an index page which list all files if you use this method it will generate compressed files also think this function as small fileserver with http accepts three parameters first parameter is the request url path (string) second parameter is the system directory (string) third parameter is the level (int) of stripSlashes * stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar" * stripSlashes = 1, original path: "/foo/bar", result: "/bar" * stripSlashes = 2, original path: "/foo/bar", result: ""

func (Framework) StaticHandler

func (api Framework) StaticHandler(systemPath string, stripSlashes int, compress bool, generateIndexPages bool, indexNames []string) HandlerFunc

StaticHandler returns a Handler to serve static system directory Accepts 5 parameters

first is the systemPath (string) Path to the root directory to serve files from.

second is the stripSlashes (int) level * stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar" * stripSlashes = 1, original path: "/foo/bar", result: "/bar" * stripSlashes = 2, original path: "/foo/bar", result: ""

third is the compress (bool) Transparently compresses responses if set to true.

The server tries minimizing CPU usage by caching compressed files. It adds fasthttp.FSCompressedFileSuffix suffix to the original file name and tries saving the resulting compressed file under the new file name. So it is advisable to give the server write access to Root and to all inner folders in order to minimze CPU usage when serving compressed responses.

fourth is the generateIndexPages (bool) Index pages for directories without files matching IndexNames are automatically generated if set.

Directory index generation may be quite slow for directories with many files (more than 1K), so it is discouraged enabling index pages' generation for such directories.

fifth is the indexNames ([]string) List of index file names to try opening during directory access.

For example:

  • index.html
  • index.htm
  • my-super-index.xml

func (Framework) StaticServe

func (api Framework) StaticServe(systemPath string, requestPath ...string) RouteNameFunc

StaticServe serves a directory as web resource it's the simpliest form of the Static* functions Almost same usage as StaticWeb accepts only one required parameter which is the systemPath ( the same path will be used to register the GET&HEAD routes) if second parameter is empty, otherwise the requestPath is the second parameter it uses gzip compression (compression on each request, no file cache)

func (Framework) StaticWeb

func (api Framework) StaticWeb(reqPath string, systemPath string, stripSlashes int) RouteNameFunc

StaticWeb same as Static but if index.html exists and request uri is '/' then display the index.html's contents accepts three parameters first parameter is the request url path (string) second parameter is the system directory (string) third parameter is the level (int) of stripSlashes * stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar" * stripSlashes = 1, original path: "/foo/bar", result: "/bar" * stripSlashes = 2, original path: "/foo/bar", result: "" * if you don't know what to put on stripSlashes just 1

func (*Framework) TemplateString

func (s *Framework) TemplateString(templateFile string, pageContext interface{}, options ...map[string]interface{}) string

TemplateString executes a template from the default template engine and returns its result as string, useful when you want it for sending rich e-mails returns empty string on error

func (*Framework) Tester

func (s *Framework) Tester(t *testing.T) *httpexpect.Expect

Tester returns the test framework for this iris insance

func (Framework) Trace

func (api Framework) Trace(path string, handlersFn ...HandlerFunc) RouteNameFunc

Trace registers a route for the Trace http method

func (*Framework) URL

func (s *Framework) URL(routeName string, args ...interface{}) (url string)

URL returns the subdomain+ host + Path(...optional named parameters if route is dynamic) returns an empty string if parse is failed

func (Framework) Use

func (api Framework) Use(handlers ...Handler)

Use registers Handler middleware

func (Framework) UseFunc

func (api Framework) UseFunc(handlersFn ...HandlerFunc)

UseFunc registers HandlerFunc middleware

func (*Framework) UseGlobal

func (s *Framework) UseGlobal(handlers ...Handler)

UseGlobal registers Handler middleware to the beginning, prepends them instead of append

Use it when you want to add a global middleware to all parties, to all routes in all subdomains It can be called after other, (but before .Listen of course)

func (*Framework) UseGlobalFunc

func (s *Framework) UseGlobalFunc(handlersFn ...HandlerFunc)

UseGlobalFunc registers HandlerFunc middleware to the beginning, prepends them instead of append

Use it when you want to add a global middleware to all parties, to all routes in all subdomains It can be called after other, (but before .Listen of course)

func (*Framework) UseResponse

func (s *Framework) UseResponse(e ResponseEngine, forContentTypesOrKeys ...string) func(string)

UseResponse accepts a ResponseEngine and the key or content type on which the developer wants to register this response engine the gzip and charset are automatically supported by Iris, by passing the iris.RenderOptions{} map on the context.Render context.Render renders this response or a template engine if no response engine with the 'key' found with these engines you can inject the context.JSON,Text,Data,JSONP,XML also to do that just register with UseResponse(myEngine,"application/json") and so on look at the https://github.com/iris-contrib/response for examples

if more than one respone engine with the same key/content type exists then the results will be appended to the final request's body this allows the developer to be able to create 'middleware' responses engines

Note: if you pass an engine which contains a dot('.') as key, then the engine will not be registered. you don't have to import and use github.com/iris-contrib/json, jsonp, xml, data, text, markdown because iris uses these by default if no other response engine is registered for these content types

Note 2: one key has one content type but many response engines ( one to many)

returns a function(string) which you can set the content type, if it's not already declared from the key. careful you should call this in the same execution. one last thing, you can have unlimited number of response engines for the same key and same content type. key and content type may be different, but one key is only for one content type, Do not use different content types with more than one response engine on the same key

func (*Framework) UseSessionDB

func (s *Framework) UseSessionDB(db SessionDatabase)

UseSessionDB registers a session database, you can register more than one accepts a session database which implements a Load(sid string) map[string]interface{} and an Update(sid string, newValues map[string]interface{}) the only reason that a session database will be useful for you is when you want to keep the session's values/data after the app restart a session database doesn't have write access to the session, it doesn't accept the context, so forget 'cookie database' for sessions, I will never allow that, for your protection.

Note: Don't worry if no session database is registered, your context.Session will continue to work.

func (*Framework) UseTemplate

func (s *Framework) UseTemplate(e TemplateEngine) *TemplateEngineLocation

UseTemplate adds a template engine to the iris view system it does not build/load them yet

type FrameworkAPI

type FrameworkAPI interface {
	MuxAPI
	Must(error)
	AddServer(config.Server) *Server
	ListenTo(config.Server) error
	Listen(string)
	ListenTLS(string, string, string)
	ListenUNIX(string, os.FileMode)
	ListenVirtual(...string) *Server
	Go() error
	Close() error
	UseSessionDB(SessionDatabase)
	UseResponse(ResponseEngine, ...string) func(string)
	UseTemplate(TemplateEngine) *TemplateEngineLocation
	UseGlobal(...Handler)
	UseGlobalFunc(...HandlerFunc)
	OnError(int, HandlerFunc)
	EmitError(int, *Context)
	Lookup(string) Route
	Lookups() []Route
	Path(string, ...interface{}) string
	URL(string, ...interface{}) string
	TemplateString(string, interface{}, ...map[string]interface{}) string
	ResponseString(string, interface{}, ...map[string]interface{}) string
	Tester(t *testing.T) *httpexpect.Expect
}

FrameworkAPI contains the main Iris Public API

type Handler

type Handler interface {
	Serve(ctx *Context)
}

Handler the main Iris Handler interface.

func ToHandler

func ToHandler(handler interface{}) Handler

ToHandler converts an httapi.Handler or http.HandlerFunc to an iris.Handler

func ToHandlerFastHTTP

func ToHandlerFastHTTP(h fasthttp.RequestHandler) Handler

ToHandlerFastHTTP converts an fasthttp.RequestHandler to an iris.Handler

type HandlerAPI

type HandlerAPI interface{}

HandlerAPI empty interface used for .API

type HandlerFunc

type HandlerFunc func(*Context)

HandlerFunc type is an adapter to allow the use of ordinary functions as HTTP handlers. If f is a function with the appropriate signature, HandlerFunc(f) is a Handler that calls f.

func StaticHandler

func StaticHandler(systemPath string, stripSlashes int, compress bool, generateIndexPages bool, indexNames []string) HandlerFunc

StaticHandler returns a Handler to serve static system directory Accepts 5 parameters

first is the systemPath (string) Path to the root directory to serve files from.

second is the stripSlashes (int) level * stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar" * stripSlashes = 1, original path: "/foo/bar", result: "/bar" * stripSlashes = 2, original path: "/foo/bar", result: ""

third is the compress (bool) Transparently compresses responses if set to true.

The server tries minimizing CPU usage by caching compressed files. It adds fasthttp.FSCompressedFileSuffix suffix to the original file name and tries saving the resulting compressed file under the new file name. So it is advisable to give the server write access to Root and to all inner folders in order to minimze CPU usage when serving compressed responses.

fourth is the generateIndexPages (bool) Index pages for directories without files matching IndexNames are automatically generated if set.

Directory index generation may be quite slow for directories with many files (more than 1K), so it is discouraged enabling index pages' generation for such directories.

fifth is the indexNames ([]string) List of index file names to try opening during directory access.

For example:

  • index.html
  • index.htm
  • my-super-index.xml

func ToHandlerFunc

func ToHandlerFunc(handler interface{}) HandlerFunc

ToHandlerFunc converts an http.Handler or http.HandlerFunc to an iris.HandlerFunc

func (HandlerFunc) Serve

func (h HandlerFunc) Serve(ctx *Context)

Serve implements the Handler, is like ServeHTTP but for Iris

type Map

type Map map[string]interface{}

Map is just a conversion for a map[string]interface{} should not be used inside Render when PongoEngine is used.

type Middleware

type Middleware []Handler

Middleware is just a slice of Handler []func(c *Context)

type MuxAPI

type MuxAPI interface {
	Party(string, ...HandlerFunc) MuxAPI
	// middleware serial, appending
	Use(...Handler)
	UseFunc(...HandlerFunc)

	// main handlers
	Handle(string, string, ...Handler) RouteNameFunc
	HandleFunc(string, string, ...HandlerFunc) RouteNameFunc
	// H_ is used to convert a context.IContext handler func to iris.HandlerFunc, is used only inside iris internal package to avoid import cycles
	H_(string, string, func(context.IContext)) func(string)
	API(string, HandlerAPI, ...HandlerFunc)

	// http methods
	Get(string, ...HandlerFunc) RouteNameFunc
	Post(string, ...HandlerFunc) RouteNameFunc
	Put(string, ...HandlerFunc) RouteNameFunc
	Delete(string, ...HandlerFunc) RouteNameFunc
	Connect(string, ...HandlerFunc) RouteNameFunc
	Head(string, ...HandlerFunc) RouteNameFunc
	Options(string, ...HandlerFunc) RouteNameFunc
	Patch(string, ...HandlerFunc) RouteNameFunc
	Trace(string, ...HandlerFunc) RouteNameFunc
	Any(string, ...HandlerFunc)

	// static content
	StaticHandler(string, int, bool, bool, []string) HandlerFunc
	Static(string, string, int) RouteNameFunc
	StaticFS(string, string, int) RouteNameFunc
	StaticWeb(string, string, int) RouteNameFunc
	StaticServe(string, ...string) RouteNameFunc
	StaticContent(string, string, []byte) func(string)
	Favicon(string, ...string) RouteNameFunc

	// templates
	Layout(string) MuxAPI // returns itself
}

MuxAPI the visible api for the serveMux

func Party

func Party(relativePath string, handlersFn ...HandlerFunc) MuxAPI

Party is just a group joiner of routes which have the same prefix and share same middleware(s) also. Party can also be named as 'Join' or 'Node' or 'Group' , Party chosen because it has more fun

type PathParameter

type PathParameter struct {
	Key   string
	Value string
}

PathParameter is a struct which contains Key and Value, used for named path parameters

type PathParameters

type PathParameters []PathParameter

PathParameters type for a slice of PathParameter Tt's a slice of PathParameter type, because it's faster than map

func ParseParams

func ParseParams(str string) PathParameters

ParseParams receives a string and returns PathParameters (slice of PathParameter) received string must have this form: key1=value1,key2=value2...

func (PathParameters) Get

func (params PathParameters) Get(key string) string

Get returns a value from a key inside this Parameters If no parameter with this key given then it returns an empty string

func (PathParameters) String

func (params PathParameters) String() string

String returns a string implementation of all parameters that this PathParameters object keeps hasthe form of key1=value1,key2=value2...

type Plugin

type Plugin interface {
}

Plugin just an empty base for plugins A Plugin can be added with: .Add(PreListenFunc(func(*Framework))) and so on... or .Add(myPlugin{},myPlugin2{}) which myPlugin is a struct with any of the methods below or .PostListen(func(*Framework)) and so on...

type PluginContainer

type PluginContainer interface {
	Add(...Plugin) error
	Remove(string) error
	GetName(Plugin) string
	GetDescription(Plugin) string
	GetByName(string) Plugin
	Printf(string, ...interface{})
	PreLookup(PreLookupFunc)
	DoPreLookup(Route)
	PreListen(PreListenFunc)
	DoPreListen(*Framework)
	DoPreListenParallel(*Framework)
	PostListen(PostListenFunc)
	DoPostListen(*Framework)
	PreClose(PreCloseFunc)
	DoPreClose(*Framework)
	PreDownload(PreDownloadFunc)
	DoPreDownload(Plugin, string)
	// custom event callbacks
	On(string, ...func())
	Call(string)
	//
	GetAll() []Plugin
	// GetDownloader is the only one module that is used and fire listeners at the same time in this file
	GetDownloader() PluginDownloadManager
}

PluginContainer is the interface which the pluginContainer should implements

type PluginDownloadManager

type PluginDownloadManager interface {
	DirectoryExists(string) bool
	DownloadZip(string, string) (string, error)
	Unzip(string, string) (string, error)
	Remove(string) error
	// install is just the flow of: downloadZip -> unzip -> removeFile(zippedFile)
	// accepts 2 parameters
	//
	// first parameter is the remote url file zip
	// second parameter is the target directory
	// returns a string(installedDirectory) and an error
	//
	// (string) installedDirectory is the directory which the zip file had, this is the real installation path, you don't need to know what it's because these things maybe change to the future let's keep it to return the correct path.
	// the installedDirectory is not empty when the installation is succed, the targetDirectory is not already exists and no error happens
	// the installedDirectory is empty when the installation is already done by previous time or an error happens
	Install(remoteFileZip string, targetDirectory string) (string, error)
}

PluginDownloadManager is the interface which the DownloadManager should implements

type PostListenFunc

type PostListenFunc func(*Framework)

PostListenFunc implements the simple function listener for the PostListen(*Framework)

func (PostListenFunc) PostListen

func (fn PostListenFunc) PostListen(station *Framework)

PostListen it's being called only one time, AFTER the Server is started (if .Listen called) parameter is the station

type PreCloseFunc

type PreCloseFunc func(*Framework)

PreCloseFunc implements the simple function listener for the PreClose(*Framework)

func (PreCloseFunc) PreClose

func (fn PreCloseFunc) PreClose(station *Framework)

PreClose it's being called only one time, BEFORE the Iris .Close method any plugin cleanup/clear memory happens here

The plugin is deactivated after this state

type PreDownloadFunc

type PreDownloadFunc func(Plugin, string)

PreDownloadFunc implements the simple function listener for the PreDownload(plugin,string)

func (PreDownloadFunc) PreDownload

func (fn PreDownloadFunc) PreDownload(pl Plugin, downloadURL string)

PreDownload it's being called every time a plugin tries to download something

first parameter is the plugin second parameter is the download url must return a boolean, if false then the plugin is not permmited to download this file

type PreListenFunc

type PreListenFunc func(*Framework)

PreListenFunc implements the simple function listener for the PreListen(*Framework)

func (PreListenFunc) PreListen

func (fn PreListenFunc) PreListen(station *Framework)

PreListen it's being called only one time, BEFORE the Server is started (if .Listen called) is used to do work at the time all other things are ready to go

parameter is the station

type PreLookupFunc

type PreLookupFunc func(Route)

PreLookupFunc implements the simple function listener for the PreLookup(Route)

func (PreLookupFunc) PreLookup

func (fn PreLookupFunc) PreLookup(r Route)

PreLookup called before register a route

type RenderOptions

type RenderOptions map[string]interface{}

RenderOptions is a helper type for the optional runtime options can be passed by user when Render an example of this is the "layout" or "gzip" option same as Map but more specific name

type ResponseEngine

type ResponseEngine interface {
	Response(interface{}, ...map[string]interface{}) ([]byte, error)
}

ResponseEngine is the interface which all response engines should implement to send responses ResponseEngine(s) can be registered with,for example: iris.UseResponse(json.New(), "application/json")

type ResponseEngineFunc

type ResponseEngineFunc func(interface{}, ...map[string]interface{}) ([]byte, error)

ResponseEngineFunc is the alternative way to implement a ResponseEngine using a simple function

func (ResponseEngineFunc) Response

func (r ResponseEngineFunc) Response(obj interface{}, options ...map[string]interface{}) ([]byte, error)

Response returns a response to the client(request's body content)

type Route

type Route interface {
	// Name returns the name of the route
	Name() string
	// Subdomain returns the subdomain,if any
	Subdomain() string
	// Method returns the http method
	Method() string
	// Path returns the path
	Path() string
	// SetPath changes/sets the path for this route
	SetPath(string)
	// Middleware returns the slice of Handler([]Handler) registed to this route
	Middleware() Middleware
	// SetMiddleware changes/sets the middleware(handler(s)) for this route
	SetMiddleware(Middleware)
}

Route contains some useful information about a route

func Lookup

func Lookup(routeName string) Route

Lookup returns a registed route by its name

func Lookups

func Lookups() []Route

Lookups returns all registed routes

type RouteNameFunc

type RouteNameFunc func(string)

RouteNameFunc the func returns from the MuxAPi's methods, optionally sets the name of the Route (*route)

func Connect

func Connect(path string, handlersFn ...HandlerFunc) RouteNameFunc

Connect registers a route for the Connect http method

func Delete

func Delete(path string, handlersFn ...HandlerFunc) RouteNameFunc

Delete registers a route for the Delete http method

func Favicon

func Favicon(favPath string, requestPath ...string) RouteNameFunc

Favicon serves static favicon accepts 2 parameters, second is optional favPath (string), declare the system directory path of the __.ico requestPath (string), it's the route's path, by default this is the "/favicon.ico" because some browsers tries to get this by default first, you can declare your own path if you have more than one favicon (desktop, mobile and so on)

this func will add a route for you which will static serve the /yuorpath/yourfile.ico to the /yourfile.ico (nothing special that you can't handle by yourself) Note that you have to call it on every favicon you have to serve automatically (dekstop, mobile and so on)

panics on error

func Get

func Get(path string, handlersFn ...HandlerFunc) RouteNameFunc

Get registers a route for the Get http method

func Handle

func Handle(method string, registedPath string, handlers ...Handler) RouteNameFunc

Handle registers a route to the server's router if empty method is passed then registers handler(s) for all methods, same as .Any, but returns nil as result

func HandleFunc

func HandleFunc(method string, registedPath string, handlersFn ...HandlerFunc) RouteNameFunc

HandleFunc registers and returns a route with a method string, path string and a handler registedPath is the relative url path

func Head(path string, handlersFn ...HandlerFunc) RouteNameFunc

Head registers a route for the Head http method

func Options

func Options(path string, handlersFn ...HandlerFunc) RouteNameFunc

Options registers a route for the Options http method

func Patch

func Patch(path string, handlersFn ...HandlerFunc) RouteNameFunc

Patch registers a route for the Patch http method

func Post

func Post(path string, handlersFn ...HandlerFunc) RouteNameFunc

Post registers a route for the Post http method

func Put

func Put(path string, handlersFn ...HandlerFunc) RouteNameFunc

Put registers a route for the Put http method

func Static

func Static(relative string, systemPath string, stripSlashes int) RouteNameFunc

Static registers a route which serves a system directory this doesn't generates an index page which list all files no compression is used also, for these features look at StaticFS func accepts three parameters first parameter is the request url path (string) second parameter is the system directory (string) third parameter is the level (int) of stripSlashes * stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar" * stripSlashes = 1, original path: "/foo/bar", result: "/bar" * stripSlashes = 2, original path: "/foo/bar", result: ""

func StaticContent

func StaticContent(reqPath string, contentType string, content []byte) RouteNameFunc

StaticContent serves bytes, memory cached, on the reqPath a good example of this is how the websocket server uses that to auto-register the /iris-ws.js

func StaticFS

func StaticFS(reqPath string, systemPath string, stripSlashes int) RouteNameFunc

StaticFS registers a route which serves a system directory this is the fastest method to serve static files generates an index page which list all files if you use this method it will generate compressed files also think this function as small fileserver with http accepts three parameters first parameter is the request url path (string) second parameter is the system directory (string) third parameter is the level (int) of stripSlashes * stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar" * stripSlashes = 1, original path: "/foo/bar", result: "/bar" * stripSlashes = 2, original path: "/foo/bar", result: ""

func StaticServe

func StaticServe(systemPath string, requestPath ...string) RouteNameFunc

StaticServe serves a directory as web resource it's the simpliest form of the Static* functions Almost same usage as StaticWeb accepts only one required parameter which is the systemPath ( the same path will be used to register the GET&HEAD routes) if second parameter is empty, otherwise the requestPath is the second parameter it uses gzip compression (compression on each request, no file cache)

func StaticWeb

func StaticWeb(reqPath string, systemPath string, stripSlashes int) RouteNameFunc

StaticWeb same as Static but if index.html exists and request uri is '/' then display the index.html's contents accepts three parameters first parameter is the request url path (string) second parameter is the system directory (string) third parameter is the level (int) of stripSlashes * stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar" * stripSlashes = 1, original path: "/foo/bar", result: "/bar" * stripSlashes = 2, original path: "/foo/bar", result: "" * if you don't know what to put on stripSlashes just 1

func Trace

func Trace(path string, handlersFn ...HandlerFunc) RouteNameFunc

Trace registers a route for the Trace http method

type Server

type Server struct {
	*fasthttp.Server

	Config config.Server
	// contains filtered or unexported fields
}

Server the http server

func AddServer

func AddServer(cfg config.Server) *Server

AddServer same as .Servers.Add(config.Server)

AddServer starts a server which listens to this station Note that the view engine's functions {{ url }} and {{ urlpath }} will return the first's registered server's scheme (http/https)

this is useful mostly when you want to have two or more listening ports ( two or more servers ) for the same station

receives one parameter which is the config.Server for the new server returns the new standalone server( you can close this server by the returning reference)

If you need only one server you can use the blocking-funcs: .Listen/ListenTLS/ListenUNIX/ListenTo

this is a NOT A BLOCKING version, the main .Listen/ListenTLS/ListenUNIX/ListenTo should be always executed LAST, so this function goes before the main .Listen/ListenTLS/ListenUNIX/ListenTo

func ListenVirtual

func ListenVirtual(optionalAddr ...string) *Server

ListenVirtual is useful only when you want to test Iris, it doesn't starts the server but it configures and returns it initializes the whole framework but server doesn't listens to a specific net.Listener it is not blocking the app

func (*Server) Close

func (s *Server) Close() (err error)

Close terminates the server

func (*Server) FullHost

func (s *Server) FullHost() string

FullHost returns the scheme+host

func (*Server) Host

func (s *Server) Host() (host string)

Host returns the registered host for the server

func (*Server) Hostname

func (s *Server) Hostname() string

Hostname returns the hostname part of the host (host expect port)

func (*Server) IsListening

func (s *Server) IsListening() bool

IsListening returns true if server is listening/started, otherwise false

func (*Server) IsOpened

func (s *Server) IsOpened() bool

IsOpened checks if handler is not nil and returns true if not, otherwise false this is used to see if a server has opened, use IsListening if you want to see if the server is actually ready to serve connections

func (*Server) IsSecure

func (s *Server) IsSecure() bool

IsSecure returns true if server uses TLS, otherwise false

func (*Server) Listener

func (s *Server) Listener() net.Listener

Listener returns the net.Listener which this server (is) listening to

func (*Server) Open

func (s *Server) Open(h fasthttp.RequestHandler) error

Open opens/starts/runs/listens (to) the server, listen tls if Cert && Key is registed, listenUNIX if Mode is registed, otherwise listen

func (*Server) Port

func (s *Server) Port() (port int)

Port returns the port which server listening for if no port given with the ListeningAddr, it returns 80

func (*Server) Scheme

func (s *Server) Scheme() string

Scheme returns http:// or https:// if SSL is enabled

type ServerList

type ServerList struct {
	// contains filtered or unexported fields
}

ServerList contains the servers connected to the Iris station

func (*ServerList) Add

func (s *ServerList) Add(cfg config.Server) *Server

Add adds a server to the list by its config returns the new server

func (*ServerList) CloseAll

func (s *ServerList) CloseAll() (err error)

CloseAll terminates all listening servers returns the first error, if erro happens it continues to closes the rest of the servers

func (*ServerList) Get

func (s *ServerList) Get(addr string) (srv *Server)

Get returns the server by it's registered Address

func (*ServerList) GetAll

func (s *ServerList) GetAll() []*Server

GetAll returns all registered servers

func (*ServerList) GetAllOpened

func (s *ServerList) GetAllOpened() (servers []*Server)

GetAllOpened returns all opened/started servers

func (*ServerList) GetByIndex

func (s *ServerList) GetByIndex(i int) *Server

GetByIndex returns a server from the list by it's index

func (*ServerList) Len

func (s *ServerList) Len() int

Len returns the size of the server list

func (*ServerList) Main

func (s *ServerList) Main() (srv *Server)

Main returns the main server, the last added server is the main server, even if's Virtual

func (*ServerList) OpenAll

func (s *ServerList) OpenAll() error

OpenAll starts all servers returns the first error happens to one of these servers if one server gets error it closes the previous servers and exits from this process

func (*ServerList) Remove

func (s *ServerList) Remove(addr string) bool

Remove deletes a server by it's registered Address returns true if something was removed, otherwise returns false

type SessionDatabase

type SessionDatabase interface {
	Load(string) map[string]interface{}
	Update(string, map[string]interface{})
}

SessionDatabase is the interface which all session databases should implement By design it doesn't support any type of cookie store like other frameworks, I want to protect you, believe me, no context access (although we could) The scope of the database is to store somewhere the sessions in order to keep them after restarting the server, nothing more. the values are stored by the underline session, the check for new sessions, or 'this session value should added' are made automatically by Iris, you are able just to set the values to your backend database with Load function. session database doesn't have any write or read access to the session, the loading of the initial data is done by the Load(string) map[string]interfface{} function synchronization are made automatically, you can register more than one session database but the first non-empty Load return data will be used as the session values.

type TemplateEngine

type TemplateEngine interface {
	// LoadDirectory builds the templates, usually by directory and extension but these are engine's decisions
	LoadDirectory(directory string, extension string) error
	// LoadAssets loads the templates by binary
	// assetFn is a func which returns bytes, use it to load the templates by binary
	// namesFn returns the template filenames
	LoadAssets(virtualDirectory string, virtualExtension string, assetFn func(name string) ([]byte, error), namesFn func() []string) error

	// ExecuteWriter finds, execute a template and write its result to the out writer
	// options are the optional runtime options can be passed by user and catched by the template engine when render
	// an example of this is the "layout" or "gzip" option
	ExecuteWriter(out io.Writer, name string, binding interface{}, options ...map[string]interface{}) error
}

TemplateEngine the interface that all template engines must implement

type TemplateEngineBinaryLocation

type TemplateEngineBinaryLocation struct {
	// contains filtered or unexported fields
}

TemplateEngineBinaryLocation called after TemplateEngineLocation's Directory, used when files are distrubuted inside the app executable

func (*TemplateEngineBinaryLocation) Binary

func (t *TemplateEngineBinaryLocation) Binary(assetFn func(name string) ([]byte, error), namesFn func() []string)

Binary sets the asset(s) and asssets names to load from, works with Directory

type TemplateEngineFuncs

type TemplateEngineFuncs interface {
	// Funcs should returns the context or the funcs,
	// this property is used in order to register the iris' helper funcs
	Funcs() map[string]interface{}
}

TemplateEngineFuncs is optional interface for the TemplateEngine used to insert the Iris' standard funcs, see var 'usedFuncs'

type TemplateEngineLocation

type TemplateEngineLocation struct {
	// contains filtered or unexported fields
}

TemplateEngineLocation contains the funcs to set the location for the templates by directory or by binary

func UseTemplate

func UseTemplate(e TemplateEngine) *TemplateEngineLocation

UseTemplate adds a template engine to the iris view system it does not build/load them yet

func (*TemplateEngineLocation) Directory

func (t *TemplateEngineLocation) Directory(dir string, fileExtension string) TemplateEngineBinaryLocation

Directory sets the directory to load from returns the Binary location which is optional

type TemplateFuncs

type TemplateFuncs map[string]interface{}

TemplateFuncs is is a helper type for map[string]interface{}

func (TemplateFuncs) IsFree

func (t TemplateFuncs) IsFree(key string) bool

IsFree returns true if a function can be inserted to this map return false if this key is already used by Iris

type WebsocketConnection

type WebsocketConnection interface {
	// WebsocketEmmiter implements EmitMessage & Emit
	WebsocketEmmiter
	// ID returns the websocketConnection's identifier
	ID() string
	// OnDisconnect registers a callback which fires when this websocketConnection is closed by an error or manual
	OnDisconnect(WebsocketDisconnectFunc)
	// OnError registers a callback which fires when this websocketConnection occurs an error
	OnError(WebsocketErrorFunc)
	// EmitError can be used to send a custom error message to the websocketConnection
	//
	// It does nothing more than firing the OnError listeners. It doesn't sends anything to the client.
	EmitError(errorMessage string)
	// To defines where websocketServer should send a message
	// returns an emmiter to send messages
	To(string) WebsocketEmmiter
	// OnMessage registers a callback which fires when native websocket message received
	OnMessage(WebsocketNativeMessageFunc)
	// On registers a callback to a particular event which fires when a message to this event received
	On(string, WebsocketMessageFunc)
	// Join join a websocketConnection to a room, it doesn't check if websocketConnection is already there, so care
	Join(string)
	// Leave removes a websocketConnection from a room
	Leave(string)
}

WebsocketConnection is the client

type WebsocketConnectionFunc

type WebsocketConnectionFunc func(WebsocketConnection)

WebsocketConnectionFunc is the callback which fires when a client/websocketConnection is connected to the websocketServer. Receives one parameter which is the WebsocketConnection

type WebsocketDisconnectFunc

type WebsocketDisconnectFunc func()

WebsocketDisconnectFunc is the callback which fires when a client/websocketConnection closed

type WebsocketEmmiter

type WebsocketEmmiter interface {
	// EmitMessage sends a native websocket message
	EmitMessage([]byte) error
	// Emit sends a message on a particular event
	Emit(string, interface{}) error
}

WebsocketEmmiter is the message/or/event manager

type WebsocketErrorFunc

type WebsocketErrorFunc (func(string))

WebsocketErrorFunc is the callback which fires when an error happens

type WebsocketMessageFunc

type WebsocketMessageFunc interface{}

WebsocketMessageFunc is the second argument to the WebsocketEmmiter's Emit functions. A callback which should receives one parameter of type string, int, bool or any valid JSON/Go struct

type WebsocketNativeMessageFunc

type WebsocketNativeMessageFunc func([]byte)

WebsocketNativeMessageFunc is the callback for native websocket messages, receives one []byte parameter which is the raw client's message

type WebsocketRooms

type WebsocketRooms map[string][]string

WebsocketRooms is just a map with key a string and value slice of string

type WebsocketServer

type WebsocketServer interface {
	Config() *config.Websocket
	Upgrade(ctx *Context) error
	OnConnection(cb WebsocketConnectionFunc)
}

WebsocketServer is the websocket server, listens on the config's port, the critical part is the event OnConnection

func NewWebsocketServer

func NewWebsocketServer(c *config.Websocket) WebsocketServer

NewWebsocketServer creates a websocket server and returns it

Directories

Path Synopsis
Package config defines the default settings and semantic variables
Package config defines the default settings and semantic variables

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL