Skip to content

Commit 7997dd5

Browse files
committed
Prepare for the upcoming Iris version (v12.2.0) (master-branch)
1 parent 936153e commit 7997dd5

File tree

29 files changed

+71
-48
lines changed

29 files changed

+71
-48
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ os:
44
- linux
55
- osx
66
go:
7-
- go1.13.x
7+
- go1.14.x
88
env:
99
global:
1010
- GO111MODULE=on

README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
This repository provides a way to share any minor handlers for [iris](https://github.com/kataras/iris) web framework. You can view the built'n supported handlers by pressing [here](https://github.com/kataras/iris/tree/v12/middleware).
1+
This repository provides a way to share any minor handlers for [Iris v12.2.0+](https://github.com/kataras/iris) web framework. You can view the built'n supported handlers by pressing [here](https://github.com/kataras/iris/tree/v12/middleware).
22

33
<!-- [![Build status](https://api.travis-ci.org/iris-contrib/middleware.svg?branch=v12&style=flat-square)](https://travis-ci.org/iris-contrib/middleware) -->
44

55
## Installation
66

7-
Install a middleware, take for example the [cors](cors) one.
7+
Install a middleware, take for example the [jwt](jwt) one.
88

99
```sh
10-
$ go get github.com/iris-contrib/middleware/cors
10+
$ go get github.com/iris-contrib/middleware/jwt
1111
```
1212

1313
**import as**
1414

1515
```go
16-
import "github.com/iris-contrib/middleware/cors"
16+
import "github.com/iris-contrib/middleware/jwt"
1717

1818
// [...]
1919
```
@@ -36,13 +36,23 @@ Middleware is just a chain handlers which can be executed before or after the ma
3636
| [casbin](casbin)| An authorization library that supports access control models like ACL, RBAC, ABAC | [casbin/_examples](casbin/_examples) |
3737
| [raven](raven)| Sentry client in Go | [raven/_example](https://github.com/iris-contrib/middleware/blob/v12/raven/_example/main.go) |
3838
| [csrf](csrf)| Cross-Site Request Forgery Protection | [csrf/_example](https://github.com/iris-contrib/middleware/blob/v12/csrf/_example/main.go) |
39+
| [throttler](throttler)| rate limiting access to HTTP endpoints. | [throttler/_example](https://github.com/iris-contrib/middleware/blob/v12/throttler/_example/main.go) |
40+
3941
### How can I register middleware?
4042

4143
**To a single route**
4244

4345
```go
4446
app := iris.New()
45-
app.Get("/mypath", myMiddleware1, myMiddleware2, func(ctx iris.Context){}, func(ctx iris.Context){}, myMiddleware5,myMainHandlerLast)
47+
app.Get("/mypath",
48+
onBegin,
49+
mySecondMiddleware,
50+
mainHandler,
51+
)
52+
53+
func onBegin(ctx iris.Context) { /* ... */ ctx.Next() }
54+
func mySecondMiddleware(ctx iris.Context) { /* ... */ ctx.Next() }
55+
func mainHandler(ctx iris.Context) { /* ... */ }
4656
```
4757

4858
**To a party of routes or subdomain**
@@ -63,13 +73,13 @@ p.Use(logMiddleware)
6373
**To all routes**
6474

6575
```go
66-
app.Use(func(ctx iris.Context){}, myMiddleware2)
76+
app.Use(func(ctx iris.Context) { }, myMiddleware2)
6777
```
6878

6979
**To global, all routes, parties and subdomains**
7080

7181
```go
72-
app.UseGlobal(func(ctx iris.Context){}, myMiddleware2)
82+
app.UseGlobal(func(ctx iris.Context) { }, myMiddleware2)
7383
```
7484

7585
## Can I use standard net/http handler with iris?
@@ -96,7 +106,7 @@ func main() {
96106
// FromStd can take (http.ResponseWriter, *http.Request, next http.Handler) too!
97107
app.Use(sillyConvertedToIon)
98108

99-
app.Run(iris.Addr(":8080"))
109+
app.Listen(":8080")
100110
}
101111

102112
```

casbin/_examples/middleware/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func newApp() *iris.Application {
3535

3636
func main() {
3737
app := newApp()
38-
app.Run(iris.Addr(":8080"))
38+
app.Listen(":8080")
3939
}
4040

4141
func hi(ctx iris.Context) {

casbin/_examples/wrapper/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func newApp() *iris.Application {
3535

3636
func main() {
3737
app := newApp()
38-
app.Run(iris.Addr(":8080"))
38+
app.Listen(":8080")
3939
}
4040

4141
func hi(ctx iris.Context) {

casbin/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/iris-contrib/middleware/casbin
22

3-
go 1.13
3+
go 1.14
44

55
require (
66
github.com/casbin/casbin/v2 v2.1.0
7-
github.com/kataras/iris/v12 v12.1.2
7+
github.com/kataras/iris/v12 v12.2.0
88
)

cloudwatch/_example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ func main() {
4646
// http://localhost:8080
4747
// should give: NoCredentialProviders
4848
// which is correct, you have to authorize your aws, we asumme that you know how to.
49-
app.Run(iris.Addr(":8080"))
49+
app.Listen(":8080")
5050
}

cloudwatch/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/iris-contrib/middleware/cloudwatch
22

3-
go 1.13
3+
go 1.14
44

5-
require github.com/kataras/iris/v12 v12.1.2
5+
require github.com/kataras/iris/v12 v12.2.0

cors/_example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ func main() {
3333
})
3434
}
3535

36-
app.Run(iris.Addr("localhost:8080"))
36+
app.Listen(":8080")
3737
}

cors/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/iris-contrib/middleware/cors
22

3-
go 1.13
3+
go 1.14
44

5-
require github.com/kataras/iris/v12 v12.1.2
5+
require github.com/kataras/iris/v12 v12.2.0

csrf/_example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func main() {
3333

3434
// GET: http://localhost:8080/user/signup
3535
// POST: http://localhost:8080/user/signup
36-
app.Run(iris.Addr(":8080"))
36+
app.Listen(":8080")
3737
}
3838

3939
func getSignupForm(ctx iris.Context) {

csrf/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/iris-contrib/middleware/csrf
22

3-
go 1.13
3+
go 1.14
44

55
require (
66
github.com/gorilla/securecookie v1.1.1 // indirect
7-
github.com/kataras/iris/v12 v12.1.2
7+
github.com/kataras/iris/v12 v12.2.0
88
)

go-i18n/_example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ func main() {
2828
// http://localhost:8080/?lang=zh-CN
2929
// http://localhost:8080/en
3030
// http://localhost:8080/zh
31-
app.Run(iris.Addr(":8080"))
31+
app.Listen(":8080")
3232
}

go-i18n/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module github.com/iris-contrib/middleware/go-i18n
22

3-
go 1.13
3+
go 1.14
44

55
require (
66
github.com/BurntSushi/toml v0.3.1
7-
github.com/kataras/iris/v12 v12.1.2
7+
github.com/kataras/iris/v12 v12.2.0
88
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
99
github.com/modern-go/reflect2 v1.0.1 // indirect
1010
github.com/nicksnyder/go-i18n/v2 v2.0.3

jwt/_example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ func main() {
6060

6161
// j.CheckJWT(Context) error can be also used inside handlers.
6262

63-
app.Run(iris.Addr(":8080"))
63+
app.Listen(":8080")
6464
}

jwt/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/iris-contrib/middleware/jwt
22

3-
go 1.13
3+
go 1.14
44

55
require (
6-
github.com/kataras/iris/v12 v12.1.2
6+
github.com/kataras/iris/v12 v12.2.0
77
github.com/dgrijalva/jwt-go v3.2.0+incompatible
88
)

newrelic/_example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ func main() {
2020
ctx.Writef("success!\n")
2121
})
2222

23-
app.Run(iris.Addr(":8080"))
23+
app.Listen(":8080")
2424
}

newrelic/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/iris-contrib/middleware/newrelic
22

3-
go 1.13
3+
go 1.14
44

5-
require github.com/kataras/iris/v12 v12.1.2
5+
require github.com/kataras/iris/v12 v12.2.0

permissionbolt/_example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,6 @@ func main() {
9898
})
9999
100100
// Serve
101-
app.Run(iris.Addr(":3000"))
101+
app.Listen(":3000")
102102
}
103103
*/

permissionbolt/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/iris-contrib/middleware/permissionbolt
22

3-
go 1.13
3+
go 1.14
44

5-
require github.com/kataras/iris/v12 v12.1.2
5+
require github.com/kataras/iris/v12 v12.2.0

prometheus/_example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ func main() {
3535
// http://localhost:8080/
3636
// http://localhost:8080/anotfound
3737
// http://localhost:8080/metrics
38-
app.Run(iris.Addr(":8080"))
38+
app.Listen(":8080")
3939
}

prometheus/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/iris-contrib/middleware/prometheus
22

3-
go 1.13
3+
go 1.14
44

55
require (
6-
github.com/kataras/iris/v12 v12.1.2
6+
github.com/kataras/iris/v12 v12.2.0
77
github.com/prometheus/client_golang v1.2.1 // indirect
88
)

raven/_example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ func main() {
2222
ctx.Writef("Hi")
2323
})
2424

25-
app.Run(iris.Addr(":8080"))
25+
app.Listen(":8080")
2626
}

raven/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/iris-contrib/middleware/raven
22

3-
go 1.13
3+
go 1.14
44

5-
require github.com/kataras/iris/v12 v12.1.2
5+
require github.com/kataras/iris/v12 v12.2.0

secure/_example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ func main() {
3434
ctx.Writef("Hello from /home")
3535
})
3636

37-
app.Run(iris.Addr(":8080"))
37+
app.Listen(":8080")
3838
}

secure/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module github.com/iris-contrib/middleware/secure
22

3-
go 1.13
3+
go 1.14
44

55
require (
6-
github.com/kataras/iris/v12 v12.1.2
6+
github.com/kataras/iris/v12 v12.2.0
77
)

throttler/LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright (c) 2018, Martin Angers and Contributors.
2+
Copyright (c) 2020, Gerasimos Maropoulos <[email protected]>.
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8+
9+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10+
11+
* Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12+
13+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module github.com/iris-contrib/middleware/limit-handler/example
22

3-
go 1.13
3+
go 1.14
44

55
require (
66
github.com/didip/tollbooth v4.0.2+incompatible
7-
github.com/kataras/iris/v12 v12.1.2
7+
github.com/kataras/iris/v12 v12.2.0
88
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
99
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
1010
)

tollboothic/_examples/limit-handler/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func main() {
2525
ctx.HTML("<b>Hello, world!</b>")
2626
})
2727

28-
app.Run(iris.Addr(":8080"))
28+
app.Listen(":8080")
2929
}
3030

3131
// Read more at: https://github.com/didip/tollbooth

tollboothic/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module github.com/iris-contrib/middleware/tollboothic
22

3-
go 1.13
3+
go 1.14
44

55
require (
66
github.com/didip/tollbooth v4.0.2+incompatible // indirect
7-
github.com/kataras/iris/v12 v12.1.2
7+
github.com/kataras/iris/v12 v12.2.0
88
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
99
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
1010
)

0 commit comments

Comments
 (0)