docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
listlengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
macFound := clients.dhcpServer.FindMACbyIP(ip)
<mask> <mask> if clients.dhcpServer == nil { <mask> return Client{}, false <mask> } <mask> macFound := clients.dhcpServer.FindMACbyIP(ipAddr) <mask> if macFound == nil { <mask> return Client{}, false <mask> } <mask> for _, c = range clients.list { <mask> for _, id := range c.IDs { </s> Pull requ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients.go
func (clients *clientsContainer) FindAutoClient(ip net.IP) (ClientHost, bool) { if ip == nil {
<mask> return Client{}, false <mask> } <mask> <mask> // FindAutoClient - search for an auto-client by IP <mask> func (clients *clientsContainer) FindAutoClient(ip string) (ClientHost, bool) { <mask> ipAddr := net.ParseIP(ip) <mask> if ipAddr == nil { <mask> return ClientHost{}, false <mask> } <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients.go
ch, ok := clients.ipHost[ip.String()]
<mask> <mask> clients.lock.Lock() <mask> defer clients.lock.Unlock() <mask> <mask> ch, ok := clients.ipHost[ip] <mask> if ok { <mask> return *ch, true <mask> } <mask> return ClientHost{}, false <mask> } </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-conversion-v...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients.go
func (clients *clientsContainer) SetWhoisInfo(ip net.IP, info [][]string) {
<mask> return nil <mask> } <mask> <mask> // SetWhoisInfo - associate WHOIS information with a client <mask> func (clients *clientsContainer) SetWhoisInfo(ip string, info [][]string) { <mask> clients.lock.Lock() <mask> defer clients.lock.Unlock() <mask> <mask> _, ok := clients.findByIP(ip) <mask> if ok ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients.go
ipStr := ip.String() ch, ok := clients.ipHost[ipStr]
<mask> log.Debug("Clients: client for %s is already created, ignore WHOIS info", ip) <mask> return <mask> } <mask> <mask> ch, ok := clients.ipHost[ip] <mask> if ok { <mask> ch.WhoisInfo = info <mask> log.Debug("Clients: set WHOIS info for auto-client %s: %v", ch.Host, ch.WhoisInfo) <mask> return ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients.go
clients.ipHost[ipStr] = ch
<mask> ch = &ClientHost{ <mask> Source: ClientSourceWHOIS, <mask> } <mask> ch.WhoisInfo = info <mask> clients.ipHost[ip] = ch <mask> log.Debug("Clients: set WHOIS info for auto-client with IP %s: %v", ip, ch.WhoisInfo) <mask> } <mask> <mask> // AddHost adds new IP -> Host pair <mask> // Use priority o...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients.go
c, b = clients.Find(net.IPv4(1, 1, 1, 1))
<mask> b, err = clients.Add(c) <mask> assert.True(t, b) <mask> assert.Nil(t, err) <mask> <mask> c, b = clients.Find("1.1.1.1") <mask> assert.True(t, b) <mask> assert.Equal(t, c.Name, "client1") <mask> <mask> c, b = clients.Find("1:2:3::4") <mask> assert.True(t, b) </s> Pull request: 2508 ip...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients_test.go
c, b = clients.Find(net.ParseIP("1:2:3::4"))
<mask> c, b = clients.Find("1.1.1.1") <mask> assert.True(t, b) <mask> assert.Equal(t, c.Name, "client1") <mask> <mask> c, b = clients.Find("1:2:3::4") <mask> assert.True(t, b) <mask> assert.Equal(t, c.Name, "client1") <mask> <mask> c, b = clients.Find("2.2.2.2") <mask> assert.True(t, b) </s...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients_test.go
c, b = clients.Find(net.IPv4(2, 2, 2, 2))
<mask> c, b = clients.Find("1:2:3::4") <mask> assert.True(t, b) <mask> assert.Equal(t, c.Name, "client1") <mask> <mask> c, b = clients.Find("2.2.2.2") <mask> assert.True(t, b) <mask> assert.Equal(t, c.Name, "client2") <mask> <mask> assert.False(t, clients.Exists("1.2.3.4", ClientSourceHostsFile...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients_test.go
assert.False(t, clients.Exists(net.IPv4(1, 2, 3, 4), ClientSourceHostsFile)) assert.True(t, clients.Exists(net.IPv4(1, 1, 1, 1), ClientSourceHostsFile)) assert.True(t, clients.Exists(net.IPv4(2, 2, 2, 2), ClientSourceHostsFile))
<mask> c, b = clients.Find("2.2.2.2") <mask> assert.True(t, b) <mask> assert.Equal(t, c.Name, "client2") <mask> <mask> assert.False(t, clients.Exists("1.2.3.4", ClientSourceHostsFile)) <mask> assert.True(t, clients.Exists("1.1.1.1", ClientSourceHostsFile)) <mask> assert.True(t, clients.Exists("2.2.2...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients_test.go
assert.False(t, clients.Exists(net.IPv4(1, 1, 1, 1), ClientSourceHostsFile)) assert.True(t, clients.Exists(net.IPv4(1, 1, 1, 2), ClientSourceHostsFile))
<mask> <mask> err := clients.Update("client1", c) <mask> assert.Nil(t, err) <mask> <mask> assert.False(t, clients.Exists("1.1.1.1", ClientSourceHostsFile)) <mask> assert.True(t, clients.Exists("1.1.1.2", ClientSourceHostsFile)) <mask> <mask> c = Client{ <mask> IDs: []string{"1.1.1.2"...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients_test.go
c, b := clients.Find(net.IPv4(1, 1, 1, 2))
<mask> <mask> err = clients.Update("client1", c) <mask> assert.Nil(t, err) <mask> <mask> c, b := clients.Find("1.1.1.2") <mask> assert.True(t, b) <mask> assert.Equal(t, "client1-renamed", c.Name) <mask> assert.Equal(t, "1.1.1.2", c.IDs[0]) <mask> assert.True(t, c.UseOwnSettings) <mask> asser...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients_test.go
assert.False(t, clients.Exists(net.IPv4(1, 1, 1, 2), ClientSourceHostsFile))
<mask> <mask> t.Run("del_success", func(t *testing.T) { <mask> b := clients.Del("client1-renamed") <mask> assert.True(t, b) <mask> assert.False(t, clients.Exists("1.1.1.2", ClientSourceHostsFile)) <mask> }) <mask> <mask> t.Run("del_fail", func(t *testing.T) { <mask> b := clients.Del("client3") <m...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients_test.go
assert.True(t, clients.Exists(net.IPv4(1, 1, 1, 1), ClientSourceHostsFile))
<mask> b, err = clients.AddHost("1.1.1.1", "host3", ClientSourceHostsFile) <mask> assert.True(t, b) <mask> assert.Nil(t, err) <mask> <mask> assert.True(t, clients.Exists("1.1.1.1", ClientSourceHostsFile)) <mask> }) <mask> <mask> t.Run("addhost_fail", func(t *testing.T) { <mask> b, err := clients....
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients_test.go
clients.SetWhoisInfo(net.IPv4(1, 1, 1, 255), whois)
<mask> clients.Init(nil, nil, nil) <mask> <mask> whois := [][]string{{"orgname", "orgname-val"}, {"country", "country-val"}} <mask> // set whois info on new client <mask> clients.SetWhoisInfo("1.1.1.255", whois) <mask> assert.Equal(t, "orgname-val", clients.ipHost["1.1.1.255"].WhoisInfo[0][1]) <mask> <ma...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients_test.go
clients.SetWhoisInfo(net.IPv4(1, 1, 1, 1), whois)
<mask> assert.Equal(t, "orgname-val", clients.ipHost["1.1.1.255"].WhoisInfo[0][1]) <mask> <mask> // set whois info on existing auto-client <mask> _, _ = clients.AddHost("1.1.1.1", "host", ClientSourceRDNS) <mask> clients.SetWhoisInfo("1.1.1.1", whois) <mask> assert.Equal(t, "orgname-val", clients.ipHost["1....
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients_test.go
clients.SetWhoisInfo(net.IPv4(1, 1, 1, 2), whois)
<mask> IDs: []string{"1.1.1.2"}, <mask> Name: "client1", <mask> } <mask> _, _ = clients.Add(c) <mask> clients.SetWhoisInfo("1.1.1.2", whois) <mask> assert.Nil(t, clients.ipHost["1.1.1.2"]) <mask> _ = clients.Del("client1") <mask> } <mask> <mask> func TestClientsAddExisting(t *testing.T) { </s> Pul...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clients_test.go
"net"
<mask> <mask> import ( <mask> "encoding/json" <mask> "fmt" <mask> "net/http" <mask> ) <mask> <mask> type clientJSON struct { </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-conversion-vol2 to master Closes #2508. Squashed commit of the following: commit 5b9d33f9cd352...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clientshttp.go
ipStr := q.Get(fmt.Sprintf("ip%d", i)) ip := net.ParseIP(ipStr) if ip == nil {
<mask> func (clients *clientsContainer) handleFindClient(w http.ResponseWriter, r *http.Request) { <mask> q := r.URL.Query() <mask> data := []map[string]interface{}{} <mask> for i := 0; ; i++ { <mask> ip := q.Get(fmt.Sprintf("ip%d", i)) <mask> if len(ip) == 0 { <mask> break <mask> } <mask> <mask>...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clientshttp.go
el[ipStr] = cj
<mask> cj = clientToJSON(&c) <mask> cj.Disallowed, cj.DisallowedRule = clients.dnsServer.IsBlockedIP(ip) <mask> } <mask> <mask> el[ip] = cj <mask> data = append(data, el) <mask> } <mask> <mask> js, err := json.Marshal(data) <mask> if err != nil { </s> Pull request: 2508 ip conversion vol.2 ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clientshttp.go
func (clients *clientsContainer) findTemporary(ip net.IP) (cj clientJSON, found bool) { ipStr := ip.String()
<mask> } <mask> <mask> // findTemporary looks up the IP in temporary storages, like autohosts or <mask> // blocklists. <mask> func (clients *clientsContainer) findTemporary(ip string) (cj clientJSON, found bool) { <mask> ch, ok := clients.FindAutoClient(ip) <mask> if !ok { <mask> // It is still possible th...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clientshttp.go
IDs: []string{ipStr},
<mask> return clientJSON{}, false <mask> } <mask> <mask> cj = clientJSON{ <mask> IDs: []string{ip}, <mask> Disallowed: disallowed, <mask> DisallowedRule: rule, <mask> } <mask> <mask> return cj, true </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home fr...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clientshttp.go
cj = clientHostToJSON(ipStr, ch)
<mask> <mask> return cj, true <mask> } <mask> <mask> cj = clientHostToJSON(ip, ch) <mask> cj.Disallowed, cj.DisallowedRule = clients.dnsServer.IsBlockedIP(ip) <mask> <mask> return cj, true <mask> } <mask> </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-conversion...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/clientshttp.go
"net"
<mask> import ( <mask> "io/ioutil" <mask> "os" <mask> "path/filepath" <mask> "sync" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd" </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-conversion-vol2 to master Closes #2508. Squashed commit of the followi...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/config.go
BindHost net.IP `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to
<mask> // Raw file data to avoid re-reading of configuration file <mask> // It's reset after config is parsed <mask> fileData []byte <mask> <mask> BindHost string `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to <mask> BindPort int `yaml:"bind_port"` // Bin...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/config.go
BindHost net.IP `yaml:"bind_host"`
<mask> } <mask> <mask> // field ordering is important -- yaml fields will mirror ordering from here <mask> type dnsConfig struct { <mask> BindHost string `yaml:"bind_host"` <mask> Port int `yaml:"port"` <mask> <mask> // time interval for statistics (in days) <mask> StatsInterval uint32 `yaml:"stat...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/config.go
BindHost: net.IP{0, 0, 0, 0},
<mask> // initialize to default values, will be changed later when reading config or parsing command line <mask> var config = configuration{ <mask> BindPort: 3000, <mask> BetaBindPort: 0, <mask> BindHost: "0.0.0.0", <mask> DNS: dnsConfig{ <mask> BindHost: "0.0.0.0", <mask> Port: 53...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/config.go
BindHost: net.IP{0, 0, 0, 0},
<mask> BindPort: 3000, <mask> BetaBindPort: 0, <mask> BindHost: "0.0.0.0", <mask> DNS: dnsConfig{ <mask> BindHost: "0.0.0.0", <mask> Port: 53, <mask> StatsInterval: 1, <mask> FilteringConfig: dnsforward.FilteringConfig{ <mask> ProtectionEnabled: true, // whether or no...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/config.go
func addDNSAddress(dnsAddresses *[]string, addr net.IP) { hostport := addr.String()
<mask> <mask> // --------------- <mask> // dns run control <mask> // --------------- <mask> func addDNSAddress(dnsAddresses *[]string, addr string) { <mask> if config.DNS.Port != 53 { <mask> addr = fmt.Sprintf("%s:%d", addr, config.DNS.Port) <mask> } <mask> *dnsAddresses = append(*dnsAddresses, addr) <m...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/control.go
hostport = net.JoinHostPort(hostport, strconv.Itoa(config.DNS.Port))
<mask> // dns run control <mask> // --------------- <mask> func addDNSAddress(dnsAddresses *[]string, addr string) { <mask> if config.DNS.Port != 53 { <mask> addr = fmt.Sprintf("%s:%d", addr, config.DNS.Port) <mask> } <mask> *dnsAddresses = append(*dnsAddresses, addr) <mask> } <mask> <mask> func handleS...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/control.go
*dnsAddresses = append(*dnsAddresses, hostport)
<mask> func addDNSAddress(dnsAddresses *[]string, addr string) { <mask> if config.DNS.Port != 53 { <mask> addr = fmt.Sprintf("%s:%d", addr, config.DNS.Port) <mask> } <mask> *dnsAddresses = append(*dnsAddresses, addr) <mask> } <mask> <mask> func handleStatus(w http.ResponseWriter, _ *http.Request) { <mask...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/control.go
Addresses []net.IP `json:"ip_addresses"`
<mask> type netInterfaceJSON struct { <mask> Name string `json:"name"` <mask> MTU int `json:"mtu"` <mask> HardwareAddr string `json:"hardware_address"` <mask> Addresses []string `json:"ip_addresses"` <mask> Flags string `json:"flags"` <mask> } <mask> <mask> // Get in...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
IP net.IP `json:"ip"`
<mask> } <mask> <mask> type checkConfigReqEnt struct { <mask> Port int `json:"port"` <mask> IP string `json:"ip"` <mask> Autofix bool `json:"autofix"` <mask> } <mask> <mask> type checkConfigReq struct { <mask> Web checkConfigReqEnt `json:"web"` </s> Pull request: 2508 ip conversion...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
} else if !reqData.DNS.IP.IsUnspecified() {
<mask> } <mask> <mask> if err != nil { <mask> respData.DNS.Status = err.Error() <mask> } else if reqData.DNS.IP != "0.0.0.0" { <mask> respData.StaticIP = handleStaticIP(reqData.DNS.IP, reqData.SetStaticIP) <mask> } <mask> } <mask> <mask> w.Header().Set("Content-Type", "application/json") </...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
func handleStaticIP(ip net.IP, set bool) staticIPJSON {
<mask> <mask> // handleStaticIP - handles static IP request <mask> // It either checks if we have a static IP <mask> // Or if set=true, it tries to set it <mask> func handleStaticIP(ip string, set bool) staticIPJSON { <mask> resp := staticIPJSON{} <mask> <mask> interfaceName := util.GetInterfaceByIP(ip) <m...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
resp.IP = util.GetSubnet(interfaceName).String()
<mask> } else { <mask> if isStaticIP { <mask> resp.Static = "yes" <mask> } <mask> resp.IP = util.GetSubnet(interfaceName) <mask> } <mask> return resp <mask> } <mask> <mask> // Check if DNSStubListener is active </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-c...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
IP net.IP `json:"ip"`
<mask> return nil <mask> } <mask> <mask> type applyConfigReqEnt struct { <mask> IP string `json:"ip"` <mask> Port int `json:"port"` <mask> } <mask> <mask> type applyConfigReq struct { <mask> Web applyConfigReqEnt `json:"web"` </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-h...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
if config.BindHost.Equal(newSettings.Web.IP) && config.BindPort == newSettings.Web.Port {
<mask> return <mask> } <mask> <mask> restartHTTP := true <mask> if config.BindHost == newSettings.Web.IP && config.BindPort == newSettings.Web.Port { <mask> // no need to rebind <mask> restartHTTP = false <mask> } <mask> <mask> // validate that hosts and ports are bindable </s> Pull request: 250...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
net.JoinHostPort(newSettings.Web.IP.String(), strconv.Itoa(newSettings.Web.Port)), err)
<mask> if restartHTTP { <mask> err = util.CheckPortAvailable(newSettings.Web.IP, newSettings.Web.Port) <mask> if err != nil { <mask> httpError(w, http.StatusBadRequest, "Impossible to listen on IP:port %s due to %s", <mask> net.JoinHostPort(newSettings.Web.IP, strconv.Itoa(newSettings.Web.Port)), err) ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
// TODO(e.burkov): This should removed with the API v1 when the appropriate
<mask> <mask> // checkConfigReqEntBeta is a struct representing new client's config check <mask> // request entry. It supports multiple IP values unlike the checkConfigReqEnt. <mask> // <mask> // TODO(e.burkov): this should removed with the API v1 when the appropriate <mask> // functionality will appear in defa...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
IP []net.IP `json:"ip"`
<mask> // TODO(e.burkov): this should removed with the API v1 when the appropriate <mask> // functionality will appear in default checkConfigReqEnt. <mask> type checkConfigReqEntBeta struct { <mask> Port int `json:"port"` <mask> IP []string `json:"ip"` <mask> Autofix bool `json:"autofix"` <ma...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
// TODO(e.burkov): This should removed with the API v1 when the appropriate
<mask> <mask> // checkConfigReqBeta is a struct representing new client's config check request <mask> // body. It uses checkConfigReqEntBeta instead of checkConfigReqEnt. <mask> // <mask> // TODO(e.burkov): this should removed with the API v1 when the appropriate <mask> // functionality will appear in default c...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
// TODO(e.burkov): This should removed with the API v1 when the appropriate
<mask> <mask> // handleInstallCheckConfigBeta is a substitution of /install/check_config <mask> // handler for new client. <mask> // <mask> // TODO(e.burkov): this should removed with the API v1 when the appropriate <mask> // functionality will appear in default handleInstallCheckConfig. <mask> func (web *Web) ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
// TODO(e.burkov): This should removed with the API v1 when the appropriate
<mask> <mask> // applyConfigReqEntBeta is a struct representing new client's config setting <mask> // request entry. It supports multiple IP values unlike the applyConfigReqEnt. <mask> // <mask> // TODO(e.burkov): this should removed with the API v1 when the appropriate <mask> // functionality will appear in de...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
IP []net.IP `json:"ip"`
<mask> // <mask> // TODO(e.burkov): this should removed with the API v1 when the appropriate <mask> // functionality will appear in default applyConfigReqEnt. <mask> type applyConfigReqEntBeta struct { <mask> IP []string `json:"ip"` <mask> Port int `json:"port"` <mask> } <mask> <mask> // applyConfigR...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
// TODO(e.burkov): This should removed with the API v1 when the appropriate
<mask> <mask> // applyConfigReqBeta is a struct representing new client's config setting <mask> // request body. It uses applyConfigReqEntBeta instead of applyConfigReqEnt. <mask> // <mask> // TODO(e.burkov): this should removed with the API v1 when the appropriate <mask> // functionality will appear in default...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
// TODO(e.burkov): This should removed with the API v1 when the appropriate
<mask> <mask> // handleInstallConfigureBeta is a substitution of /install/configure handler <mask> // for new client. <mask> // <mask> // TODO(e.burkov): this should removed with the API v1 when the appropriate <mask> // functionality will appear in default handleInstallConfigure. <mask> func (web *Web) handleI...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
// TODO(e.burkov): This should removed with the API v1 when the appropriate
<mask> <mask> // firstRunDataBeta is a struct representing new client's getting addresses <mask> // request body. It uses array of structs instead of map. <mask> // <mask> // TODO(e.burkov): this should removed with the API v1 when the appropriate <mask> // functionality will appear in default firstRunData. <m...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
// TODO(e.burkov): This should removed with the API v1 when the appropriate
<mask> <mask> // handleInstallConfigureBeta is a substitution of /install/get_addresses <mask> // handler for new client. <mask> // <mask> // TODO(e.burkov): this should removed with the API v1 when the appropriate <mask> // functionality will appear in default handleInstallGetAddresses. <mask> func (web *Web) ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
// TODO(e.burkov): This should removed with the API v1 when the appropriate
<mask> <mask> // registerBetaInstallHandlers registers the install handlers for new client <mask> // with the structures it supports. <mask> // <mask> // TODO(e.burkov): this should removed with the API v1 when the appropriate <mask> // functionality will appear in default handlers. <mask> func (web *Web) regis...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/controlinstall.go
if config.DNS.BindHost.IsUnspecified() { bindhost = net.IPv4(127, 0, 0, 1)
<mask> Context.queryLog = querylog.New(conf) <mask> <mask> filterConf := config.DNS.DnsfilterConf <mask> bindhost := config.DNS.BindHost <mask> if config.DNS.BindHost == "0.0.0.0" { <mask> bindhost = "127.0.0.1" <mask> } <mask> filterConf.ResolverAddress = fmt.Sprintf("%s:%d", bindhost, config.DNS.Port...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
ip := dnsforward.IPFromAddr(d.Addr) if ip == nil {
<mask> return Context.dnsServer != nil && Context.dnsServer.IsRunning() <mask> } <mask> <mask> func onDNSRequest(d *proxy.DNSContext) { <mask> ip := dnsforward.IPStringFromAddr(d.Addr) <mask> if ip == "" { <mask> // This would be quite weird if we get here <mask> return <mask> } <mask> <mask> ipAd...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
if !ip.IsLoopback() {
<mask> // This would be quite weird if we get here <mask> return <mask> } <mask> <mask> ipAddr := net.ParseIP(ip) <mask> if !ipAddr.IsLoopback() { <mask> Context.rdns.Begin(ip) <mask> } <mask> if !Context.ipDetector.detectSpecialNetwork(ipAddr) { <mask> Context.whois.Begin(ip) <mask> } </s> P...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
if !Context.ipDetector.detectSpecialNetwork(ip) {
<mask> ipAddr := net.ParseIP(ip) <mask> if !ipAddr.IsLoopback() { <mask> Context.rdns.Begin(ip) <mask> } <mask> if !Context.ipDetector.detectSpecialNetwork(ipAddr) { <mask> Context.whois.Begin(ip) <mask> } <mask> } <mask> <mask> func generateServerConfig() (newconfig dnsforward.ServerConfig, err err...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
<mask> } <mask> } <mask> <mask> func generateServerConfig() (newconfig dnsforward.ServerConfig, err error) { <mask> bindHost := net.ParseIP(config.DNS.BindHost) <mask> newconfig = dnsforward.ServerConfig{ <mask> UDPListenAddr: &net.UDPAddr{IP: bindHost, Port: config.DNS.Port}, <mask> TCPListenAddr: ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
UDPListenAddr: &net.UDPAddr{IP: config.DNS.BindHost, Port: config.DNS.Port}, TCPListenAddr: &net.TCPAddr{IP: config.DNS.BindHost, Port: config.DNS.Port},
<mask> <mask> func generateServerConfig() (newconfig dnsforward.ServerConfig, err error) { <mask> bindHost := net.ParseIP(config.DNS.BindHost) <mask> newconfig = dnsforward.ServerConfig{ <mask> UDPListenAddr: &net.UDPAddr{IP: bindHost, Port: config.DNS.Port}, <mask> TCPListenAddr: &net.TCPAddr{IP: bind...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
IP: config.DNS.BindHost,
<mask> newconfig.TLSConfig = tlsConf.TLSConfig <mask> <mask> if tlsConf.PortDNSOverTLS != 0 { <mask> newconfig.TLSListenAddr = &net.TCPAddr{ <mask> IP: bindHost, <mask> Port: tlsConf.PortDNSOverTLS, <mask> } <mask> } <mask> <mask> if tlsConf.PortDNSOverQUIC != 0 { </s> Pull request:...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
IP: config.DNS.BindHost,
<mask> } <mask> <mask> if tlsConf.PortDNSOverQUIC != 0 { <mask> newconfig.QUICListenAddr = &net.UDPAddr{ <mask> IP: bindHost, <mask> Port: int(tlsConf.PortDNSOverQUIC), <mask> } <mask> } <mask> <mask> if tlsConf.PortDNSCrypt != 0 { </s> Pull request: 2508 ip conversion vol.2 Merge ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
newconfig.DNSCryptConfig, err = newDNSCrypt(config.DNS.BindHost, tlsConf)
<mask> } <mask> } <mask> <mask> if tlsConf.PortDNSCrypt != 0 { <mask> newconfig.DNSCryptConfig, err = newDNSCrypt(bindHost, tlsConf) <mask> if err != nil { <mask> // Don't wrap the error, because it's already <mask> // wrapped by newDNSCrypt. <mask> return dnsforward.ServerConfig{}, e...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
if config.DNS.BindHost.IsUnspecified() {
<mask> // Get the list of DNS addresses the server is listening on <mask> func getDNSAddresses() []string { <mask> dnsAddresses := []string{} <mask> <mask> if config.DNS.BindHost == "0.0.0.0" { <mask> ifaces, e := util.GetValidNetInterfacesForWeb() <mask> if e != nil { <mask> log.Error("Couldn't get n...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
func applyAdditionalFiltering(clientAddr net.IP, setts *dnsfilter.RequestFilteringSettings) {
<mask> return dnsAddresses <mask> } <mask> <mask> // If a client has his own settings, apply them <mask> func applyAdditionalFiltering(clientAddr string, setts *dnsfilter.RequestFilteringSettings) { <mask> Context.dnsFilter.ApplyBlockedServices(setts, nil, true) <mask> <mask> if len(clientAddr) == 0 { <ma...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
if clientAddr == nil {
<mask> // If a client has his own settings, apply them <mask> func applyAdditionalFiltering(clientAddr string, setts *dnsfilter.RequestFilteringSettings) { <mask> Context.dnsFilter.ApplyBlockedServices(setts, nil, true) <mask> <mask> if len(clientAddr) == 0 { <mask> return <mask> } <mask> setts.ClientIP ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
for _, ip := range Context.stats.GetTopClientsIP(topClientsNumber) { if !ip.IsLoopback() {
<mask> Context.stats.Start() <mask> Context.queryLog.Start() <mask> <mask> const topClientsNumber = 100 // the number of clients to get <mask> topClients := Context.stats.GetTopClientsIP(topClientsNumber) <mask> for _, ip := range topClients { <mask> ipAddr := net.ParseIP(ip) <mask> if !ipAddr.IsLoopb...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
if !Context.ipDetector.detectSpecialNetwork(ip) {
<mask> ipAddr := net.ParseIP(ip) <mask> if !ipAddr.IsLoopback() { <mask> Context.rdns.Begin(ip) <mask> } <mask> if !Context.ipDetector.detectSpecialNetwork(ipAddr) { <mask> Context.whois.Begin(ip) <mask> } <mask> } <mask> <mask> return nil </s> Pull request: 2508 ip conversion vol.2 Merge...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/dns.go
if args.bindHost != nil {
<mask> sysutil.SetRlimit(config.RlimitNoFile) <mask> } <mask> <mask> // override bind host/port from the console <mask> if args.bindHost != "" { <mask> config.BindHost = args.bindHost <mask> } <mask> if args.bindPort != 0 { <mask> config.BindPort = args.bindPort <mask> } </s> Pull request: 2508 ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/home.go
var hostStr string
<mask> } <mask> <mask> if proto == "https" && tlsConf.ServerName != "" { <mask> if tlsConf.PortHTTPS == 443 { <mask> log.Printf("Go to https://%s", tlsConf.ServerName) <mask> } else { <mask> log.Printf("Go to https://%s:%s", tlsConf.ServerName, port) </s> Pull request: 2508 ip conversion vol.2 Mer...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/home.go
} else if config.BindHost.IsUnspecified() {
<mask> log.Printf("Go to https://%s", tlsConf.ServerName) <mask> } else { <mask> log.Printf("Go to https://%s:%s", tlsConf.ServerName, port) <mask> } <mask> } else if config.BindHost == "0.0.0.0" { <mask> log.Println("AdGuard Home is available on the following addresses:") <mask> ifaces, err := ut...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/home.go
hostStr = config.BindHost.String() log.Printf("Go to %s://%s", proto, net.JoinHostPort(hostStr, port))
<mask> log.Println("AdGuard Home is available on the following addresses:") <mask> ifaces, err := util.GetValidNetInterfacesForWeb() <mask> if err != nil { <mask> // That's weird, but we'll ignore it <mask> log.Printf("Go to %s://%s", proto, net.JoinHostPort(config.BindHost, port)) <mask> if config...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/home.go
log.Printf("Go to %s://%s (BETA)", proto, net.JoinHostPort(hostStr, strconv.Itoa(config.BetaBindPort)))
<mask> if err != nil { <mask> // That's weird, but we'll ignore it <mask> log.Printf("Go to %s://%s", proto, net.JoinHostPort(config.BindHost, port)) <mask> if config.BetaBindPort != 0 { <mask> log.Printf("Go to %s://%s (BETA)", proto, net.JoinHostPort(config.BindHost, strconv.Itoa(config.BetaBindPo...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/home.go
hostStr = addr.String() log.Printf("Go to %s://%s", proto, net.JoinHostPort(hostStr, strconv.Itoa(config.BindPort)))
<mask> } <mask> <mask> for _, iface := range ifaces { <mask> for _, addr := range iface.Addresses { <mask> log.Printf("Go to %s://%s", proto, net.JoinHostPort(addr, strconv.Itoa(config.BindPort))) <mask> if config.BetaBindPort != 0 { <mask> log.Printf("Go to %s://%s (BETA)", proto, net.JoinH...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/home.go
log.Printf("Go to %s://%s (BETA)", proto, net.JoinHostPort(hostStr, strconv.Itoa(config.BetaBindPort)))
<mask> for _, iface := range ifaces { <mask> for _, addr := range iface.Addresses { <mask> log.Printf("Go to %s://%s", proto, net.JoinHostPort(addr, strconv.Itoa(config.BindPort))) <mask> if config.BetaBindPort != 0 { <mask> log.Printf("Go to %s://%s (BETA)", proto, net.JoinHostPort(addr, strconv...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/home.go
hostStr = config.BindHost.String() log.Printf("Go to %s://%s", proto, net.JoinHostPort(hostStr, port))
<mask> } <mask> } <mask> } <mask> } else { <mask> log.Printf("Go to %s://%s", proto, net.JoinHostPort(config.BindHost, port)) <mask> if config.BetaBindPort != 0 { <mask> log.Printf("Go to %s://%s (BETA)", proto, net.JoinHostPort(config.BindHost, strconv.Itoa(config.BetaBindPort))) <mask> } <...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/home.go
log.Printf("Go to %s://%s (BETA)", proto, net.JoinHostPort(hostStr, strconv.Itoa(config.BetaBindPort)))
<mask> } <mask> } else { <mask> log.Printf("Go to %s://%s", proto, net.JoinHostPort(config.BindHost, port)) <mask> if config.BetaBindPort != 0 { <mask> log.Printf("Go to %s://%s (BETA)", proto, net.JoinHostPort(config.BindHost, strconv.Itoa(config.BetaBindPort))) <mask> } <mask> } <mask> } <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/home.go
// TODO(e.burkov): Remove this weird buildtag.
<mask> // +build !race <mask> <mask> // TODO(e.burkov): remove this weird buildtag. <mask> <mask> package home <mask> <mask> import ( <mask> "context" </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-conversion-vol2 to master Closes #2508. Squashed commit of the followi...
[ "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/home_test.go
"net"
<mask> <mask> import ( <mask> "fmt" <mask> "os" <mask> "strconv" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/version" <mask> ) </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-conversion-vol2 to master Closes #2508. Squashed commit of the following: co...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/options.go
bindHost net.IP // host address to bind HTTP server on
<mask> type options struct { <mask> verbose bool // is verbose logging enabled <mask> configFilename string // path to the config file <mask> workDir string // path to the working directory where we will store the filters data and the querylog <mask> bindHost string // host address to bin...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/options.go
func ipSliceOrNil(ip net.IP) []string { if ip == nil { return nil } return []string{ip.String()} }
<mask> // zero otherwise they return a string slice of the parameter <mask> <mask> func stringSliceOrNil(s string) []string { <mask> if s == "" { <mask> return nil <mask> } <mask> </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-conversion-vol2 to master Closes #2508. ...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/options.go
func(o options, v string) (options, error) { o.bindHost = net.ParseIP(v); return o, nil }, nil, nil, func(o options) []string { return ipSliceOrNil(o.bindHost) },
<mask> <mask> var hostArg = arg{ <mask> "Host address to bind HTTP server on", <mask> "host", "h", <mask> func(o options, v string) (options, error) { o.bindHost = v; return o, nil }, nil, nil, <mask> func(o options) []string { return stringSliceOrNil(o.bindHost) }, <mask> } <mask> <mask> var portArg = a...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/options.go
"net"
<mask> <mask> import ( <mask> "fmt" <mask> "testing" <mask> ) <mask> <mask> func testParseOk(t *testing.T, ss ...string) options { </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-conversion-vol2 to master Closes #2508. Squashed commit of the following: commit 5b9d33f9c...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/options_test.go
if testParseOk(t).bindHost != nil {
<mask> testParseParamMissing(t, "--work-dir") <mask> } <mask> <mask> func TestParseBindHost(t *testing.T) { <mask> if testParseOk(t).bindHost != "" { <mask> t.Fatal("empty is no host") <mask> } <mask> if testParseOk(t, "-h", "addr").bindHost != "addr" { <mask> t.Fatal("-h is host") <mask> } </s> Pu...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/options_test.go
if !testParseOk(t, "-h", "1.2.3.4").bindHost.Equal(net.IP{1, 2, 3, 4}) {
<mask> func TestParseBindHost(t *testing.T) { <mask> if testParseOk(t).bindHost != "" { <mask> t.Fatal("empty is no host") <mask> } <mask> if testParseOk(t, "-h", "addr").bindHost != "addr" { <mask> t.Fatal("-h is host") <mask> } <mask> testParseParamMissing(t, "-h") <mask> if testParseOk(t, "--host"...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/options_test.go
if !testParseOk(t, "--host", "1.2.3.4").bindHost.Equal(net.IP{1, 2, 3, 4}) {
<mask> if testParseOk(t, "-h", "addr").bindHost != "addr" { <mask> t.Fatal("-h is host") <mask> } <mask> testParseParamMissing(t, "-h") <mask> if testParseOk(t, "--host", "addr").bindHost != "addr" { <mask> t.Fatal("--host is host") <mask> } <mask> testParseParamMissing(t, "--host") <mask> } <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/options_test.go
testSerialize(t, options{bindHost: net.IP{1, 2, 3, 4}}, "-h", "1.2.3.4")
<mask> testSerialize(t, options{workDir: "path"}, "-w", "path") <mask> } <mask> <mask> func TestSerializeBindHost(t *testing.T) { <mask> testSerialize(t, options{bindHost: "addr"}, "-h", "addr") <mask> } <mask> <mask> func TestSerializeBindPort(t *testing.T) { <mask> testSerialize(t, options{bindPort: 666...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/options_test.go
"net"
<mask> package home <mask> <mask> import ( <mask> "encoding/binary" <mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-conversion-vol2 to master Closes #2508. Squashed ...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/rdns.go
ipChannel chan net.IP // pass data from DNS request handling thread to rDNS thread
<mask> // RDNS - module context <mask> type RDNS struct { <mask> dnsServer *dnsforward.Server <mask> clients *clientsContainer <mask> ipChannel chan string // pass data from DNS request handling thread to rDNS thread <mask> <mask> // Contains IP addresses of clients to be resolved by rDNS <mask> // If I...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/rdns.go
r.ipChannel = make(chan net.IP, 256)
<mask> cconf.EnableLRU = true <mask> cconf.MaxCount = 10000 <mask> r.ipAddrs = cache.New(cconf) <mask> <mask> r.ipChannel = make(chan string, 256) <mask> go r.workerLoop() <mask> return &r <mask> } <mask> <mask> // Begin - add IP address to rDNS queue </s> Pull request: 2508 ip conversion vol.2 Merg...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/rdns.go
func (r *RDNS) Begin(ip net.IP) {
<mask> return &r <mask> } <mask> <mask> // Begin - add IP address to rDNS queue <mask> func (r *RDNS) Begin(ip string) { <mask> now := uint64(time.Now().Unix()) <mask> expire := r.ipAddrs.Get([]byte(ip)) <mask> if len(expire) != 0 { <mask> exp := binary.BigEndian.Uint64(expire) <mask> if exp > now { ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/rdns.go
expire := r.ipAddrs.Get(ip)
<mask> <mask> // Begin - add IP address to rDNS queue <mask> func (r *RDNS) Begin(ip string) { <mask> now := uint64(time.Now().Unix()) <mask> expire := r.ipAddrs.Get([]byte(ip)) <mask> if len(expire) != 0 { <mask> exp := binary.BigEndian.Uint64(expire) <mask> if exp > now { <mask> return <mask> }...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/rdns.go
_ = r.ipAddrs.Set(ip, expire)
<mask> } <mask> expire = make([]byte, 8) <mask> const ttl = 1 * 60 * 60 <mask> binary.BigEndian.PutUint64(expire, now+ttl) <mask> _ = r.ipAddrs.Set([]byte(ip), expire) <mask> <mask> if r.clients.Exists(ip, ClientSourceRDNS) { <mask> return <mask> } <mask> </s> Pull request: 2508 ip conversion vol....
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/rdns.go
func (r *RDNS) resolve(ip net.IP) string {
<mask> } <mask> } <mask> <mask> // Use rDNS to get hostname by IP address <mask> func (r *RDNS) resolve(ip string) string { <mask> log.Tracef("Resolving host for %s", ip) <mask> <mask> req := dns.Msg{} <mask> req.Id = dns.Id() <mask> req.RecursionDesired = true </s> Pull request: 2508 ip conversion vo...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/rdns.go
req.Question[0].Name, err = dns.ReverseAddr(ip.String())
<mask> Qclass: dns.ClassINET, <mask> }, <mask> } <mask> var err error <mask> req.Question[0].Name, err = dns.ReverseAddr(ip) <mask> if err != nil { <mask> log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err) <mask> return "" <mask> } <mask> </s> Pull request: 2508 ip conversion vo...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/rdns.go
_, _ = r.clients.AddHost(ip.String(), host, ClientSourceRDNS)
<mask> if len(host) == 0 { <mask> continue <mask> } <mask> <mask> _, _ = r.clients.AddHost(ip, host, ClientSourceRDNS) <mask> } <mask> } </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-conversion-vol2 to master Closes #2508. Squashed commit of the following: com...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/rdns.go
"net"
<mask> package home <mask> <mask> import ( <mask> "testing" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/stretchr/testify/assert" <mask> ) </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-conversion-vol2 to master Closes #250...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/rdns_test.go
r := rdns.resolve(net.IP{1, 1, 1, 1})
<mask> assert.Nil(t, err) <mask> <mask> clients := &clientsContainer{} <mask> rdns := InitRDNS(dns, clients) <mask> r := rdns.resolve("1.1.1.1") <mask> assert.Equal(t, "one.one.one.one", r, r) <mask> } </s> Pull request: 2508 ip conversion vol.2 Merge in DNS/adguard-home from 2508-ip-conversion-vol2 to m...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/rdns_test.go
BindHost net.IP
<mask> ) <mask> <mask> type webConfig struct { <mask> firstRun bool <mask> BindHost string <mask> BindPort int <mask> BetaBindPort int <mask> PortHTTPS int <mask> <mask> // ReadTimeout is an option to pass to http.Server for setting an </s> Pull request: 2508 ip conversion vol.2 Merge...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/web.go
hostStr := web.conf.BindHost.String()
<mask> for !web.httpsServer.shutdown { <mask> printHTTPAddresses("http") <mask> errs := make(chan error, 2) <mask> <mask> // we need to have new instance, because after Shutdown() the Server is not usable <mask> web.httpServer = &http.Server{ <mask> ErrorLog: log.StdLog("web: http", log.DEB...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/web.go
Addr: net.JoinHostPort(hostStr, strconv.Itoa(web.conf.BindPort)),
<mask> <mask> // we need to have new instance, because after Shutdown() the Server is not usable <mask> web.httpServer = &http.Server{ <mask> ErrorLog: log.StdLog("web: http", log.DEBUG), <mask> Addr: net.JoinHostPort(web.conf.BindHost, strconv.Itoa(web.conf.BindPort)), <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/web.go
Addr: net.JoinHostPort(hostStr, strconv.Itoa(web.conf.BetaBindPort)),
<mask> <mask> if web.conf.BetaBindPort != 0 { <mask> web.httpServerBeta = &http.Server{ <mask> ErrorLog: log.StdLog("web: http", log.DEBUG), <mask> Addr: net.JoinHostPort(web.conf.BindHost, strconv.Itoa(web.conf.BetaBindPort)), <mask> Handler: withMiddlewares(Cont...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/web.go
address := net.JoinHostPort(web.conf.BindHost.String(), strconv.Itoa(web.conf.PortHTTPS))
<mask> <mask> web.httpsServer.cond.L.Unlock() <mask> <mask> // prepare HTTPS server <mask> address := net.JoinHostPort(web.conf.BindHost, strconv.Itoa(web.conf.PortHTTPS)) <mask> web.httpsServer.server = &http.Server{ <mask> ErrorLog: log.StdLog("web: https", log.DEBUG), <mask> Addr: address...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/web.go
ipChan chan net.IP
<mask> <mask> // Whois - module context <mask> type Whois struct { <mask> clients *clientsContainer <mask> ipChan chan string <mask> timeoutMsec uint <mask> <mask> // Contains IP addresses of clients <mask> // An active IP address is resolved once again after it expires. <mask> // If IP addre...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/7fab31beaeb8c7d1c9892746bbf37e99d4f9dc01
internal/home/whois.go