"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "internal/home/control.go" between
AdGuardHome-0.104.1.tar.gz and AdGuardHome-0.104.3.tar.gz

About: AdGuard Home is a network-wide ads & trackers blocking DNS server. It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers.

control.go  (AdGuardHome-0.104.1):control.go  (AdGuardHome-0.104.3)
package home package home
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"net" "net"
"net/http" "net/http"
"net/url" "net/url"
"runtime"
"strconv" "strconv"
"strings" "strings"
"github.com/AdguardTeam/AdGuardHome/internal/dnsforward" "github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
"github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/log"
"github.com/NYTimes/gziphandler" "github.com/NYTimes/gziphandler"
) )
// ---------------- // ----------------
// helper functions // helper functions
skipping to change at line 49 skipping to change at line 50
addr = fmt.Sprintf("%s:%d", addr, config.DNS.Port) addr = fmt.Sprintf("%s:%d", addr, config.DNS.Port)
} }
*dnsAddresses = append(*dnsAddresses, addr) *dnsAddresses = append(*dnsAddresses, addr)
} }
func handleStatus(w http.ResponseWriter, r *http.Request) { func handleStatus(w http.ResponseWriter, r *http.Request) {
c := dnsforward.FilteringConfig{} c := dnsforward.FilteringConfig{}
if Context.dnsServer != nil { if Context.dnsServer != nil {
Context.dnsServer.WriteDiskConfig(&c) Context.dnsServer.WriteDiskConfig(&c)
} }
data := map[string]interface{}{ data := map[string]interface{}{
"dns_addresses": getDNSAddresses(), "dns_addresses": getDNSAddresses(),
"http_port": config.BindPort, "http_port": config.BindPort,
"dns_port": config.DNS.Port, "dns_port": config.DNS.Port,
"running": isRunning(), "running": isRunning(),
"version": versionString, "version": versionString,
"language": config.Language, "language": config.Language,
"protection_enabled": c.ProtectionEnabled, "protection_enabled": c.ProtectionEnabled,
} }
data["dhcp_available"] = (Context.dhcpServer != nil)
if runtime.GOOS == "windows" {
// Set the DHCP to false explicitly, because Context.dhcpServer
// is probably not nil, despite the fact that there is no
// support for DHCP on Windows in AdGuardHome.
//
// See also the TODO in dhcpd.Create.
data["dhcp_available"] = false
} else {
data["dhcp_available"] = (Context.dhcpServer != nil)
}
jsonVal, err := json.Marshal(data) jsonVal, err := json.Marshal(data)
if err != nil { if err != nil {
httpError(w, http.StatusInternalServerError, "Unable to marshal s tatus json: %s", err) httpError(w, http.StatusInternalServerError, "Unable to marshal s tatus json: %s", err)
return return
} }
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
_, err = w.Write(jsonVal) _, err = w.Write(jsonVal)
if err != nil { if err != nil {
httpError(w, http.StatusInternalServerError, "Unable to write res ponse json: %s", err) httpError(w, http.StatusInternalServerError, "Unable to write res ponse json: %s", err)
 End of changes. 3 change blocks. 
1 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)