From 4e76013334b1b5e835df5671b10c0ccc2ebc60b6 Mon Sep 17 00:00:00 2001 From: Andrey Meshkov Date: Wed, 18 Sep 2019 00:26:58 +0300 Subject: [PATCH] *(home): fix golint issues --- home/auth.go | 3 ++- home/blocked_services.go | 16 +++++++++++++++- home/clients.go | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/home/auth.go b/home/auth.go index b4c39d10..1e9c3b90 100644 --- a/home/auth.go +++ b/home/auth.go @@ -90,7 +90,7 @@ func (a *Auth) loadSessions() { } _ = bkt.ForEach(forEach) if removed != 0 { - tx.Commit() + _ = tx.Commit() } log.Debug("Auth: loaded %d sessions from DB (removed %d expired)", len(a.sessions), removed) } @@ -321,6 +321,7 @@ func optionalAuth(handler func(http.ResponseWriter, *http.Request)) func(http.Re if err == nil { r := config.auth.CheckSession(cookie.Value) if r == 0 { + ok = true } else if r < 0 { log.Debug("Auth: invalid cookie value: %s", cookie) diff --git a/home/blocked_services.go b/home/blocked_services.go index c3a6dc26..f9f20135 100644 --- a/home/blocked_services.go +++ b/home/blocked_services.go @@ -35,7 +35,21 @@ var serviceRulesArray = []svc{ {"vk", []string{"||vk.com^"}}, {"steam", []string{"||steam.com^"}}, {"mail_ru", []string{"||mail.ru^"}}, - {"tiktok", []string{"||tiktok.com^", "||snssdk.com^", "||amemv.com^", "||toutiao.com^", "||ixigua.com^", "||pstatp.com^", "||ixiguavideo.com^", "||toutiaocloud.com^", "||toutiaocloud.net^", "||bdurl.com^", "||bytecdn.cn^", "||byteimg.com^", "||ixigua.com^"}}, + {"tiktok", []string{ + "||tiktok.com^", + "||snssdk.com^", + "||amemv.com^", + "||toutiao.com^", + "||ixigua.com^", + "||pstatp.com^", + "||ixiguavideo.com^", + "||toutiaocloud.com^", + "||toutiaocloud.net^", + "||bdurl.com^", + "||bytecdn.cn^", + "||byteimg.com^", + "||ixigua.com^", + }}, } // convert array to map diff --git a/home/clients.go b/home/clients.go index 2289734c..e80a7a00 100644 --- a/home/clients.go +++ b/home/clients.go @@ -378,7 +378,7 @@ func (clients *clientsContainer) addFromDHCP() { if len(l.Hostname) == 0 { continue } - config.clients.AddHost(l.IP.String(), l.Hostname, ClientSourceDHCP) + _, _ = config.clients.AddHost(l.IP.String(), l.Hostname, ClientSourceDHCP) } }