Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

crazy-max/echo-ipfilter

Repository files navigation

Test workflow Go Report Codecov
Become a sponsor Donate Paypal

About

Middleware that provides ipfilter support for echo framework backed by jpillora/ipfilter.

Installation

go get github.com/crazy-max/echo-ipfilter

Example

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 or by making a Paypal donation to ensure this journey continues indefinitely!

Thanks again for your support, it is much appreciated! πŸ™

License

MIT. See LICENSE for more details.

About

Middleware that provides ipfilter support for echo framework

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Contributors

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /