{"modulePath":"github.com/code-hex/echo","version":"v2.2.0+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package engine\n\n## Types\n\n```go\ntype Config struct {\n\tAddress      string        // TCP address to listen on.\n\tListener     net.Listener  // Custom `net.Listener`. If set, server accepts connections on it.\n\tTLSCertFile  string        // TLS certificate file path.\n\tTLSKeyFile   string        // TLS key file path.\n\tDisableHTTP2 bool          // Disables HTTP/2.\n\tReadTimeout  time.Duration // Maximum duration before timing out read of the request.\n\tWriteTimeout time.Duration // Maximum duration before timing out write of the response.\n}\n```\nConfig defines engine config.\n\n```go\ntype Cookie interface {\n\t// Name returns the name of the cookie.\n\tName() string\n\n\t// Value returns the value of the cookie.\n\tValue() string\n\n\t// Path returns the path of the cookie.\n\tPath() string\n\n\t// Domain returns the domain of the cookie.\n\tDomain() string\n\n\t// Expires returns the expiry time of the cookie.\n\tExpires() time.Time\n\n\t// Secure indicates if cookie is secured.\n\tSecure() bool\n\n\t// HTTPOnly indicate if cookies is HTTP only.\n\tHTTPOnly() bool\n}\n```\nCookie defines the interface for HTTP cookie.\n\n```go\ntype Handler interface {\n\tServeHTTP(Request, Response)\n}\n```\nHandler defines an interface to server HTTP requests via \\`ServeHTTP(Request, Response)\\` function.\n\n```go\ntype HandlerFunc func(Request, Response)\n```\nHandlerFunc is an adapter to allow the use of \\`func(Request, Response)\\` as an HTTP handler.\n\n```go\nfunc (h HandlerFunc) ServeHTTP(req Request, res Response)\n```\nServeHTTP serves HTTP request.\n\n```go\ntype Header interface {\n\t// Add adds the key, value pair to the header. It appends to any existing values\n\t// associated with key.\n\tAdd(string, string)\n\n\t// Del deletes the values associated with key.\n\tDel(string)\n\n\t// Set sets the header entries associated with key to the single element value.\n\t// It replaces any existing values associated with key.\n\tSet(string, string)\n\n\t// Get gets the first value associated with the given key. If there are\n\t// no values associated with the key, Get returns \"\".\n\tGet(string) string\n\n\t// Keys returns the header keys.\n\tKeys() []string\n\n\t// Contains checks if the header is set.\n\tContains(string) bool\n}\n```\nHeader defines the interface for HTTP header.\n\n```go\ntype Request interface {\n\t// IsTLS returns true if HTTP connection is TLS otherwise false.\n\tIsTLS() bool\n\n\t// Scheme returns the HTTP protocol scheme, `http` or `https`.\n\tScheme() string\n\n\t// Host returns HTTP request host. Per RFC 2616, this is either the value of\n\t// the `Host` header or the host name given in the URL itself.\n\tHost() string\n\n\t// SetHost sets the host of the request.\n\tSetHost(string)\n\n\t// URI returns the unmodified `Request-URI` sent by the client.\n\tURI() string\n\n\t// SetURI sets the URI of the request.\n\tSetURI(string)\n\n\t// URL returns `engine.URL`.\n\tURL() URL\n\n\t// Header returns `engine.Header`.\n\tHeader() Header\n\n\t// Referer returns the referring URL, if sent in the request.\n\tReferer() string\n\n\t// ContentLength returns the size of request's body.\n\tContentLength() int64\n\n\t// UserAgent returns the client's `User-Agent`.\n\tUserAgent() string\n\n\t// RemoteAddress returns the client's network address.\n\tRemoteAddress() string\n\n\t// RealIP returns the client's network address based on `X-Forwarded-For`\n\t// or `X-Real-IP` request header.\n\tRealIP() string\n\n\t// Method returns the request's HTTP function.\n\tMethod() string\n\n\t// SetMethod sets the HTTP method of the request.\n\tSetMethod(string)\n\n\t// Body returns request's body.\n\tBody() io.Reader\n\n\t// Body sets request's body.\n\tSetBody(io.Reader)\n\n\t// FormValue returns the form field value for the provided name.\n\tFormValue(string) string\n\n\t// FormParams returns the form parameters.\n\tFormParams() map[string][]string\n\n\t// FormFile returns the multipart form file for the provided name.\n\tFormFile(string) (*multipart.FileHeader, error)\n\n\t// MultipartForm returns the multipart form.\n\tMultipartForm() (*multipart.Form, error)\n\n\t// Cookie returns the named cookie provided in the request.\n\tCookie(string) (Cookie, error)\n\n\t// Cookies returns the HTTP cookies sent with the request.\n\tCookies() []Cookie\n}\n```\nRequest defines the interface for HTTP request.\n\n```go\ntype Response interface {\n\t// Header returns `engine.Header`\n\tHeader() Header\n\n\t// WriteHeader sends an HTTP response header with status code.\n\tWriteHeader(int)\n\n\t// Write writes the data to the connection as part of an HTTP reply.\n\tWrite(b []byte) (int, error)\n\n\t// SetCookie adds a `Set-Cookie` header in HTTP response.\n\tSetCookie(Cookie)\n\n\t// Status returns the HTTP response status.\n\tStatus() int\n\n\t// Size returns the number of bytes written to HTTP response.\n\tSize() int64\n\n\t// Committed returns true if HTTP response header is written, otherwise false.\n\tCommitted() bool\n\n\t// Write returns the HTTP response writer.\n\tWriter() io.Writer\n\n\t// SetWriter sets the HTTP response writer.\n\tSetWriter(io.Writer)\n}\n```\nResponse defines the interface for HTTP response.\n\n```go\ntype Server interface {\n\t// SetHandler sets the handler for the HTTP server.\n\tSetHandler(Handler)\n\n\t// SetLogger sets the logger for the HTTP server.\n\tSetLogger(log.Logger)\n\n\t// Start starts the HTTP server.\n\tStart() error\n\n\t// Stop stops the HTTP server by closing underlying TCP connection.\n\tStop() error\n}\n```\nServer defines the interface for HTTP server.\n\n```go\ntype URL interface {\n\t// Path returns the request URL path.\n\tPath() string\n\n\t// SetPath sets the request URL path.\n\tSetPath(string)\n\n\t// QueryParam returns the query param for the provided name.\n\tQueryParam(string) string\n\n\t// QueryParam returns the query parameters as map.\n\tQueryParams() map[string][]string\n\n\t// QueryString returns the URL query string.\n\tQueryString() string\n}\n```\nURL defines the interface for HTTP request url.\n\n","path":"github.com/code-hex/echo/engine","name":"engine","synopsis":"","isRedistributable":true}
