diff --git a/dnscrypt-proxy/main.go b/dnscrypt-proxy/main.go index 054fc7c7..252b7820 100644 --- a/dnscrypt-proxy/main.go +++ b/dnscrypt-proxy/main.go @@ -75,8 +75,8 @@ func main() { } func (app *App) Start(service service.Service) error { - proxy := app.proxy - if err := InitPluginsGlobals(&proxy.pluginsGlobals, &proxy); err != nil { + proxy := &app.proxy + if err := InitPluginsGlobals(&proxy.pluginsGlobals, proxy); err != nil { dlog.Fatal(err) } if proxy.daemonize { @@ -86,10 +86,10 @@ func (app *App) Start(service service.Service) error { app.wg.Add(1) if service != nil { go func() { - app.AppMain(&proxy) + app.AppMain(proxy) }() } else { - app.AppMain(&proxy) + app.AppMain(proxy) } return nil } diff --git a/dnscrypt-proxy/serversInfo.go b/dnscrypt-proxy/serversInfo.go index 55aab9d5..a760345d 100644 --- a/dnscrypt-proxy/serversInfo.go +++ b/dnscrypt-proxy/serversInfo.go @@ -236,7 +236,7 @@ func (serversInfo *ServersInfo) fetchDNSCryptServerInfo(proxy *Proxy, name strin if err != nil { return ServerInfo{}, err } - serverInfo := ServerInfo{ + return ServerInfo{ Proto: StampProtoTypeDNSCrypt, MagicQuery: certInfo.MagicQuery, ServerPk: certInfo.ServerPk, @@ -247,8 +247,7 @@ func (serversInfo *ServersInfo) fetchDNSCryptServerInfo(proxy *Proxy, name strin UDPAddr: remoteUDPAddr, TCPAddr: remoteTCPAddr, initialRtt: rtt, - } - return serverInfo, nil + }, nil } func (serversInfo *ServersInfo) fetchDoHServerInfo(proxy *Proxy, name string, stamp ServerStamp, isNew bool) (ServerInfo, error) { @@ -322,8 +321,7 @@ func (serversInfo *ServersInfo) fetchDoHServerInfo(proxy *Proxy, name string, st } else { dlog.Infof("[%s] OK (DoH) - rtt: %dms", name, rtt.Nanoseconds()/1000000) } - - serverInfo := ServerInfo{ + return ServerInfo{ Proto: StampProtoTypeDoH, Name: name, Timeout: proxy.timeout, @@ -331,8 +329,7 @@ func (serversInfo *ServersInfo) fetchDoHServerInfo(proxy *Proxy, name string, st HostName: stamp.providerName, initialRtt: int(rtt.Nanoseconds() / 1000000), useGet: useGet, - } - return serverInfo, nil + }, nil } func (serverInfo *ServerInfo) noticeFailure(proxy *Proxy) { diff --git a/dnscrypt-proxy/xtransport.go b/dnscrypt-proxy/xtransport.go index 0b8f33e8..ad1af315 100644 --- a/dnscrypt-proxy/xtransport.go +++ b/dnscrypt-proxy/xtransport.go @@ -125,9 +125,8 @@ func (xTransport *XTransport) Fetch(method string, url *url.URL, accept string, err = fmt.Errorf("Webserver returned code %d", resp.StatusCode) } return resp, rtt, err - } else { - (*xTransport.transport).CloseIdleConnections() } + (*xTransport.transport).CloseIdleConnections() dlog.Debugf("[%s]: [%s]", req.URL, err) } else { dlog.Debug("Ignoring system DNS")