From 5476753520d02cc878f7aa85500bbb8141f2a4d8 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 23 Jun 2017 15:57:58 +0200 Subject: [PATCH] Removed unnecessary middleware --- main.go | 1 - middleware/IPToHost.go | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/main.go b/main.go index 2df2a9e9..4dfe6162 100644 --- a/main.go +++ b/main.go @@ -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) diff --git a/middleware/IPToHost.go b/middleware/IPToHost.go index 09eab148..e4273465 100644 --- a/middleware/IPToHost.go +++ b/middleware/IPToHost.go @@ -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)