Remove dead code

This commit is contained in:
Eugene Bujak
2018-10-10 15:47:08 +03:00
parent 945bd24f67
commit 903b20dcab
4 changed files with 31 additions and 351 deletions

30
app.go
View File

@@ -6,10 +6,8 @@ import (
"net"
"net/http"
"os"
"os/signal"
"path/filepath"
"strconv"
"time"
"github.com/gobuffalo/packr"
)
@@ -17,12 +15,7 @@ import (
// VersionString will be set through ldflags, contains current version
var VersionString = "undefined"
func cleanup() {
writeStats()
}
func main() {
c := make(chan os.Signal, 1)
log.Printf("AdGuard DNS web interface backend, version %s\n", VersionString)
box := packr.NewBox("build/static")
{
@@ -121,31 +114,8 @@ func main() {
log.Fatal(err)
}
err = loadStats()
if err != nil {
log.Fatal(err)
}
signal.Notify(c, os.Interrupt)
go func() {
<-c
cleanup()
os.Exit(1)
}()
go func() {
for range time.Tick(time.Hour * 24) {
err := writeStats()
if err != nil {
log.Printf("Couldn't write stats: %s", err)
// try later on next iteration, don't abort
}
}
}()
address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
runStatsCollectors()
runFilterRefreshers()
http.Handle("/", optionalAuthHandler(http.FileServer(box)))