package routes import ( "time" ) func (r *Routes) Timer() { t := time.NewTimer(time.Minute * 1) go func() { for { <-t.C r.Lock() for k, route := range r.Routes { if time.Since(route.TTL) >= time.Minute*2 { delete(r.Routes, k) continue } } r.Unlock() t.Reset(time.Minute * 1) } }() }