mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 02:17:05 +00:00
Developers can ignore this update. Use of go-websocket and go-errors. Zero front-end changes. No real improvements.
This commit is contained in:
@@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
**How to upgrade**: remove your `$GOPATH/src/github.com/kataras/iris` folder, open your command-line and execute this command: `go get -u github.com/kataras/iris/iris`.
|
**How to upgrade**: remove your `$GOPATH/src/github.com/kataras/iris` folder, open your command-line and execute this command: `go get -u github.com/kataras/iris/iris`.
|
||||||
|
|
||||||
|
## 4.1.1 -> 4.1.2
|
||||||
|
|
||||||
|
Zero front-end changes. No real improvements, developers can ignore this update.
|
||||||
|
|
||||||
|
- Replace the main and underline websocket implementation with [go-websocket](https://github.com/kataras/go-websocket). Note that we still need the [ris-contrib/websocket](https://github.com/iris-contrib/websocket) package.
|
||||||
|
- Replace the use of iris-contrib/errors with [go-errors](https://github.com/kataras/go-errors), which has more features
|
||||||
|
|
||||||
## 4.0.0 -> 4.1.1
|
## 4.0.0 -> 4.1.1
|
||||||
|
|
||||||
- **NEW FEATURE**: Basic remote control through SSH, example [here](https://github.com/iris-contrib/examples/blob/master/ssh/main.go)
|
- **NEW FEATURE**: Basic remote control through SSH, example [here](https://github.com/iris-contrib/examples/blob/master/ssh/main.go)
|
||||||
|
|||||||
21
README.md
21
README.md
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<a href="https://github.com/kataras/iris/blob/master/LICENSE"><img src="https://img.shields.io/badge/%20license-MIT%20%20License%20-E91E63.svg?style=flat-square" alt="License"></a>
|
<a href="https://github.com/kataras/iris/blob/master/LICENSE"><img src="https://img.shields.io/badge/%20license-MIT%20%20License%20-E91E63.svg?style=flat-square" alt="License"></a>
|
||||||
|
|
||||||
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20release%20-%20v4.1.1%20-blue.svg?style=flat-square" alt="Releases"></a>
|
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20release%20-%20v4.1.2%20-blue.svg?style=flat-square" alt="Releases"></a>
|
||||||
|
|
||||||
<a href="https://www.gitbook.com/book/kataras/iris/details"><img src="https://img.shields.io/badge/%20docs-reference-5272B4.svg?style=flat-square" alt="Practical Guide/Docs"></a><br/>
|
<a href="https://www.gitbook.com/book/kataras/iris/details"><img src="https://img.shields.io/badge/%20docs-reference-5272B4.svg?style=flat-square" alt="Practical Guide/Docs"></a><br/>
|
||||||
|
|
||||||
@@ -108,6 +108,21 @@ Features
|
|||||||
| [Iris control Plugin](https://github.com/iris-contrib/plugin/tree/master/iriscontrol) | Basic (browser-based) control over your Iris station | [example](https://github.com/iris-contrib/examples/blob/master/plugin_iriscontrol/main.go), [book section](https://kataras.gitbooks.io/iris/content/plugin-iriscontrol.html) |
|
| [Iris control Plugin](https://github.com/iris-contrib/plugin/tree/master/iriscontrol) | Basic (browser-based) control over your Iris station | [example](https://github.com/iris-contrib/examples/blob/master/plugin_iriscontrol/main.go), [book section](https://kataras.gitbooks.io/iris/content/plugin-iriscontrol.html) |
|
||||||
|
|
||||||
|
|
||||||
|
go-* packages
|
||||||
|
------------
|
||||||
|
|
||||||
|
| Name | Description
|
||||||
|
| ------------------|:---------------------:|
|
||||||
|
| [go-errors](https://github.com/kataras/go-errors) | Error handling
|
||||||
|
| [go-fs](https://github.com/kataras/go-fs) | FileSystem utils and common net/http static files handlers
|
||||||
|
| [go-events](https://github.com/kataras/go-events) | EventEmmiter for Go
|
||||||
|
| [go-websocket](https://github.com/kataras/go-errors) | A websocket server and ,optionally, client side lib for Go
|
||||||
|
| [go-ssh](https://github.com/kataras/go-ssh) | SSH Server, build ssh interfaces, remote commands and remote cli with ease
|
||||||
|
| [go-gzipwriter](https://github.com/kataras/go-gzipwriter) | Write gzip data to a io.Writer
|
||||||
|
| [go-mailer](https://github.com/kataras/go-mailer) | E-mail Sender, send rich mails with one call
|
||||||
|
| [rizla](https://github.com/kataras/rizla) | Monitor and live-reload of your Go App
|
||||||
|
| [Q](https://github.com/kataras/q) | HTTP2 Web Framework, 100% compatible with net/http
|
||||||
|
|
||||||
FAQ
|
FAQ
|
||||||
------------
|
------------
|
||||||
Explore [these questions](https://github.com/kataras/iris/issues?q=label%3Aquestion) or navigate to the [community chat][Chat].
|
Explore [these questions](https://github.com/kataras/iris/issues?q=label%3Aquestion) or navigate to the [community chat][Chat].
|
||||||
@@ -144,7 +159,7 @@ I recommend writing your API tests using this new library, [httpexpect](https://
|
|||||||
Versioning
|
Versioning
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Current: **v4.1.1**
|
Current: **v4.1.2**
|
||||||
|
|
||||||
> Iris is an active project
|
> Iris is an active project
|
||||||
|
|
||||||
@@ -179,7 +194,7 @@ License can be found [here](LICENSE).
|
|||||||
[Travis]: http://travis-ci.org/kataras/iris
|
[Travis]: http://travis-ci.org/kataras/iris
|
||||||
[License Widget]: https://img.shields.io/badge/license-MIT%20%20License%20-E91E63.svg?style=flat-square
|
[License Widget]: https://img.shields.io/badge/license-MIT%20%20License%20-E91E63.svg?style=flat-square
|
||||||
[License]: https://github.com/kataras/iris/blob/master/LICENSE
|
[License]: https://github.com/kataras/iris/blob/master/LICENSE
|
||||||
[Release Widget]: https://img.shields.io/badge/release-v4.1.1-blue.svg?style=flat-square
|
[Release Widget]: https://img.shields.io/badge/release-v4.1.2-blue.svg?style=flat-square
|
||||||
[Release]: https://github.com/kataras/iris/releases
|
[Release]: https://github.com/kataras/iris/releases
|
||||||
[Chat Widget]: https://img.shields.io/badge/community-chat-00BCD4.svg?style=flat-square
|
[Chat Widget]: https://img.shields.io/badge/community-chat-00BCD4.svg?style=flat-square
|
||||||
[Chat]: https://kataras.rocket.chat/channel/iris
|
[Chat]: https://kataras.rocket.chat/channel/iris
|
||||||
|
|||||||
17
context.go
17
context.go
@@ -21,8 +21,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/iris-contrib/errors"
|
|
||||||
"github.com/iris-contrib/formBinder"
|
"github.com/iris-contrib/formBinder"
|
||||||
|
"github.com/kataras/go-errors"
|
||||||
"github.com/kataras/iris/config"
|
"github.com/kataras/iris/config"
|
||||||
"github.com/kataras/iris/context"
|
"github.com/kataras/iris/context"
|
||||||
"github.com/kataras/iris/utils"
|
"github.com/kataras/iris/utils"
|
||||||
@@ -49,8 +49,11 @@ const (
|
|||||||
contentBinary = "application/octet-stream"
|
contentBinary = "application/octet-stream"
|
||||||
// ContentJSON header value for JSON data.
|
// ContentJSON header value for JSON data.
|
||||||
contentJSON = "application/json"
|
contentJSON = "application/json"
|
||||||
// ContentJSONP header value for JSONP data.
|
// ContentJSONP header value for JSONP & Javascript data.
|
||||||
contentJSONP = "application/javascript"
|
contentJSONP = "application/javascript"
|
||||||
|
// ContentJavascript header value for Javascript/JSONP
|
||||||
|
// conversional
|
||||||
|
contentJavascript = "application/javascript"
|
||||||
// ContentText header value for Text data.
|
// ContentText header value for Text data.
|
||||||
contentText = "text/plain"
|
contentText = "text/plain"
|
||||||
// ContentXML header value for XML data.
|
// ContentXML header value for XML data.
|
||||||
@@ -402,12 +405,12 @@ func (ctx *Context) ReadForm(formObject interface{}) error {
|
|||||||
multipartForm, err := reqCtx.MultipartForm()
|
multipartForm, err := reqCtx.MultipartForm()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
//we have multipart form
|
//we have multipart form
|
||||||
return errReadBody.With(formBinder.Decode(multipartForm.Value, formObject))
|
return errReadBody.Format(formBinder.Decode(multipartForm.Value, formObject))
|
||||||
}
|
}
|
||||||
// if no multipart and post arguments ( means normal form)
|
// if no multipart and post arguments ( means normal form)
|
||||||
|
|
||||||
if reqCtx.PostArgs().Len() == 0 && reqCtx.QueryArgs().Len() == 0 {
|
if reqCtx.PostArgs().Len() == 0 && reqCtx.QueryArgs().Len() == 0 {
|
||||||
return errReadBody.With(errNoForm.Return())
|
return errReadBody.Format(errNoForm)
|
||||||
}
|
}
|
||||||
|
|
||||||
form := make(map[string][]string, reqCtx.PostArgs().Len()+reqCtx.QueryArgs().Len())
|
form := make(map[string][]string, reqCtx.PostArgs().Len()+reqCtx.QueryArgs().Len())
|
||||||
@@ -435,7 +438,7 @@ func (ctx *Context) ReadForm(formObject interface{}) error {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return errReadBody.With(formBinder.Decode(form, formObject))
|
return errReadBody.Format(formBinder.Decode(form, formObject))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Response */
|
/* Response */
|
||||||
@@ -651,7 +654,7 @@ func (ctx *Context) ServeContent(content io.ReadSeeker, filename string, modtime
|
|||||||
|
|
||||||
}
|
}
|
||||||
_, err := io.Copy(out, content)
|
_, err := io.Copy(out, content)
|
||||||
return errServeContent.With(err)
|
return errServeContent.Format(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServeFile serves a view file, to send a file ( zip for example) to the client you should use the SendFile(serverfilename,clientfilename)
|
// ServeFile serves a view file, to send a file ( zip for example) to the client you should use the SendFile(serverfilename,clientfilename)
|
||||||
@@ -902,7 +905,7 @@ func (ctx *Context) GetFlash(key string) (string, error) {
|
|||||||
|
|
||||||
cookieKey, cookieValue := ctx.decodeFlashCookie(key)
|
cookieKey, cookieValue := ctx.decodeFlashCookie(key)
|
||||||
if cookieValue == "" {
|
if cookieValue == "" {
|
||||||
return "", errFlashNotFound.Return()
|
return "", errFlashNotFound
|
||||||
}
|
}
|
||||||
// store this flash message to the lifetime request's local storage,
|
// store this flash message to the lifetime request's local storage,
|
||||||
// I choose this method because no need to store it if not used at all
|
// I choose this method because no need to store it if not used at all
|
||||||
|
|||||||
118
glide.lock
generated
118
glide.lock
generated
@@ -1,118 +0,0 @@
|
|||||||
hash: 27412419f856542949823407f446947b0d68376a907cc8d3c0071d33fc4d5e99
|
|
||||||
updated: 2016-06-30T17:27:11.6436557+03:00
|
|
||||||
imports:
|
|
||||||
- name: github.com/aymerick/raymond
|
|
||||||
version: a2232af10b53ef1ae5a767f5178db3a6c1dab655
|
|
||||||
subpackages:
|
|
||||||
- github.com\aymerick\raymond
|
|
||||||
- github.com\aymerick\raymond\ast
|
|
||||||
- github.com\aymerick\raymond\parser
|
|
||||||
- github.com\aymerick\raymond\lexer
|
|
||||||
- name: github.com/eknkc/amber
|
|
||||||
version: 91774f050c1453128146169b626489e60108ec03
|
|
||||||
subpackages:
|
|
||||||
- github.com\eknkc\amber
|
|
||||||
- github.com\eknkc\amber\parser
|
|
||||||
- name: github.com/fatih/color
|
|
||||||
version: 87d4004f2ab62d0d255e0a38f1680aa534549fe3
|
|
||||||
subpackages:
|
|
||||||
- github.com\fatih\color
|
|
||||||
- name: github.com/flosch/pongo2
|
|
||||||
version: 7f5515449ea9bbeb00256d9cbb654c556e7d0146
|
|
||||||
subpackages:
|
|
||||||
- github.com\flosch\pongo2
|
|
||||||
- name: github.com/fsnotify/fsnotify
|
|
||||||
version: a8a77c9133d2d6fd8334f3260d06f60e8d80a5fb
|
|
||||||
subpackages:
|
|
||||||
- github.com\fsnotify\fsnotify
|
|
||||||
- name: github.com/garyburd/redigo
|
|
||||||
version: b8dc90050f24c1a73a52f107f3f575be67b21b7c
|
|
||||||
subpackages:
|
|
||||||
- github.com\garyburd\redigo\redis
|
|
||||||
- github.com\garyburd\redigo\internal
|
|
||||||
- name: github.com/imdario/mergo
|
|
||||||
version: 50d4dbd4eb0e84778abe37cefef140271d96fade
|
|
||||||
subpackages:
|
|
||||||
- github.com\imdario\mergo
|
|
||||||
- name: github.com/iris-contrib/color
|
|
||||||
version: 62c14c567492326ac5a952fb13e69533d2c6a735
|
|
||||||
subpackages:
|
|
||||||
- github.com\iris-contrib\color
|
|
||||||
- name: github.com/iris-contrib/errors
|
|
||||||
version: 9d4599565f75fd376a8e4ae5ccc98fc078b93b69
|
|
||||||
subpackages:
|
|
||||||
- github.com\iris-contrib\errors
|
|
||||||
- name: github.com/iris-contrib/formBinder
|
|
||||||
version: c311e88d3a2dd059c5d79c7ed3703cf0492088e3
|
|
||||||
subpackages:
|
|
||||||
- github.com\iris-contrib\formBinder
|
|
||||||
- name: github.com/iris-contrib/websocket
|
|
||||||
version: a2c30084384c39ce6595169df8b93d7298ac04cd
|
|
||||||
subpackages:
|
|
||||||
- github.com\iris-contrib\websocket
|
|
||||||
- name: github.com/Joker/jade
|
|
||||||
version: db4d7e4f68708c5020c392b380e3565df2132840
|
|
||||||
subpackages:
|
|
||||||
- github.com\Joker\jade
|
|
||||||
- name: github.com/kataras/cli
|
|
||||||
version: df0553868c71f2a6410b9792b5a7f61710567f41
|
|
||||||
subpackages:
|
|
||||||
- github.com\kataras\cli
|
|
||||||
- name: github.com/kataras/rizla
|
|
||||||
version: e525ea809fd22f54c5415ddfee364543d06d95a8
|
|
||||||
subpackages:
|
|
||||||
- github.com\kataras\rizla\rizla
|
|
||||||
- name: github.com/klauspost/compress
|
|
||||||
version: 14eb9c4951195779ecfbec34431a976de7335b0a
|
|
||||||
subpackages:
|
|
||||||
- github.com\klauspost\compress\gzip
|
|
||||||
- github.com\klauspost\compress\flate
|
|
||||||
- github.com\klauspost\compress\zlib
|
|
||||||
- name: github.com/klauspost/cpuid
|
|
||||||
version: 09cded8978dc9e80714c4d85b0322337b0a1e5e0
|
|
||||||
subpackages:
|
|
||||||
- github.com\klauspost\cpuid
|
|
||||||
- name: github.com/klauspost/crc32
|
|
||||||
version: 19b0b332c9e4516a6370a0456e6182c3b5036720
|
|
||||||
subpackages:
|
|
||||||
- github.com\klauspost\crc32
|
|
||||||
- name: github.com/mattn/go-colorable
|
|
||||||
version: 9056b7a9f2d1f2d96498d6d146acd1f9d5ed3d59
|
|
||||||
subpackages:
|
|
||||||
- github.com\mattn\go-colorable
|
|
||||||
- name: github.com/mattn/go-isatty
|
|
||||||
version: 56b76bdf51f7708750eac80fa38b952bb9f32639
|
|
||||||
subpackages:
|
|
||||||
- github.com\mattn\go-isatty
|
|
||||||
- name: github.com/microcosm-cc/bluemonday
|
|
||||||
version: 4ac6f27528d0a3f2a59e0b0a6f6b3ff0bb89fe20
|
|
||||||
subpackages:
|
|
||||||
- github.com\microcosm-cc\bluemonday
|
|
||||||
- name: github.com/russross/blackfriday
|
|
||||||
version: 1d6b8e9301e720b08a8938b8c25c018285885438
|
|
||||||
subpackages:
|
|
||||||
- github.com\russross\blackfriday
|
|
||||||
- name: github.com/shurcooL/sanitized_anchor_name
|
|
||||||
version: 10ef21a441db47d8b13ebcc5fd2310f636973c77
|
|
||||||
subpackages:
|
|
||||||
- github.com\shurcooL\sanitized_anchor_name
|
|
||||||
- name: github.com/valyala/bytebufferpool
|
|
||||||
version: 21a4b2115581cdabcc9cd97b1624d56785fc407e
|
|
||||||
subpackages:
|
|
||||||
- github.com\valyala\bytebufferpool
|
|
||||||
- name: github.com/valyala/fasthttp
|
|
||||||
version: 45697fe30a130ec6a54426a069c82f3abe76b63d
|
|
||||||
subpackages:
|
|
||||||
- github.com\valyala\fasthttp
|
|
||||||
- github.com\valyala\fasthttp\fasthttpadaptor
|
|
||||||
- github.com\valyala\fasthttp\fasthttputil
|
|
||||||
- name: golang.org/x/net
|
|
||||||
version: 8e573f4005aa312856df2ea97c32b9beac70dd89
|
|
||||||
subpackages:
|
|
||||||
- golang.org\x\net\html
|
|
||||||
- golang.org\x\net\html\atom
|
|
||||||
- name: golang.org/x/sys
|
|
||||||
version: 62bee037599929a6e9146f29d10dd5208c43507d
|
|
||||||
subpackages:
|
|
||||||
- golang.org\x\sys\unix
|
|
||||||
devImports: []
|
|
||||||
59
glide.yaml
59
glide.yaml
@@ -1,59 +0,0 @@
|
|||||||
package: github.com/kataras/iris
|
|
||||||
homepage: https://iris-go.com
|
|
||||||
license: MIT
|
|
||||||
owners:
|
|
||||||
- name: Gerasimos Maropoulos
|
|
||||||
homepage: https://about.me/makismaropoulos
|
|
||||||
import:
|
|
||||||
- package: github.com/Joker/jade
|
|
||||||
subpackages:
|
|
||||||
- github.com\Joker\jade
|
|
||||||
- package: github.com/aymerick/raymond
|
|
||||||
subpackages:
|
|
||||||
- github.com\aymerick\raymond
|
|
||||||
- package: github.com/eknkc/amber
|
|
||||||
subpackages:
|
|
||||||
- github.com\eknkc\amber
|
|
||||||
- package: github.com/fatih/color
|
|
||||||
subpackages:
|
|
||||||
- github.com\fatih\color
|
|
||||||
- package: github.com/flosch/pongo2
|
|
||||||
subpackages:
|
|
||||||
- github.com\flosch\pongo2
|
|
||||||
- package: github.com/garyburd/redigo
|
|
||||||
subpackages:
|
|
||||||
- github.com\garyburd\redigo\redis
|
|
||||||
- package: github.com/imdario/mergo
|
|
||||||
subpackages:
|
|
||||||
- github.com\imdario\mergo
|
|
||||||
- package: github.com/iris-contrib/errors
|
|
||||||
subpackages:
|
|
||||||
- github.com\iris-contrib\errors
|
|
||||||
- package: github.com/iris-contrib/formBinder
|
|
||||||
subpackages:
|
|
||||||
- github.com\iris-contrib\formBinder
|
|
||||||
- package: github.com/iris-contrib/websocket
|
|
||||||
subpackages:
|
|
||||||
- github.com\iris-contrib\websocket
|
|
||||||
- package: github.com/kataras/cli
|
|
||||||
subpackages:
|
|
||||||
- github.com\kataras\cli
|
|
||||||
- package: github.com/kataras/rizla
|
|
||||||
subpackages:
|
|
||||||
- github.com\kataras\rizla\rizla
|
|
||||||
- package: github.com/klauspost/compress
|
|
||||||
subpackages:
|
|
||||||
- github.com\klauspost\compress\gzip
|
|
||||||
- package: github.com/mattn/go-colorable
|
|
||||||
subpackages:
|
|
||||||
- github.com\mattn\go-colorable
|
|
||||||
- package: github.com/microcosm-cc/bluemonday
|
|
||||||
subpackages:
|
|
||||||
- github.com\microcosm-cc\bluemonday
|
|
||||||
- package: github.com/russross/blackfriday
|
|
||||||
subpackages:
|
|
||||||
- github.com\russross\blackfriday
|
|
||||||
- package: github.com/valyala/fasthttp
|
|
||||||
subpackages:
|
|
||||||
- github.com\valyala\fasthttp
|
|
||||||
- github.com\valyala\fasthttp\fasthttpadaptor
|
|
||||||
12
http.go
12
http.go
@@ -13,9 +13,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/iris-contrib/errors"
|
|
||||||
"github.com/iris-contrib/letsencrypt"
|
"github.com/iris-contrib/letsencrypt"
|
||||||
"github.com/iris-contrib/logger"
|
"github.com/iris-contrib/logger"
|
||||||
|
"github.com/kataras/go-errors"
|
||||||
"github.com/kataras/iris/config"
|
"github.com/kataras/iris/config"
|
||||||
"github.com/kataras/iris/utils"
|
"github.com/kataras/iris/utils"
|
||||||
"github.com/valyala/fasthttp"
|
"github.com/valyala/fasthttp"
|
||||||
@@ -358,7 +358,7 @@ func (s *Server) Hostname() string {
|
|||||||
|
|
||||||
func (s *Server) listen() error {
|
func (s *Server) listen() error {
|
||||||
if s.IsListening() {
|
if s.IsListening() {
|
||||||
return errServerAlreadyStarted.Return()
|
return errServerAlreadyStarted
|
||||||
}
|
}
|
||||||
listener, err := net.Listen("tcp4", s.Config.ListeningAddr)
|
listener, err := net.Listen("tcp4", s.Config.ListeningAddr)
|
||||||
|
|
||||||
@@ -383,7 +383,7 @@ func (s *Server) listenUNIX() error {
|
|||||||
listener, err := net.Listen("unix", addr)
|
listener, err := net.Listen("unix", addr)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errServerPortAlreadyUsed.Return()
|
return errServerPortAlreadyUsed
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = os.Chmod(addr, mode); err != nil {
|
if err = os.Chmod(addr, mode); err != nil {
|
||||||
@@ -423,11 +423,11 @@ func (s *Server) serve(l net.Listener) error {
|
|||||||
// Open opens/starts/runs/listens (to) the server, listen tls if Cert && Key is registed, listenUNIX if Mode is registed, otherwise listen
|
// Open opens/starts/runs/listens (to) the server, listen tls if Cert && Key is registed, listenUNIX if Mode is registed, otherwise listen
|
||||||
func (s *Server) Open(h fasthttp.RequestHandler) error {
|
func (s *Server) Open(h fasthttp.RequestHandler) error {
|
||||||
if h == nil {
|
if h == nil {
|
||||||
return errServerHandlerMissing.Return()
|
return errServerHandlerMissing
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.IsListening() {
|
if s.IsListening() {
|
||||||
return errServerAlreadyStarted.Return()
|
return errServerAlreadyStarted
|
||||||
}
|
}
|
||||||
|
|
||||||
s.Server.MaxRequestBodySize = s.Config.MaxRequestBodySize
|
s.Server.MaxRequestBodySize = s.Config.MaxRequestBodySize
|
||||||
@@ -466,7 +466,7 @@ func (s *Server) Open(h fasthttp.RequestHandler) error {
|
|||||||
// Close terminates the server
|
// Close terminates the server
|
||||||
func (s *Server) Close() (err error) {
|
func (s *Server) Close() (err error) {
|
||||||
if !s.IsListening() {
|
if !s.IsListening() {
|
||||||
return errServerIsClosed.Return()
|
return errServerIsClosed
|
||||||
}
|
}
|
||||||
err = s.listener.Close()
|
err = s.listener.Close()
|
||||||
|
|
||||||
|
|||||||
10
iris.go
10
iris.go
@@ -68,7 +68,6 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/gavv/httpexpect"
|
"github.com/gavv/httpexpect"
|
||||||
"github.com/iris-contrib/errors"
|
|
||||||
"github.com/iris-contrib/logger"
|
"github.com/iris-contrib/logger"
|
||||||
"github.com/iris-contrib/response/data"
|
"github.com/iris-contrib/response/data"
|
||||||
"github.com/iris-contrib/response/json"
|
"github.com/iris-contrib/response/json"
|
||||||
@@ -77,6 +76,7 @@ import (
|
|||||||
"github.com/iris-contrib/response/text"
|
"github.com/iris-contrib/response/text"
|
||||||
"github.com/iris-contrib/response/xml"
|
"github.com/iris-contrib/response/xml"
|
||||||
"github.com/iris-contrib/template/html"
|
"github.com/iris-contrib/template/html"
|
||||||
|
"github.com/kataras/go-errors"
|
||||||
"github.com/kataras/iris/config"
|
"github.com/kataras/iris/config"
|
||||||
"github.com/kataras/iris/context"
|
"github.com/kataras/iris/context"
|
||||||
"github.com/kataras/iris/utils"
|
"github.com/kataras/iris/utils"
|
||||||
@@ -85,7 +85,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Version of the iris
|
// Version of the iris
|
||||||
Version = "4.1.1"
|
Version = "4.1.2"
|
||||||
|
|
||||||
banner = ` _____ _
|
banner = ` _____ _
|
||||||
|_ _| (_)
|
|_ _| (_)
|
||||||
@@ -101,7 +101,7 @@ var (
|
|||||||
Config *config.Iris
|
Config *config.Iris
|
||||||
Logger *logger.Logger
|
Logger *logger.Logger
|
||||||
Plugins PluginContainer
|
Plugins PluginContainer
|
||||||
Websocket WebsocketServer
|
Websocket *WebsocketServer
|
||||||
// Look ssh.go for this field's configuration
|
// Look ssh.go for this field's configuration
|
||||||
// example: https://github.com/iris-contrib/examples/blob/master/ssh/main.go
|
// example: https://github.com/iris-contrib/examples/blob/master/ssh/main.go
|
||||||
SSH *SSHServer
|
SSH *SSHServer
|
||||||
@@ -183,7 +183,7 @@ type (
|
|||||||
// configuration by instance.Logger.Config
|
// configuration by instance.Logger.Config
|
||||||
Logger *logger.Logger
|
Logger *logger.Logger
|
||||||
Plugins PluginContainer
|
Plugins PluginContainer
|
||||||
Websocket WebsocketServer
|
Websocket *WebsocketServer
|
||||||
SSH *SSHServer
|
SSH *SSHServer
|
||||||
Available chan bool
|
Available chan bool
|
||||||
// this is setted once when .Tester(t) is called
|
// this is setted once when .Tester(t) is called
|
||||||
@@ -1283,7 +1283,7 @@ func (api *muxAPI) API(path string, restAPI HandlerAPI, middleware ...HandlerFun
|
|||||||
typ := reflect.ValueOf(restAPI).Type()
|
typ := reflect.ValueOf(restAPI).Type()
|
||||||
contextField, found := typ.FieldByName("Context")
|
contextField, found := typ.FieldByName("Context")
|
||||||
if !found {
|
if !found {
|
||||||
panic(errAPIContextNotFound.Return())
|
panic(errAPIContextNotFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check & register the Get(),Post(),Put(),Delete() and so on
|
// check & register the Get(),Post(),Put(),Delete() and so on
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package iris
|
|||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/iris-contrib/errors"
|
"github.com/kataras/go-errors"
|
||||||
|
|
||||||
"github.com/iris-contrib/logger"
|
"github.com/iris-contrib/logger"
|
||||||
"github.com/kataras/iris/utils"
|
"github.com/kataras/iris/utils"
|
||||||
@@ -275,12 +275,12 @@ func (p *pluginContainer) Reset() {
|
|||||||
// This doesn't calls the PreClose method
|
// This doesn't calls the PreClose method
|
||||||
func (p *pluginContainer) Remove(pluginName string) error {
|
func (p *pluginContainer) Remove(pluginName string) error {
|
||||||
if p.activatedPlugins == nil {
|
if p.activatedPlugins == nil {
|
||||||
return errPluginRemoveNoPlugins.Return()
|
return errPluginRemoveNoPlugins
|
||||||
}
|
}
|
||||||
|
|
||||||
if pluginName == "" {
|
if pluginName == "" {
|
||||||
//return error: cannot delete an unamed plugin
|
//return error: cannot delete an unamed plugin
|
||||||
return errPluginRemoveEmptyName.Return()
|
return errPluginRemoveEmptyName
|
||||||
}
|
}
|
||||||
|
|
||||||
indexToRemove := -1
|
indexToRemove := -1
|
||||||
@@ -290,7 +290,7 @@ func (p *pluginContainer) Remove(pluginName string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if indexToRemove == -1 { //if index stills -1 then no plugin was found with this name, just return an error. it is not a critical error.
|
if indexToRemove == -1 { //if index stills -1 then no plugin was found with this name, just return an error. it is not a critical error.
|
||||||
return errPluginRemoveNotFound.Return()
|
return errPluginRemoveNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
p.activatedPlugins = append(p.activatedPlugins[:indexToRemove], p.activatedPlugins[indexToRemove+1:]...)
|
p.activatedPlugins = append(p.activatedPlugins[:indexToRemove], p.activatedPlugins[indexToRemove+1:]...)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package iris
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/iris-contrib/errors"
|
"github.com/kataras/go-errors"
|
||||||
"github.com/valyala/fasthttp"
|
"github.com/valyala/fasthttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ func (r *responseEngineMap) render(ctx *Context, obj interface{}, options ...map
|
|||||||
|
|
||||||
if r == nil {
|
if r == nil {
|
||||||
//render, but no response engine registered, this caused by context.RenderWithStatus, and responseEngines. getBy
|
//render, but no response engine registered, this caused by context.RenderWithStatus, and responseEngines. getBy
|
||||||
return errNoResponseEngineFound.Return()
|
return errNoResponseEngineFound
|
||||||
}
|
}
|
||||||
|
|
||||||
var finalResult []byte
|
var finalResult []byte
|
||||||
@@ -168,7 +168,7 @@ func (r *responseEngineMap) render(ctx *Context, obj interface{}, options ...map
|
|||||||
func (r *responseEngineMap) toString(obj interface{}, options ...map[string]interface{}) (string, error) {
|
func (r *responseEngineMap) toString(obj interface{}, options ...map[string]interface{}) (string, error) {
|
||||||
if r == nil {
|
if r == nil {
|
||||||
//render, but no response engine registered, this caused by context.RenderWithStatus, and responseEngines. getBy
|
//render, but no response engine registered, this caused by context.RenderWithStatus, and responseEngines. getBy
|
||||||
return "", errNoResponseEngineFound.Return()
|
return "", errNoResponseEngineFound
|
||||||
}
|
}
|
||||||
var finalResult []byte
|
var finalResult []byte
|
||||||
for i, n := 0, len(r.values); i < n; i++ {
|
for i, n := 0, len(r.values); i < n; i++ {
|
||||||
|
|||||||
2
ssh.go
2
ssh.go
@@ -43,10 +43,10 @@ import (
|
|||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/iris-contrib/errors"
|
|
||||||
"github.com/iris-contrib/logger"
|
"github.com/iris-contrib/logger"
|
||||||
"github.com/kardianos/osext"
|
"github.com/kardianos/osext"
|
||||||
"github.com/kardianos/service"
|
"github.com/kardianos/service"
|
||||||
|
"github.com/kataras/go-errors"
|
||||||
"github.com/kataras/iris/utils"
|
"github.com/kataras/iris/utils"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
"golang.org/x/crypto/ssh/terminal"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/iris-contrib/errors"
|
"github.com/kataras/go-errors"
|
||||||
"github.com/kataras/iris/utils"
|
"github.com/kataras/iris/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ func (t *templateEngineWrapper) load() error {
|
|||||||
} else if t.location.directory != "" {
|
} else if t.location.directory != "" {
|
||||||
t.LoadDirectory(t.location.directory, t.location.extension)
|
t.LoadDirectory(t.location.directory, t.location.extension)
|
||||||
} else {
|
} else {
|
||||||
return errMissingDirectoryOrAssets.Return()
|
return errMissingDirectoryOrAssets
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/iris-contrib/errors"
|
"github.com/kataras/go-errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ func Unzip(archive string, target string) (string, error) {
|
|||||||
|
|
||||||
// RemoveFile removes a file or directory and returns an error, if any
|
// RemoveFile removes a file or directory and returns an error, if any
|
||||||
func RemoveFile(filePath string) error {
|
func RemoveFile(filePath string) error {
|
||||||
return ErrFileRemove.With(os.RemoveAll(filePath))
|
return ErrFileRemove.Format(os.RemoveAll(filePath))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Install is just the flow of: downloadZip -> unzip -> removeFile(zippedFile)
|
// Install is just the flow of: downloadZip -> unzip -> removeFile(zippedFile)
|
||||||
|
|||||||
1221
websocket.go
1221
websocket.go
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user