https://github.com/crazy-max/echo-ipfilter
Middleware that provides ipfilter support for echo framework
https://github.com/crazy-max/echo-ipfilter
echo echo-framework golang ipfilter middleware
Last synced: 5 months ago
JSON representation
Middleware that provides ipfilter support for echo framework
- Host: GitHub
- URL: https://github.com/crazy-max/echo-ipfilter
- Owner: crazy-max
- License: mit
- Created: 2019-09-15T00:32:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-02T07:27:16.000Z (over 1 year ago)
- Last Synced: 2024-10-18T07:32:17.037Z (over 1 year ago)
- Topics: echo, echo-framework, golang, ipfilter, middleware
- Language: Go
- Homepage:
- Size: 173 KB
- Stars: 12
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Support: .github/SUPPORT.md
Awesome Lists containing this project
README

## About
Middleware that provides ipfilter support for [echo](https://echo.labstack.com) framework backed by [jpillora/ipfilter](https://github.com/jpillora/ipfilter).
## Installation
```
go get github.com/crazy-max/echo-ipfilter
```
## Example
```go
package main
import (
"net/http"
ipfilter "github.com/crazy-max/echo-ipfilter"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
e := echo.New()
e.Use(ipfilter.MiddlewareWithConfig(ipfilter.Config{
Skipper: middleware.DefaultSkipper,
WhiteList: []string{
"10.1.1.0/24",
"10.1.2.0/24",
},
BlockByDefault: true,
}))
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!\n")
})
e.Logger.Fatal(e.Start(":1323"))
}
```
## Contributing
Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. You
can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max) or by making
a [Paypal donation](https://www.paypal.me/crazyws) to ensure this journey continues indefinitely!
Thanks again for your support, it is much appreciated! :pray:
## License
MIT. See `LICENSE` for more details.