Removed unnecessary middleware

This commit is contained in:
Eduard Urbach 2017-06-23 15:57:58 +02:00
parent 0204958e81
commit 5476753520
2 changed files with 0 additions and 11 deletions

View File

@ -78,7 +78,6 @@ func configure(app *aero.Application) *aero.Application {
app.Use(middleware.Log())
app.Use(middleware.Session())
app.Use(middleware.UserInfo())
app.Use(middleware.IPToHost())
// API
api := api.New("/api/", arn.DB)

View File

@ -4,21 +4,11 @@ import (
"net"
"time"
"github.com/aerogo/aero"
cache "github.com/patrickmn/go-cache"
)
var ipToHosts = cache.New(60*time.Minute, 30*time.Minute)
// IPToHost middleware tries to find domain names for the given IP.
func IPToHost() aero.Middleware {
return func(ctx *aero.Context, next func()) {
next()
go findHostsForIP(ctx.RealIP())
}
}
// GetHostsForIP returns all host names for the given IP (if cached).
func GetHostsForIP(ip string) []string {
hosts, found := ipToHosts.Get(ip)