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 |
|---|---|---|---|---|
func TestSerialize(t *testing.T) {
const reportFmt = "expected %s but got %s"
testCases := []struct {
name string
opts options
ss []string
}{{
name: "empty",
opts: options{},
ss: []string{},
}, {
name: "config_filename",
opts: options{configFilename: "path"},
ss: []string{"-c", "path"},
}, {
name: "work_dir",
opts: options{workDir: "path"},
ss: []string{"-w", "path"},
}, {
name: "bind_host",
opts: options{bindHost: net.IP{1, 2, 3, 4}},
ss: []string{"-h", "1.2.3.4"},
}, {
name: "bind_port",
opts: options{bindPort: 666},
ss: []string{"-p", "666"},
}, {
name: "log_file",
opts: options{logFile: "path"},
ss: []string{"-l", "path"},
}, {
name: "pid_file",
opts: options{pidFile: "path"},
ss: []string{"--pidfile", "path"},
}, {
name: "disable_update",
opts: options{disableUpdate: true},
ss: []string{"--no-check-update"},
}, {
name: "control_action",
opts: options{serviceControlAction: "run"},
ss: []string{"-s", "run"},
}, {
name: "glinet_mode",
opts: options{glinetMode: true},
ss: []string{"--glinet"},
}, {
name: "disable_mem_opt",
opts: options{disableMemoryOptimization: true},
ss: []string{"--no-mem-optimization"},
}, {
name: "multiple",
opts: options{
serviceControlAction: "run",
configFilename: "config",
workDir: "work",
pidFile: "pid",
disableUpdate: true,
disableMemoryOptimization: true,
},
ss: []string{
"-c", "config",
"-w", "work",
"-s", "run",
"--pidfile", "pid",
"--no-check-update",
"--no-mem-optimization",
},
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
result := serialize(tc.opts)
require.Lenf(t, result, len(tc.ss), reportFmt, tc.ss, result)
for i, r := range result {
assert.Equalf(t, tc.ss[i], r, reportFmt, tc.ss, result)
}
}) | <mask> testParseErr(t, "unknown plus", "+x")
<mask> testParseErr(t, "unknown dash", "-")
<mask> }
<mask>
<mask> func testSerialize(t *testing.T, o options, ss ...string) {
<mask> result := serialize(o)
<mask> if len(result) != len(ss) {
<mask> t.Fatalf("expected %s but got %s", ss, result)
<mask> }
<mask> for i, r := range result {
<mask> if r != ss[i] {
<mask> t.Fatalf("expected %s but got %s", ss, result)
<mask> }
<mask> }
<mask> }
<mask>
<mask> func TestSerializeEmpty(t *testing.T) {
<mask> testSerialize(t, options{})
</s> Pull request: 2639 use testify require vol.4
Merge in DNS/adguard-home from 2639-testify-require-4 to master
Closes #2639.
Squashed commit of the following:
commit 0bb9125f42ab6d2511c1b8e481112aa5edd581d9
Merge: 0e9e9ed1 2c9992e0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 11 15:47:21 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit 0e9e9ed16ae13ce648b5e1da6ffd123df911c2d7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:43:15 2021 +0300
home: rm deletion error check
commit 6bfbbcd2b7f9197a06856f9e6b959c2e1c4b8353
Merge: c8ebe541 8811c881
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:30:07 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit c8ebe54142bba780226f76ddb72e33664ed28f30
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:28:43 2021 +0300
home: imp tests
commit f0e1db456f02df5f5f56ca93e7bd40a48475b38c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 5 14:06:41 2021 +0300
dnsforward: imp tests
commit 4528246105ed06471a8778abbe8e5c30fc5483d5
Merge: 54b08d9c 90ebc4d8
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 4 18:17:52 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit 54b08d9c980b8d69d019a1a1b3931aa048275691
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Feb 11 13:17:05 2021 +0300
dnsfilter: imp tests </s> remove
func TestSerializeEmpty(t *testing.T) {
testSerialize(t, options{})
}
func TestSerializeConfigFilename(t *testing.T) {
testSerialize(t, options{configFilename: "path"}, "-c", "path")
}
func TestSerializeWorkDir(t *testing.T) {
testSerialize(t, options{workDir: "path"}, "-w", "path")
}
func TestSerializeBindHost(t *testing.T) {
testSerialize(t, options{bindHost: net.IP{1, 2, 3, 4}}, "-h", "1.2.3.4")
}
func TestSerializeBindPort(t *testing.T) {
testSerialize(t, options{bindPort: 666}, "-p", "666")
}
func TestSerializeLogfile(t *testing.T) {
testSerialize(t, options{logFile: "path"}, "-l", "path")
}
func TestSerializePidfile(t *testing.T) {
testSerialize(t, options{pidFile: "path"}, "--pidfile", "path")
}
func TestSerializeCheckConfig(t *testing.T) {
testSerialize(t, options{checkConfig: true}, "--check-config")
}
func TestSerializeDisableUpdate(t *testing.T) {
testSerialize(t, options{disableUpdate: true}, "--no-check-update")
}
func TestSerializeService(t *testing.T) {
testSerialize(t, options{serviceControlAction: "run"}, "-s", "run")
}
func TestSerializeGLInet(t *testing.T) {
testSerialize(t, options{glinetMode: true}, "--glinet")
}
func TestSerializeDisableMemoryOptimization(t *testing.T) {
testSerialize(t, options{disableMemoryOptimization: true}, "--no-mem-optimization")
}
func TestSerializeMultiple(t *testing.T) {
testSerialize(t, options{
serviceControlAction: "run",
configFilename: "config",
workDir: "work",
pidFile: "pid",
disableUpdate: true,
disableMemoryOptimization: true,
}, "-c", "config", "-w", "work", "-s", "run", "--pidfile", "pid", "--no-check-update", "--no-mem-optimization")
}
</s> add </s> remove if err == nil {
t.Fatalf("expected an error because %s but no error returned", descr)
}
</s> add require.NotNilf(t, err, "expected an error because %s but no error returned", descr) </s> remove if err != nil {
t.Fatal(err.Error())
}
</s> add require.Nil(t, err)
</s> remove func testParseOk(t *testing.T, ss ...string) options {
</s> add func testParseOK(t *testing.T, ss ...string) options {
t.Helper()
</s> remove if testParseOk(t).glinetMode {
t.Fatal("empty is not GL-Inet mode")
}
if !testParseOk(t, "--glinet").glinetMode {
t.Fatal("--glinet is GL-Inet mode")
}
</s> add assert.False(t, testParseOK(t).glinetMode, "empty is not GL-Inet mode")
assert.True(t, testParseOK(t, "--glinet").glinetMode, "--glinet is GL-Inet mode") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/dfdbfee4fd89047c49777841a70654480f1e67ea | internal/home/options_test.go |
<mask> t.Fatalf("expected %s but got %s", ss, result)
<mask> }
<mask> }
<mask> }
<mask>
<mask> func TestSerializeEmpty(t *testing.T) {
<mask> testSerialize(t, options{})
<mask> }
<mask>
<mask> func TestSerializeConfigFilename(t *testing.T) {
<mask> testSerialize(t, options{configFilename: "path"}, "-c", "path")
<mask> }
<mask>
<mask> func TestSerializeWorkDir(t *testing.T) {
<mask> testSerialize(t, options{workDir: "path"}, "-w", "path")
<mask> }
<mask>
<mask> func TestSerializeBindHost(t *testing.T) {
<mask> testSerialize(t, options{bindHost: net.IP{1, 2, 3, 4}}, "-h", "1.2.3.4")
<mask> }
<mask>
<mask> func TestSerializeBindPort(t *testing.T) {
<mask> testSerialize(t, options{bindPort: 666}, "-p", "666")
<mask> }
<mask>
<mask> func TestSerializeLogfile(t *testing.T) {
<mask> testSerialize(t, options{logFile: "path"}, "-l", "path")
<mask> }
<mask>
<mask> func TestSerializePidfile(t *testing.T) {
<mask> testSerialize(t, options{pidFile: "path"}, "--pidfile", "path")
<mask> }
<mask>
<mask> func TestSerializeCheckConfig(t *testing.T) {
<mask> testSerialize(t, options{checkConfig: true}, "--check-config")
<mask> }
<mask>
<mask> func TestSerializeDisableUpdate(t *testing.T) {
<mask> testSerialize(t, options{disableUpdate: true}, "--no-check-update")
<mask> }
<mask>
<mask> func TestSerializeService(t *testing.T) {
<mask> testSerialize(t, options{serviceControlAction: "run"}, "-s", "run")
<mask> }
<mask>
<mask> func TestSerializeGLInet(t *testing.T) {
<mask> testSerialize(t, options{glinetMode: true}, "--glinet")
<mask> }
<mask>
<mask> func TestSerializeDisableMemoryOptimization(t *testing.T) {
<mask> testSerialize(t, options{disableMemoryOptimization: true}, "--no-mem-optimization")
<mask> }
<mask>
<mask> func TestSerializeMultiple(t *testing.T) {
<mask> testSerialize(t, options{
<mask> serviceControlAction: "run",
<mask> configFilename: "config",
<mask> workDir: "work",
<mask> pidFile: "pid",
<mask> disableUpdate: true,
<mask> disableMemoryOptimization: true,
<mask> }, "-c", "config", "-w", "work", "-s", "run", "--pidfile", "pid", "--no-check-update", "--no-mem-optimization")
<mask> }
</s> Pull request: 2639 use testify require vol.4
Merge in DNS/adguard-home from 2639-testify-require-4 to master
Closes #2639.
Squashed commit of the following:
commit 0bb9125f42ab6d2511c1b8e481112aa5edd581d9
Merge: 0e9e9ed1 2c9992e0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 11 15:47:21 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit 0e9e9ed16ae13ce648b5e1da6ffd123df911c2d7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:43:15 2021 +0300
home: rm deletion error check
commit 6bfbbcd2b7f9197a06856f9e6b959c2e1c4b8353
Merge: c8ebe541 8811c881
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:30:07 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit c8ebe54142bba780226f76ddb72e33664ed28f30
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:28:43 2021 +0300
home: imp tests
commit f0e1db456f02df5f5f56ca93e7bd40a48475b38c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 5 14:06:41 2021 +0300
dnsforward: imp tests
commit 4528246105ed06471a8778abbe8e5c30fc5483d5
Merge: 54b08d9c 90ebc4d8
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 4 18:17:52 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit 54b08d9c980b8d69d019a1a1b3931aa048275691
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Feb 11 13:17:05 2021 +0300
dnsfilter: imp tests </s> remove func testSerialize(t *testing.T, o options, ss ...string) {
result := serialize(o)
if len(result) != len(ss) {
t.Fatalf("expected %s but got %s", ss, result)
}
for i, r := range result {
if r != ss[i] {
t.Fatalf("expected %s but got %s", ss, result)
}
</s> add func TestSerialize(t *testing.T) {
const reportFmt = "expected %s but got %s"
testCases := []struct {
name string
opts options
ss []string
}{{
name: "empty",
opts: options{},
ss: []string{},
}, {
name: "config_filename",
opts: options{configFilename: "path"},
ss: []string{"-c", "path"},
}, {
name: "work_dir",
opts: options{workDir: "path"},
ss: []string{"-w", "path"},
}, {
name: "bind_host",
opts: options{bindHost: net.IP{1, 2, 3, 4}},
ss: []string{"-h", "1.2.3.4"},
}, {
name: "bind_port",
opts: options{bindPort: 666},
ss: []string{"-p", "666"},
}, {
name: "log_file",
opts: options{logFile: "path"},
ss: []string{"-l", "path"},
}, {
name: "pid_file",
opts: options{pidFile: "path"},
ss: []string{"--pidfile", "path"},
}, {
name: "disable_update",
opts: options{disableUpdate: true},
ss: []string{"--no-check-update"},
}, {
name: "control_action",
opts: options{serviceControlAction: "run"},
ss: []string{"-s", "run"},
}, {
name: "glinet_mode",
opts: options{glinetMode: true},
ss: []string{"--glinet"},
}, {
name: "disable_mem_opt",
opts: options{disableMemoryOptimization: true},
ss: []string{"--no-mem-optimization"},
}, {
name: "multiple",
opts: options{
serviceControlAction: "run",
configFilename: "config",
workDir: "work",
pidFile: "pid",
disableUpdate: true,
disableMemoryOptimization: true,
},
ss: []string{
"-c", "config",
"-w", "work",
"-s", "run",
"--pidfile", "pid",
"--no-check-update",
"--no-mem-optimization",
},
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
result := serialize(tc.opts)
require.Lenf(t, result, len(tc.ss), reportFmt, tc.ss, result)
for i, r := range result {
assert.Equalf(t, tc.ss[i], r, reportFmt, tc.ss, result)
}
}) </s> remove if testParseOk(t).pidFile != "" {
t.Fatal("empty is no pid file")
}
if testParseOk(t, "--pidfile", "path").pidFile != "path" {
t.Fatal("--pidfile is pid file")
}
</s> add assert.Equal(t, "", testParseOK(t).pidFile, "empty is no pid file")
assert.Equal(t, "path", testParseOK(t, "--pidfile", "path").pidFile, "--pidfile is pid file") </s> remove if testParseOk(t).serviceControlAction != "" {
t.Fatal("empty is no service command")
}
if testParseOk(t, "-s", "command").serviceControlAction != "command" {
t.Fatal("-s is service command")
}
if testParseOk(t, "--service", "command").serviceControlAction != "command" {
t.Fatal("--service is service command")
}
</s> add assert.Equal(t, "", testParseOK(t).serviceControlAction, "empty is not service cmd")
assert.Equal(t, "cmd", testParseOK(t, "-s", "cmd").serviceControlAction, "-s is service cmd")
assert.Equal(t, "cmd", testParseOK(t, "--service", "cmd").serviceControlAction, "--service is service cmd") </s> remove if !testParseOk(t, "--host", "1.2.3.4").bindHost.Equal(net.IP{1, 2, 3, 4}) {
t.Fatal("--host is host")
}
</s> add assert.Equal(t, net.IPv4(1, 2, 3, 4), testParseOK(t, "--host", "1.2.3.4").bindHost, "--host is host") </s> remove if err == nil {
t.Fatalf("expected an error because %s but no error returned", descr)
}
</s> add require.NotNilf(t, err, "expected an error because %s but no error returned", descr) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/dfdbfee4fd89047c49777841a70654480f1e67ea | internal/home/options_test.go | |
require.Nil(t, err) | <mask>
<mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> timestamp, err := time.Parse(time.RFC3339Nano, tc.time)
<mask> assert.Nil(t, err)
<mask>
<mask> if tc.name == "first" {
<mask> assert.True(t, true)
<mask> }
<mask>
<mask> err = r.SeekTS(timestamp.UnixNano())
<mask> assert.True(t, errors.Is(err, tc.want))
<mask> })
<mask> }
</s> Pull request: 2639 use testify require vol.4
Merge in DNS/adguard-home from 2639-testify-require-4 to master
Closes #2639.
Squashed commit of the following:
commit 0bb9125f42ab6d2511c1b8e481112aa5edd581d9
Merge: 0e9e9ed1 2c9992e0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 11 15:47:21 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit 0e9e9ed16ae13ce648b5e1da6ffd123df911c2d7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:43:15 2021 +0300
home: rm deletion error check
commit 6bfbbcd2b7f9197a06856f9e6b959c2e1c4b8353
Merge: c8ebe541 8811c881
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:30:07 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit c8ebe54142bba780226f76ddb72e33664ed28f30
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:28:43 2021 +0300
home: imp tests
commit f0e1db456f02df5f5f56ca93e7bd40a48475b38c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 5 14:06:41 2021 +0300
dnsforward: imp tests
commit 4528246105ed06471a8778abbe8e5c30fc5483d5
Merge: 54b08d9c 90ebc4d8
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 4 18:17:52 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit 54b08d9c980b8d69d019a1a1b3931aa048275691
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Feb 11 13:17:05 2021 +0300
dnsfilter: imp tests </s> remove assert.Equal(t, tc.valid, err == nil)
if err == nil {
</s> add require.Equal(t, tc.valid, err == nil)
if tc.valid { </s> remove assert.Nil(t, err, err)
</s> add require.Nil(t, err) </s> remove assert.Nil(t, err)
</s> add require.Nil(t, err) </s> remove assert.Nil(t, err)
</s> add require.Nil(t, err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/dfdbfee4fd89047c49777841a70654480f1e67ea | internal/querylog/qlogreader_test.go |
require.Nil(t, err) | <mask>
<mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> err := r.SeekStart()
<mask> assert.Nil(t, err, err)
<mask>
<mask> for i := 1; i < tc.start; i++ {
<mask> _, err := r.ReadNext()
<mask> assert.Nil(t, err)
<mask> }
</s> Pull request: 2639 use testify require vol.4
Merge in DNS/adguard-home from 2639-testify-require-4 to master
Closes #2639.
Squashed commit of the following:
commit 0bb9125f42ab6d2511c1b8e481112aa5edd581d9
Merge: 0e9e9ed1 2c9992e0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 11 15:47:21 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit 0e9e9ed16ae13ce648b5e1da6ffd123df911c2d7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:43:15 2021 +0300
home: rm deletion error check
commit 6bfbbcd2b7f9197a06856f9e6b959c2e1c4b8353
Merge: c8ebe541 8811c881
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:30:07 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit c8ebe54142bba780226f76ddb72e33664ed28f30
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:28:43 2021 +0300
home: imp tests
commit f0e1db456f02df5f5f56ca93e7bd40a48475b38c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 5 14:06:41 2021 +0300
dnsforward: imp tests
commit 4528246105ed06471a8778abbe8e5c30fc5483d5
Merge: 54b08d9c 90ebc4d8
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 4 18:17:52 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit 54b08d9c980b8d69d019a1a1b3931aa048275691
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Feb 11 13:17:05 2021 +0300
dnsfilter: imp tests </s> remove assert.Nil(t, err)
</s> add require.Nil(t, err) </s> remove assert.Nil(t, err)
</s> add require.Nil(t, err) </s> remove assert.Nil(t, err)
if tc.name == "first" {
assert.True(t, true)
}
</s> add require.Nil(t, err) </s> remove assert.Nil(t, err)
</s> add require.Nil(t, err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/dfdbfee4fd89047c49777841a70654480f1e67ea | internal/querylog/qlogreader_test.go |
require.Nil(t, err) | <mask> assert.Nil(t, err, err)
<mask>
<mask> for i := 1; i < tc.start; i++ {
<mask> _, err := r.ReadNext()
<mask> assert.Nil(t, err)
<mask> }
<mask>
<mask> _, err = r.ReadNext()
<mask> assert.Equal(t, tc.want, err)
<mask> })
</s> Pull request: 2639 use testify require vol.4
Merge in DNS/adguard-home from 2639-testify-require-4 to master
Closes #2639.
Squashed commit of the following:
commit 0bb9125f42ab6d2511c1b8e481112aa5edd581d9
Merge: 0e9e9ed1 2c9992e0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 11 15:47:21 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit 0e9e9ed16ae13ce648b5e1da6ffd123df911c2d7
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:43:15 2021 +0300
home: rm deletion error check
commit 6bfbbcd2b7f9197a06856f9e6b959c2e1c4b8353
Merge: c8ebe541 8811c881
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:30:07 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit c8ebe54142bba780226f76ddb72e33664ed28f30
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 10 12:28:43 2021 +0300
home: imp tests
commit f0e1db456f02df5f5f56ca93e7bd40a48475b38c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 5 14:06:41 2021 +0300
dnsforward: imp tests
commit 4528246105ed06471a8778abbe8e5c30fc5483d5
Merge: 54b08d9c 90ebc4d8
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 4 18:17:52 2021 +0300
Merge branch 'master' into 2639-testify-require-4
commit 54b08d9c980b8d69d019a1a1b3931aa048275691
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Feb 11 13:17:05 2021 +0300
dnsfilter: imp tests </s> remove assert.Nil(t, err, err)
</s> add require.Nil(t, err) </s> remove func createTestServer(t *testing.T, filterConf *dnsfilter.Config, forwardConf ServerConfig) *Server {
rules := `||nxdomain.example.org
||null.example.org^
127.0.0.1 host.example.org
@@||whitelist.example.org^
||127.0.0.255`
filters := []dnsfilter.Filter{{
ID: 0, Data: []byte(rules),
}}
f := dnsfilter.New(filterConf, filters)
s := NewServer(DNSCreateParams{DNSFilter: f})
s.conf = forwardConf
assert.Nil(t, s.Prepare(nil))
return s
}
func createServerTLSConfig(t *testing.T) (*tls.Config, []byte, []byte) {
t.Helper()
privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
assert.Nilf(t, err, "cannot generate RSA key: %s", err)
serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
serialNumber, err := rand.Int(rand.Reader, serialNumberLimit)
assert.Nilf(t, err, "failed to generate serial number: %s", err)
notBefore := time.Now()
notAfter := notBefore.Add(5 * 365 * time.Hour * 24)
template := x509.Certificate{
SerialNumber: serialNumber,
Subject: pkix.Name{
Organization: []string{"AdGuard Tests"},
},
NotBefore: notBefore,
NotAfter: notAfter,
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
BasicConstraintsValid: true,
IsCA: true,
}
template.DNSNames = append(template.DNSNames, tlsServerName)
derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(privateKey), privateKey)
assert.Nilf(t, err, "failed to create certificate: %s", err)
certPem := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: derBytes})
keyPem := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(privateKey)})
cert, err := tls.X509KeyPair(certPem, keyPem)
assert.Nilf(t, err, "failed to create certificate: %s", err)
return &tls.Config{
Certificates: []tls.Certificate{cert},
ServerName: tlsServerName,
MinVersion: tls.VersionTLS12,
}, certPem, keyPem
}
// sendTestMessagesAsync sends messages in parallel to check for race issues.
//lint:ignore U1000 it's called from the function which is skipped for now.
func sendTestMessagesAsync(t *testing.T, conn *dns.Conn) {
wg := &sync.WaitGroup{}
for i := 0; i < testMessagesCount; i++ {
msg := createGoogleATestMessage()
wg.Add(1)
go func() {
defer wg.Done()
err := conn.WriteMsg(msg)
assert.Nilf(t, err, "cannot write message: %s", err)
res, err := conn.ReadMsg()
assert.Nilf(t, err, "cannot read response to message: %s", err)
assertGoogleAResponse(t, res)
}()
}
wg.Wait()
}
func sendTestMessages(t *testing.T, conn *dns.Conn) {
t.Helper()
for i := 0; i < testMessagesCount; i++ {
req := createGoogleATestMessage()
err := conn.WriteMsg(req)
assert.Nilf(t, err, "cannot write message #%d: %s", i, err)
res, err := conn.ReadMsg()
assert.Nilf(t, err, "cannot read response to message #%d: %s", i, err)
assertGoogleAResponse(t, res)
}
}
func createGoogleATestMessage() *dns.Msg {
return createTestMessage("google-public-dns-a.google.com.")
}
func createTestMessage(host string) *dns.Msg {
return &dns.Msg{
MsgHdr: dns.MsgHdr{
Id: dns.Id(),
RecursionDesired: true,
},
Question: []dns.Question{{
Name: host,
Qtype: dns.TypeA,
Qclass: dns.ClassINET,
}},
}
}
func createTestMessageWithType(host string, qtype uint16) *dns.Msg {
req := createTestMessage(host)
req.Question[0].Qtype = qtype
return req
}
func assertGoogleAResponse(t *testing.T, reply *dns.Msg) {
assertResponse(t, reply, net.IP{8, 8, 8, 8})
}
func assertResponse(t *testing.T, reply *dns.Msg, ip net.IP) {
t.Helper()
if !assert.Lenf(t, reply.Answer, 1, "dns server returned reply with wrong number of answers - %d", len(reply.Answer)) {
return
}
a, ok := reply.Answer[0].(*dns.A)
if assert.Truef(t, ok, "dns server returned wrong answer type instead of A: %v", reply.Answer[0]) {
assert.Truef(t, a.A.Equal(ip), "dns server returned wrong answer instead of %s: %s", ip, a.A)
}
}
</s> add </s> remove assert.Nilf(t, err, "couldn't talk to server %s: %s", addr, err)
</s> add require.Nilf(t, err, "couldn't talk to server %s: %s", addr, err) </s> remove assert.Nil(t, err)
if tc.name == "first" {
assert.True(t, true)
}
</s> add require.Nil(t, err) </s> remove assert.Nilf(b, err, "Error while matching host %s: %s", blocked, err)
</s> add require.Nilf(b, err, "Error while matching host %s: %s", blocked, err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/dfdbfee4fd89047c49777841a70654480f1e67ea | internal/querylog/qlogreader_test.go |
github.com/AdguardTeam/dnsproxy v0.39.4
github.com/AdguardTeam/golibs v0.9.2 | <mask>
<mask> go 1.16
<mask>
<mask> require (
<mask> github.com/AdguardTeam/dnsproxy v0.39.2
<mask> github.com/AdguardTeam/golibs v0.9.1
<mask> github.com/AdguardTeam/urlfilter v0.14.6
<mask> github.com/NYTimes/gziphandler v1.1.1
<mask> github.com/ameshkov/dnscrypt/v2 v2.2.1
<mask> github.com/digineo/go-ipset/v2 v2.2.1
<mask> github.com/fsnotify/fsnotify v1.4.9
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove github.com/AdguardTeam/golibs v0.8.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.9.1 h1:mHSN4LfaY1uGmHPsl97paAND/VeSnM5r9XQ7pSYx93o=
github.com/AdguardTeam/golibs v0.9.1/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY=
</s> add github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ=
github.com/AdguardTeam/golibs v0.9.2/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY= </s> remove github.com/AdguardTeam/dnsproxy v0.39.2 h1:GqsR1S4fFfVsVCSrdrfa0RfsQ2u+MeNUMqDkxdTD3gU=
github.com/AdguardTeam/dnsproxy v0.39.2/go.mod h1:aNXKNdTyKfgAG2OS712SYSaGIM9AasZsZxfiY4YiR/0=
</s> add github.com/AdguardTeam/dnsproxy v0.39.4 h1:vjcogr0qpSTvRYzbXabBXblfzYpx+LOn91kjtnYgcrU=
github.com/AdguardTeam/dnsproxy v0.39.4/go.mod h1:JZUxXM70BUlAmMaJEPa6Wh+Tz7eBAQx6DM1GMt+Ff5E= </s> remove var newIvl Duration
newIvl, ok = newDNSConf["querylog_interval"].(Duration)
</s> add var newIvl aghtime.Duration
newIvl, ok = newDNSConf["querylog_interval"].(aghtime.Duration) </s> remove golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | go.mod |
github.com/AdguardTeam/dnsproxy v0.39.4 h1:vjcogr0qpSTvRYzbXabBXblfzYpx+LOn91kjtnYgcrU=
github.com/AdguardTeam/dnsproxy v0.39.4/go.mod h1:JZUxXM70BUlAmMaJEPa6Wh+Tz7eBAQx6DM1GMt+Ff5E= | <mask> dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
<mask> git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
<mask> github.com/AdguardTeam/dhcp v0.0.0-20210519141215-51808c73c0bf h1:gc042VRSIRSUzZ+Px6xQCRWNJZTaPkomisDfUZmoFNk=
<mask> github.com/AdguardTeam/dhcp v0.0.0-20210519141215-51808c73c0bf/go.mod h1:TKl4jN3Voofo4UJIicyNhWGp/nlQqQkFxmwIFTvBkKI=
<mask> github.com/AdguardTeam/dnsproxy v0.39.2 h1:GqsR1S4fFfVsVCSrdrfa0RfsQ2u+MeNUMqDkxdTD3gU=
<mask> github.com/AdguardTeam/dnsproxy v0.39.2/go.mod h1:aNXKNdTyKfgAG2OS712SYSaGIM9AasZsZxfiY4YiR/0=
<mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.8.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.9.1 h1:mHSN4LfaY1uGmHPsl97paAND/VeSnM5r9XQ7pSYx93o=
<mask> github.com/AdguardTeam/golibs v0.9.1/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY=
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove github.com/AdguardTeam/golibs v0.8.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.9.1 h1:mHSN4LfaY1uGmHPsl97paAND/VeSnM5r9XQ7pSYx93o=
github.com/AdguardTeam/golibs v0.9.1/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY=
</s> add github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ=
github.com/AdguardTeam/golibs v0.9.2/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY= </s> remove github.com/AdguardTeam/dnsproxy v0.39.2
github.com/AdguardTeam/golibs v0.9.1
</s> add github.com/AdguardTeam/dnsproxy v0.39.4
github.com/AdguardTeam/golibs v0.9.2 </s> remove var newIvl Duration
newIvl, ok = newDNSConf["querylog_interval"].(Duration)
</s> add var newIvl aghtime.Duration
newIvl, ok = newDNSConf["querylog_interval"].(aghtime.Duration) </s> remove golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | go.sum |
github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ=
github.com/AdguardTeam/golibs v0.9.2/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY= | <mask> github.com/AdguardTeam/dnsproxy v0.39.2 h1:GqsR1S4fFfVsVCSrdrfa0RfsQ2u+MeNUMqDkxdTD3gU=
<mask> github.com/AdguardTeam/dnsproxy v0.39.2/go.mod h1:aNXKNdTyKfgAG2OS712SYSaGIM9AasZsZxfiY4YiR/0=
<mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.8.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.9.1 h1:mHSN4LfaY1uGmHPsl97paAND/VeSnM5r9XQ7pSYx93o=
<mask> github.com/AdguardTeam/golibs v0.9.1/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY=
<mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU=
<mask> github.com/AdguardTeam/urlfilter v0.14.6 h1:emqoKZElooHACYehRBYENeKVN1a/rspxiqTIMYLuoIo=
<mask> github.com/AdguardTeam/urlfilter v0.14.6/go.mod h1:klx4JbOfc4EaNb5lWLqOwfg+pVcyRukmoJRvO55lL5U=
<mask> github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
<mask> github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove github.com/AdguardTeam/dnsproxy v0.39.2 h1:GqsR1S4fFfVsVCSrdrfa0RfsQ2u+MeNUMqDkxdTD3gU=
github.com/AdguardTeam/dnsproxy v0.39.2/go.mod h1:aNXKNdTyKfgAG2OS712SYSaGIM9AasZsZxfiY4YiR/0=
</s> add github.com/AdguardTeam/dnsproxy v0.39.4 h1:vjcogr0qpSTvRYzbXabBXblfzYpx+LOn91kjtnYgcrU=
github.com/AdguardTeam/dnsproxy v0.39.4/go.mod h1:JZUxXM70BUlAmMaJEPa6Wh+Tz7eBAQx6DM1GMt+Ff5E= </s> remove github.com/AdguardTeam/dnsproxy v0.39.2
github.com/AdguardTeam/golibs v0.9.1
</s> add github.com/AdguardTeam/dnsproxy v0.39.4
github.com/AdguardTeam/golibs v0.9.2 </s> remove var newIvl Duration
newIvl, ok = newDNSConf["querylog_interval"].(Duration)
</s> add var newIvl aghtime.Duration
newIvl, ok = newDNSConf["querylog_interval"].(aghtime.Duration) </s> remove golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | go.sum |
<mask> golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
<mask> golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
<mask> golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
<mask> golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
<mask> golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
<mask> golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
<mask> golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
<mask> golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
<mask> golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
<mask> golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove var ivlVal Duration
ivlVal, ok = ivl.(Duration)
</s> add var ivlVal aghtime.Duration
ivlVal, ok = ivl.(aghtime.Duration) </s> remove var newIvl Duration
newIvl, ok = newDNSConf["querylog_interval"].(Duration)
</s> add var newIvl aghtime.Duration
newIvl, ok = newDNSConf["querylog_interval"].(aghtime.Duration) </s> remove github.com/AdguardTeam/dnsproxy v0.39.2 h1:GqsR1S4fFfVsVCSrdrfa0RfsQ2u+MeNUMqDkxdTD3gU=
github.com/AdguardTeam/dnsproxy v0.39.2/go.mod h1:aNXKNdTyKfgAG2OS712SYSaGIM9AasZsZxfiY4YiR/0=
</s> add github.com/AdguardTeam/dnsproxy v0.39.4 h1:vjcogr0qpSTvRYzbXabBXblfzYpx+LOn91kjtnYgcrU=
github.com/AdguardTeam/dnsproxy v0.39.4/go.mod h1:JZUxXM70BUlAmMaJEPa6Wh+Tz7eBAQx6DM1GMt+Ff5E= </s> remove github.com/AdguardTeam/golibs v0.8.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.9.1 h1:mHSN4LfaY1uGmHPsl97paAND/VeSnM5r9XQ7pSYx93o=
github.com/AdguardTeam/golibs v0.9.1/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY=
</s> add github.com/AdguardTeam/golibs v0.9.2 h1:H3BDFkaosxvb+UgFlNVyN66GZ+JglcZULnJ7z7PukyQ=
github.com/AdguardTeam/golibs v0.9.2/go.mod h1:fCAMwPBJ8S7YMYbTWvYS+eeTLblP5E04IDtNAo7y7IY= | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | go.sum | |
"github.com/AdguardTeam/AdGuardHome/internal/aghtime" | <mask> "sort"
<mask> "strings"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/dnsproxy/upstream"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/golibs/netutil"
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove var ivlVal Duration
ivlVal, ok = ivl.(Duration)
</s> add var ivlVal aghtime.Duration
ivlVal, ok = ivl.(aghtime.Duration) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/dnsforward/config.go |
// FastestTimeout replaces the default timeout for dialing IP addresses
// when FastestAddr is true.
FastestTimeout aghtime.Duration `yaml:"fastest_timeout"` | <mask> UpstreamDNSFileName string `yaml:"upstream_dns_file"`
<mask> BootstrapDNS []string `yaml:"bootstrap_dns"` // a list of bootstrap DNS for DoH and DoT (plain DNS only)
<mask> AllServers bool `yaml:"all_servers"` // if true, parallel queries to all configured upstream servers are enabled
<mask> FastestAddr bool `yaml:"fastest_addr"` // use Fastest Address algorithm
<mask>
<mask> // Access settings
<mask> // --
<mask>
<mask> AllowedClients []string `yaml:"allowed_clients"` // IP addresses of whitelist clients
<mask> DisallowedClients []string `yaml:"disallowed_clients"` // IP addresses of clients that should be blocked
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove QueryLogInterval Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats
</s> add QueryLogInterval aghtime.Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats </s> remove UpstreamTimeout Duration `yaml:"upstream_timeout"`
</s> add UpstreamTimeout aghtime.Duration `yaml:"upstream_timeout"` </s> remove dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
</s> add dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} </s> remove UpstreamTimeout: Duration{Duration: dnsforward.DefaultTimeout},
</s> add UpstreamTimeout: aghtime.Duration{Duration: dnsforward.DefaultTimeout}, | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/dnsforward/config.go |
proxyConfig.FastestPingTimeout = s.conf.FastestTimeout.Duration | <mask> } else if s.conf.FastestAddr {
<mask> proxyConfig.UpstreamMode = proxy.UModeFastestAddr
<mask> }
<mask>
<mask> if len(s.conf.BogusNXDomain) > 0 {
<mask> for _, s := range s.conf.BogusNXDomain {
<mask> ip := net.ParseIP(s)
<mask> if ip == nil {
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove config.DNS.UpstreamTimeout = Duration{Duration: dnsforward.DefaultTimeout}
</s> add config.DNS.UpstreamTimeout = aghtime.Duration{Duration: dnsforward.DefaultTimeout} </s> remove config.DNS.QueryLogInterval = Duration{Duration: dc.RotationIvl}
</s> add config.DNS.QueryLogInterval = aghtime.Duration{Duration: dc.RotationIvl} </s> remove want: Duration{Duration: 24 * time.Hour},
</s> add want: aghtime.Duration{Duration: 24 * time.Hour}, </s> remove dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
</s> add dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} </s> remove QueryLogInterval Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats
</s> add QueryLogInterval aghtime.Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/dnsforward/config.go |
"github.com/AdguardTeam/AdGuardHome/internal/aghtime" | <mask> "path/filepath"
<mask> "sync"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/querylog"
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove var ivlVal Duration
ivlVal, ok = ivl.(Duration)
</s> add var ivlVal aghtime.Duration
ivlVal, ok = ivl.(aghtime.Duration) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/config.go |
"github.com/AdguardTeam/dnsproxy/fastip" | <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/querylog"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/stats"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/version"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/google/renameio/maybe"
<mask> yaml "gopkg.in/yaml.v2"
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove var ivlVal Duration
ivlVal, ok = ivl.(Duration)
</s> add var ivlVal aghtime.Duration
ivlVal, ok = ivl.(aghtime.Duration) </s> remove QueryLogInterval Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats
</s> add QueryLogInterval aghtime.Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/config.go |
QueryLogInterval aghtime.Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats | <mask>
<mask> QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled
<mask> QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // if true, query log will be written to a file
<mask> // QueryLogInterval is the interval for query log's files rotation.
<mask> QueryLogInterval Duration `yaml:"querylog_interval"`
<mask> QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
<mask> AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats
<mask>
<mask> dnsforward.FilteringConfig `yaml:",inline"`
<mask>
<mask> FilteringEnabled bool `yaml:"filtering_enabled"` // whether or not use filter lists
<mask> FiltersUpdateIntervalHours uint32 `yaml:"filters_update_interval"` // time period to update filters (in hours)
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove UpstreamTimeout Duration `yaml:"upstream_timeout"`
</s> add UpstreamTimeout aghtime.Duration `yaml:"upstream_timeout"` </s> remove UpstreamTimeout: Duration{Duration: dnsforward.DefaultTimeout},
</s> add UpstreamTimeout: aghtime.Duration{Duration: dnsforward.DefaultTimeout}, </s> remove dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
</s> add dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/config.go |
UpstreamTimeout aghtime.Duration `yaml:"upstream_timeout"` | <mask> FiltersUpdateIntervalHours uint32 `yaml:"filters_update_interval"` // time period to update filters (in hours)
<mask> DnsfilterConf filtering.Config `yaml:",inline"`
<mask>
<mask> // UpstreamTimeout is the timeout for querying upstream servers.
<mask> UpstreamTimeout Duration `yaml:"upstream_timeout"`
<mask>
<mask> // LocalDomainName is the domain name used for known internal hosts.
<mask> // For example, a machine called "myhost" can be addressed as
<mask> // "myhost.lan" when LocalDomainName is "lan".
<mask> LocalDomainName string `yaml:"local_domain_name"`
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove QueryLogInterval Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats
</s> add QueryLogInterval aghtime.Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats </s> remove dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
</s> add dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} </s> remove UpstreamTimeout: Duration{Duration: dnsforward.DefaultTimeout},
</s> add UpstreamTimeout: aghtime.Duration{Duration: dnsforward.DefaultTimeout}, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/config.go |
FastestTimeout: aghtime.Duration{
Duration: fastip.DefaultPingWaitTimeout,
}, | <mask> Ratelimit: 20,
<mask> RefuseAny: true,
<mask> AllServers: false,
<mask>
<mask> TrustedProxies: []string{"127.0.0.0/8", "::1/128"},
<mask>
<mask> // set default maximum concurrent queries to 300
<mask> // we introduced a default limit due to this:
<mask> // https://github.com/AdguardTeam/AdGuardHome/issues/2015#issuecomment-674041912
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove QueryLogInterval Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats
</s> add QueryLogInterval aghtime.Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats </s> remove UpstreamTimeout Duration `yaml:"upstream_timeout"`
</s> add UpstreamTimeout aghtime.Duration `yaml:"upstream_timeout"` </s> remove dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
</s> add dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} </s> remove UpstreamTimeout: Duration{Duration: dnsforward.DefaultTimeout},
</s> add UpstreamTimeout: aghtime.Duration{Duration: dnsforward.DefaultTimeout}, | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/config.go |
UpstreamTimeout: aghtime.Duration{Duration: dnsforward.DefaultTimeout}, | <mask> MaxGoroutines: 300,
<mask> },
<mask> FilteringEnabled: true, // whether or not use filter lists
<mask> FiltersUpdateIntervalHours: 24,
<mask> UpstreamTimeout: Duration{Duration: dnsforward.DefaultTimeout},
<mask> LocalDomainName: "lan",
<mask> ResolveClients: true,
<mask> UsePrivateRDNS: true,
<mask> },
<mask> TLS: tlsConfigSettings{
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove QueryLogInterval Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats
</s> add QueryLogInterval aghtime.Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats </s> remove want: Duration{Duration: 24 * time.Hour},
</s> add want: aghtime.Duration{Duration: 24 * time.Hour}, </s> remove dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
</s> add dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/config.go |
config.DNS.QueryLogInterval = aghtime.Duration{Duration: 90 * 24 * time.Hour} | <mask> config.WebSessionTTLHours = 30 * 24
<mask>
<mask> config.DNS.QueryLogEnabled = true
<mask> config.DNS.QueryLogFileEnabled = true
<mask> config.DNS.QueryLogInterval = Duration{Duration: 90 * 24 * time.Hour}
<mask> config.DNS.QueryLogMemSize = 1000
<mask>
<mask> config.DNS.CacheSize = 4 * 1024 * 1024
<mask> config.DNS.DnsfilterConf.SafeBrowsingCacheSize = 1 * 1024 * 1024
<mask> config.DNS.DnsfilterConf.SafeSearchCacheSize = 1 * 1024 * 1024
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
</s> add dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} </s> remove want: Duration{Duration: 24 * time.Hour},
</s> add want: aghtime.Duration{Duration: 24 * time.Hour}, </s> remove config.DNS.QueryLogInterval = Duration{Duration: dc.RotationIvl}
</s> add config.DNS.QueryLogInterval = aghtime.Duration{Duration: dc.RotationIvl} </s> remove config.DNS.UpstreamTimeout = Duration{Duration: dnsforward.DefaultTimeout}
</s> add config.DNS.UpstreamTimeout = aghtime.Duration{Duration: dnsforward.DefaultTimeout} </s> remove var ivlVal Duration
ivlVal, ok = ivl.(Duration)
</s> add var ivlVal aghtime.Duration
ivlVal, ok = ivl.(aghtime.Duration) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/config.go |
config.DNS.UpstreamTimeout = aghtime.Duration{Duration: dnsforward.DefaultTimeout} | <mask> config.DNS.FiltersUpdateIntervalHours = 24
<mask> }
<mask>
<mask> if config.DNS.UpstreamTimeout.Duration == 0 {
<mask> config.DNS.UpstreamTimeout = Duration{Duration: dnsforward.DefaultTimeout}
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
</s> add dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} </s> remove config.DNS.QueryLogInterval = Duration{Duration: dc.RotationIvl}
</s> add config.DNS.QueryLogInterval = aghtime.Duration{Duration: dc.RotationIvl} </s> remove config.DNS.QueryLogInterval = Duration{Duration: 90 * 24 * time.Hour}
</s> add config.DNS.QueryLogInterval = aghtime.Duration{Duration: 90 * 24 * time.Hour} </s> remove var ivlVal Duration
ivlVal, ok = ivl.(Duration)
</s> add var ivlVal aghtime.Duration
ivlVal, ok = ivl.(aghtime.Duration) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/config.go |
config.DNS.QueryLogInterval = aghtime.Duration{Duration: dc.RotationIvl} | <mask> dc := querylog.Config{}
<mask> Context.queryLog.WriteDiskConfig(&dc)
<mask> config.DNS.QueryLogEnabled = dc.Enabled
<mask> config.DNS.QueryLogFileEnabled = dc.FileEnabled
<mask> config.DNS.QueryLogInterval = Duration{Duration: dc.RotationIvl}
<mask> config.DNS.QueryLogMemSize = dc.MemSize
<mask> config.DNS.AnonymizeClientIP = dc.AnonymizeClientIP
<mask> }
<mask>
<mask> if Context.dnsFilter != nil {
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove config.DNS.QueryLogInterval = Duration{Duration: 90 * 24 * time.Hour}
</s> add config.DNS.QueryLogInterval = aghtime.Duration{Duration: 90 * 24 * time.Hour} </s> remove config.DNS.UpstreamTimeout = Duration{Duration: dnsforward.DefaultTimeout}
</s> add config.DNS.UpstreamTimeout = aghtime.Duration{Duration: dnsforward.DefaultTimeout} </s> remove dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
</s> add dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} </s> remove var ivlVal Duration
ivlVal, ok = ivl.(Duration)
</s> add var ivlVal aghtime.Duration
ivlVal, ok = ivl.(aghtime.Duration) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/config.go |
"github.com/AdguardTeam/AdGuardHome/internal/aghtime" | <mask> "time"
<mask>
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> "github.com/google/renameio/maybe"
<mask> "golang.org/x/crypto/bcrypt"
<mask> yaml "gopkg.in/yaml.v2"
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove var ivlVal Duration
ivlVal, ok = ivl.(Duration)
</s> add var ivlVal aghtime.Duration
ivlVal, ok = ivl.(aghtime.Duration) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/upgrade.go |
dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} | <mask> return fmt.Errorf("unexpected type of %s: %T", field, qlogIvlVal)
<mask> }
<mask> }
<mask>
<mask> dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
<mask>
<mask> return nil
<mask> }
<mask>
<mask> // TODO(a.garipov): Replace with log.Output when we port it to our logging
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove config.DNS.UpstreamTimeout = Duration{Duration: dnsforward.DefaultTimeout}
</s> add config.DNS.UpstreamTimeout = aghtime.Duration{Duration: dnsforward.DefaultTimeout} </s> remove config.DNS.QueryLogInterval = Duration{Duration: 90 * 24 * time.Hour}
</s> add config.DNS.QueryLogInterval = aghtime.Duration{Duration: 90 * 24 * time.Hour} </s> remove want: Duration{Duration: 24 * time.Hour},
</s> add want: aghtime.Duration{Duration: 24 * time.Hour}, </s> remove config.DNS.QueryLogInterval = Duration{Duration: dc.RotationIvl}
</s> add config.DNS.QueryLogInterval = aghtime.Duration{Duration: dc.RotationIvl} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/upgrade.go |
"github.com/AdguardTeam/AdGuardHome/internal/aghtime" | <mask> "testing"
<mask> "time"
<mask>
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove var ivlVal Duration
ivlVal, ok = ivl.(Duration)
</s> add var ivlVal aghtime.Duration
ivlVal, ok = ivl.(aghtime.Duration) </s> remove QueryLogInterval Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats
</s> add QueryLogInterval aghtime.Duration `yaml:"querylog_interval"`
QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk
AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/upgrade_test.go |
want: aghtime.Duration{Duration: 24 * time.Hour}, | <mask> wantErr string
<mask> name string
<mask> }{{
<mask> ivl: 1,
<mask> want: Duration{Duration: 24 * time.Hour},
<mask> wantErr: "",
<mask> name: "success",
<mask> }, {
<mask> ivl: 0.25,
<mask> want: 0,
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove config.DNS.QueryLogInterval = Duration{Duration: 90 * 24 * time.Hour}
</s> add config.DNS.QueryLogInterval = aghtime.Duration{Duration: 90 * 24 * time.Hour} </s> remove dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
</s> add dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} </s> remove config.DNS.UpstreamTimeout = Duration{Duration: dnsforward.DefaultTimeout}
</s> add config.DNS.UpstreamTimeout = aghtime.Duration{Duration: dnsforward.DefaultTimeout} </s> remove UpstreamTimeout Duration `yaml:"upstream_timeout"`
</s> add UpstreamTimeout aghtime.Duration `yaml:"upstream_timeout"` </s> remove UpstreamTimeout: Duration{Duration: dnsforward.DefaultTimeout},
</s> add UpstreamTimeout: aghtime.Duration{Duration: dnsforward.DefaultTimeout}, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/upgrade_test.go |
var newIvl aghtime.Duration
newIvl, ok = newDNSConf["querylog_interval"].(aghtime.Duration) | <mask> var newDNSConf yobj
<mask> newDNSConf, ok = dnsVal.(yobj)
<mask> require.True(t, ok)
<mask>
<mask> var newIvl Duration
<mask> newIvl, ok = newDNSConf["querylog_interval"].(Duration)
<mask> require.True(t, ok)
<mask>
<mask> assert.Equal(t, tc.want, newIvl)
<mask> })
<mask> }
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove var ivlVal Duration
ivlVal, ok = ivl.(Duration)
</s> add var ivlVal aghtime.Duration
ivlVal, ok = ivl.(aghtime.Duration) </s> remove config.DNS.UpstreamTimeout = Duration{Duration: dnsforward.DefaultTimeout}
</s> add config.DNS.UpstreamTimeout = aghtime.Duration{Duration: dnsforward.DefaultTimeout} </s> remove config.DNS.QueryLogInterval = Duration{Duration: dc.RotationIvl}
</s> add config.DNS.QueryLogInterval = aghtime.Duration{Duration: dc.RotationIvl} </s> remove dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
</s> add dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/upgrade_test.go |
var ivlVal aghtime.Duration
ivlVal, ok = ivl.(aghtime.Duration) | <mask> var ivl interface{}
<mask> ivl, ok = dnsVal["querylog_interval"]
<mask> require.True(t, ok)
<mask>
<mask> var ivlVal Duration
<mask> ivlVal, ok = ivl.(Duration)
<mask> require.True(t, ok)
<mask>
<mask> assert.Equal(t, 90*24*time.Hour, ivlVal.Duration)
<mask> })
<mask> }
</s> Pull request: 1992 configurable timeouts
Merge in DNS/adguard-home from 1992-conf-timeouts to master
Updates #1992.
Squashed commit of the following:
commit 1050c54fb407bec0617728690763b0392b3440b0
Merge: 05f71c3e 59544160
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:04:25 2021 +0300
Merge branch 'master' into 1992-conf-timeouts
commit 05f71c3e5397909d943e69d49a247bf4f67619b0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 20:03:06 2021 +0300
home: use const
commit d0861792b42e6d066aa3ffdb3937e29477235ee0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 19:16:26 2021 +0300
home: fix default timeout
commit ba26fcdcf66366350c89d5a82c4da91ade45838f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Aug 27 16:50:33 2021 +0300
all: mk ping timeout configurable </s> remove var newIvl Duration
newIvl, ok = newDNSConf["querylog_interval"].(Duration)
</s> add var newIvl aghtime.Duration
newIvl, ok = newDNSConf["querylog_interval"].(aghtime.Duration) </s> remove config.DNS.UpstreamTimeout = Duration{Duration: dnsforward.DefaultTimeout}
</s> add config.DNS.UpstreamTimeout = aghtime.Duration{Duration: dnsforward.DefaultTimeout} </s> remove config.DNS.QueryLogInterval = Duration{Duration: dc.RotationIvl}
</s> add config.DNS.QueryLogInterval = aghtime.Duration{Duration: dc.RotationIvl} </s> remove dns[field] = Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour}
</s> add dns[field] = aghtime.Duration{Duration: time.Duration(qlogIvl) * 24 * time.Hour} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e064e0f27786ce941e823c8d52aadb0972319afa | internal/home/upgrade_test.go |
"access_allowed_desc": "A list of CIDRs, IP addresses, or client IDs. If configured, AdGuard Home will accept requests only from these clients.", | <mask> "auto_clients_desc": "Data on the clients that use AdGuard Home, but not stored in the configuration",
<mask> "access_title": "Access settings",
<mask> "access_desc": "Here you can configure access rules for the AdGuard Home DNS server.",
<mask> "access_allowed_title": "Allowed clients",
<mask> "access_allowed_desc": "A list of CIDR or IP addresses. If configured, AdGuard Home will accept requests from these IP addresses only.",
<mask> "access_disallowed_title": "Disallowed clients",
<mask> "access_disallowed_desc": "A list of CIDR or IP addresses. If configured, AdGuard Home will drop requests from these IP addresses.",
<mask> "access_blocked_title": "Disallowed domains",
<mask> "access_blocked_desc": "Not to be confused with filters. AdGuard Home drops DNS queries matching these domains, and these queries don't even appear in the query log. You can specify exact domain names, wildcards, or URL filter rules, e.g. \"example.org\", \"*.example.org\", or \"||example.org^\" correspondingly.",
<mask> "access_settings_saved": "Access settings successfully saved",
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove "access_disallowed_desc": "A list of CIDR or IP addresses. If configured, AdGuard Home will drop requests from these IP addresses.",
</s> add "access_disallowed_desc": "A list of CIDRs, IP addresses, or client IDs. If configured, AdGuard Home will drop requests from these clients. If allowed clients are configured, this field is ignored.", </s> remove https://github.com/AdguardTeam/AdGuardHome/internal/wiki/Getting-Started#running-without-superuser`
</s> add https://github.com/AdguardTeam/AdGuardHome/wiki/Getting-Started#running-without-superuser` </s> remove The rule due to which the client is disallowed. If disallowed is
set to true, and this string is empty, then the client IP is
disallowed by the "allowed IP list", that is it is not included in
the allowed list.
</s> add The rule due to which the client is allowed or blocked. </s> remove // disallowedClients are the IP addresses of clients in the blocklist.
disallowedClients *aghstrings.Set
</s> add blockedHostsEng *urlfilter.DNSEngine </s> remove // /etc/hosts tables, DHCP leases, or blocklists.
func (clients *clientsContainer) findRuntime(ip net.IP, idStr string) (cj clientJSON, found bool) {
if ip == nil {
return cj, false
}
rc, ok := clients.FindRuntimeClient(idStr)
</s> add // /etc/hosts tables, DHCP leases, or blocklists. cj is guaranteed to be
// non-nil.
func (clients *clientsContainer) findRuntime(ip net.IP, idStr string) (cj *clientJSON) {
rc, ok := clients.FindRuntimeClient(ip) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | client/src/__locales/en.json |
"access_disallowed_desc": "A list of CIDRs, IP addresses, or client IDs. If configured, AdGuard Home will drop requests from these clients. If allowed clients are configured, this field is ignored.", | <mask> "access_desc": "Here you can configure access rules for the AdGuard Home DNS server.",
<mask> "access_allowed_title": "Allowed clients",
<mask> "access_allowed_desc": "A list of CIDR or IP addresses. If configured, AdGuard Home will accept requests from these IP addresses only.",
<mask> "access_disallowed_title": "Disallowed clients",
<mask> "access_disallowed_desc": "A list of CIDR or IP addresses. If configured, AdGuard Home will drop requests from these IP addresses.",
<mask> "access_blocked_title": "Disallowed domains",
<mask> "access_blocked_desc": "Not to be confused with filters. AdGuard Home drops DNS queries matching these domains, and these queries don't even appear in the query log. You can specify exact domain names, wildcards, or URL filter rules, e.g. \"example.org\", \"*.example.org\", or \"||example.org^\" correspondingly.",
<mask> "access_settings_saved": "Access settings successfully saved",
<mask> "updates_checked": "Updates successfully checked",
<mask> "updates_version_equal": "AdGuard Home is up-to-date",
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove "access_allowed_desc": "A list of CIDR or IP addresses. If configured, AdGuard Home will accept requests from these IP addresses only.",
</s> add "access_allowed_desc": "A list of CIDRs, IP addresses, or client IDs. If configured, AdGuard Home will accept requests only from these clients.", </s> remove https://github.com/AdguardTeam/AdGuardHome/internal/wiki/Getting-Started#running-without-superuser`
</s> add https://github.com/AdguardTeam/AdGuardHome/wiki/Getting-Started#running-without-superuser` </s> remove The rule due to which the client is disallowed. If disallowed is
set to true, and this string is empty, then the client IP is
disallowed by the "allowed IP list", that is it is not included in
the allowed list.
</s> add The rule due to which the client is allowed or blocked. </s> remove // /etc/hosts tables, DHCP leases, or blocklists.
func (clients *clientsContainer) findRuntime(ip net.IP, idStr string) (cj clientJSON, found bool) {
if ip == nil {
return cj, false
}
rc, ok := clients.FindRuntimeClient(idStr)
</s> add // /etc/hosts tables, DHCP leases, or blocklists. cj is guaranteed to be
// non-nil.
func (clients *clientsContainer) findRuntime(ip net.IP, idStr string) (cj *clientJSON) {
rc, ok := clients.FindRuntimeClient(ip) </s> remove // processClientID extracts the client's ID from the server name of the client's
// DoT or DoQ request or the path of the client's DoH.
func processClientID(dctx *dnsContext) (rc resultCode) {
pctx := dctx.proxyCtx
</s> add // clientIDFromDNSContext extracts the client's ID from the server name of the
// client's DoT or DoQ request or the path of the client's DoH. If the protocol
// is not one of these, clientID is an empty string and err is nil.
func (s *Server) clientIDFromDNSContext(pctx *proxy.DNSContext) (clientID string, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | client/src/__locales/en.json |
import { BLOCK_ACTIONS, STATUS_COLORS } from '../../helpers/constants'; | <mask> import Card from '../ui/Card';
<mask> import Cell from '../ui/Cell';
<mask>
<mask> import { getPercent, sortIp } from '../../helpers/helpers';
<mask> import { BLOCK_ACTIONS, R_CLIENT_ID, STATUS_COLORS } from '../../helpers/constants';
<mask> import { toggleClientBlock } from '../../actions/access';
<mask> import { renderFormattedClientCell } from '../../helpers/renderFormattedClientCell';
<mask> import { getStats } from '../../actions/stats';
<mask>
<mask> const getClientsPercentColor = (percent) => {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove }
</s> add </s> remove log.Debug("Clients: added %d client aliases from system hosts-file", n)
</s> add return true
})
log.Debug("clients: added %d client aliases from system hosts-file", n) </s> remove log.Debug("etchostscontainer: loading hosts from file %s", fn)
</s> add log.Debug("etchosts: loading hosts from file %s", fn) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | client/src/components/Dashboard/Clients.js |
<mask> return <Cell value={value} percent={percent} color={percentColor} search={ip} />;
<mask> };
<mask>
<mask> const renderBlockingButton = (ip, disallowed, disallowed_rule) => {
<mask> if (R_CLIENT_ID.test(ip)) {
<mask> return null;
<mask> }
<mask>
<mask> const dispatch = useDispatch();
<mask> const { t } = useTranslation();
<mask> const processingSet = useSelector((state) => state.access.processingSet);
<mask>
<mask> const buttonClass = classNames('button-action button-action--main', {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove import { BLOCK_ACTIONS, R_CLIENT_ID, STATUS_COLORS } from '../../helpers/constants';
</s> add import { BLOCK_ACTIONS, STATUS_COLORS } from '../../helpers/constants'; </s> remove func (s *Server) setTableIPToHost(t ipToHostTable) {
</s> add func (s *Server) setTableIPToHost(t *aghnet.IPMap) { </s> remove func TestIsBlockedIP(t *testing.T) {
const (
ip int = iota
cidr
)
rules := []string{
ip: "1.1.1.1",
cidr: "2.2.0.0/16",
}
testCases := []struct {
name string
allowed bool
ip net.IP
wantDis bool
wantRule string
}{{
name: "allow_ip",
allowed: true,
ip: net.IPv4(1, 1, 1, 1),
wantDis: false,
wantRule: "",
}, {
name: "disallow_ip",
allowed: true,
ip: net.IPv4(1, 1, 1, 2),
wantDis: true,
wantRule: "",
}, {
name: "allow_cidr",
allowed: true,
ip: net.IPv4(2, 2, 1, 1),
wantDis: false,
wantRule: "",
}, {
name: "disallow_cidr",
allowed: true,
ip: net.IPv4(2, 3, 1, 1),
wantDis: true,
wantRule: "",
}, {
name: "allow_ip",
allowed: false,
ip: net.IPv4(1, 1, 1, 1),
wantDis: true,
wantRule: rules[ip],
}, {
name: "disallow_ip",
allowed: false,
ip: net.IPv4(1, 1, 1, 2),
wantDis: false,
wantRule: "",
}, {
name: "allow_cidr",
allowed: false,
ip: net.IPv4(2, 2, 1, 1),
wantDis: true,
wantRule: rules[cidr],
}, {
name: "disallow_cidr",
allowed: false,
ip: net.IPv4(2, 3, 1, 1),
wantDis: false,
wantRule: "",
}}
for _, tc := range testCases {
prefix := "allowed_"
if !tc.allowed {
prefix = "disallowed_"
}
</s> add func TestIsBlockedClientID(t *testing.T) {
clientID := "client-1"
clients := []string{clientID} </s> remove var found bool
cj, found = clients.findRuntime(ip, idStr)
if !found {
continue
}
</s> add cj = clients.findRuntime(ip, idStr) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | client/src/components/Dashboard/Clients.js | |
github.com/AdguardTeam/dnsproxy v0.38.0 | <mask>
<mask> go 1.16
<mask>
<mask> require (
<mask> github.com/AdguardTeam/dnsproxy v0.37.7
<mask> github.com/AdguardTeam/golibs v0.8.0
<mask> github.com/AdguardTeam/urlfilter v0.14.6
<mask> github.com/NYTimes/gziphandler v1.1.1
<mask> github.com/ameshkov/dnscrypt/v2 v2.1.3
<mask> github.com/digineo/go-ipset/v2 v2.2.1
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove github.com/AdguardTeam/dnsproxy v0.37.7 h1:yp0vEVYobf/1l8iY7es9yMqguw8BUEeC74OGA4G2v2A=
github.com/AdguardTeam/dnsproxy v0.37.7/go.mod h1:xMfevPAwpK1ULoLO0CARg/OiUsPH92kfyliXhPTc62M=
</s> add github.com/AdguardTeam/dnsproxy v0.38.0 h1:7GyyNJOieIVOgdnhu47exqWjHPQro7wQhqzvQjaZt6M=
github.com/AdguardTeam/dnsproxy v0.38.0/go.mod h1:xMfevPAwpK1ULoLO0CARg/OiUsPH92kfyliXhPTc62M= </s> remove func TestIsBlockedIP(t *testing.T) {
const (
ip int = iota
cidr
)
rules := []string{
ip: "1.1.1.1",
cidr: "2.2.0.0/16",
}
testCases := []struct {
name string
allowed bool
ip net.IP
wantDis bool
wantRule string
}{{
name: "allow_ip",
allowed: true,
ip: net.IPv4(1, 1, 1, 1),
wantDis: false,
wantRule: "",
}, {
name: "disallow_ip",
allowed: true,
ip: net.IPv4(1, 1, 1, 2),
wantDis: true,
wantRule: "",
}, {
name: "allow_cidr",
allowed: true,
ip: net.IPv4(2, 2, 1, 1),
wantDis: false,
wantRule: "",
}, {
name: "disallow_cidr",
allowed: true,
ip: net.IPv4(2, 3, 1, 1),
wantDis: true,
wantRule: "",
}, {
name: "allow_ip",
allowed: false,
ip: net.IPv4(1, 1, 1, 1),
wantDis: true,
wantRule: rules[ip],
}, {
name: "disallow_ip",
allowed: false,
ip: net.IPv4(1, 1, 1, 2),
wantDis: false,
wantRule: "",
}, {
name: "allow_cidr",
allowed: false,
ip: net.IPv4(2, 2, 1, 1),
wantDis: true,
wantRule: rules[cidr],
}, {
name: "disallow_cidr",
allowed: false,
ip: net.IPv4(2, 3, 1, 1),
wantDis: false,
wantRule: "",
}}
for _, tc := range testCases {
prefix := "allowed_"
if !tc.allowed {
prefix = "disallowed_"
}
</s> add func TestIsBlockedClientID(t *testing.T) {
clientID := "client-1"
clients := []string{clientID} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | go.mod |
github.com/AdguardTeam/dnsproxy v0.38.0 h1:7GyyNJOieIVOgdnhu47exqWjHPQro7wQhqzvQjaZt6M=
github.com/AdguardTeam/dnsproxy v0.38.0/go.mod h1:xMfevPAwpK1ULoLO0CARg/OiUsPH92kfyliXhPTc62M= | <mask> dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
<mask> git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
<mask> github.com/AdguardTeam/dhcp v0.0.0-20210519141215-51808c73c0bf h1:gc042VRSIRSUzZ+Px6xQCRWNJZTaPkomisDfUZmoFNk=
<mask> github.com/AdguardTeam/dhcp v0.0.0-20210519141215-51808c73c0bf/go.mod h1:TKl4jN3Voofo4UJIicyNhWGp/nlQqQkFxmwIFTvBkKI=
<mask> github.com/AdguardTeam/dnsproxy v0.37.7 h1:yp0vEVYobf/1l8iY7es9yMqguw8BUEeC74OGA4G2v2A=
<mask> github.com/AdguardTeam/dnsproxy v0.37.7/go.mod h1:xMfevPAwpK1ULoLO0CARg/OiUsPH92kfyliXhPTc62M=
<mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.4.4/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.8.0 h1:rHo+yIgT2fivFG0yW2Cwk/DPc2+t/Aw6QvzPpiIFre0=
<mask> github.com/AdguardTeam/golibs v0.8.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove github.com/AdguardTeam/dnsproxy v0.37.7
</s> add github.com/AdguardTeam/dnsproxy v0.38.0 </s> remove 'description': 'Blocklist of hosts.'
</s> add 'description': 'The blocklist of hosts.' </s> remove ctx.err = fmt.Errorf("client id check: invalid path %q: extra parts", origPath)
return resultCodeError
</s> add return "", fmt.Errorf("client id check: invalid path %q: extra parts", origPath) </s> remove // processClientIDHTTPS extracts the client's ID from the path of the
</s> add // clientIDFromDNSContextHTTPS extracts the client's ID from the path of the </s> remove func processClientIDHTTPS(ctx *dnsContext) (rc resultCode) {
pctx := ctx.proxyCtx
</s> add func clientIDFromDNSContextHTTPS(pctx *proxy.DNSContext) (clientID string, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | go.sum |
// tableReverse is the IP-to-hosts map. The type of the values in the
// map is []string.
tableReverse *IPMap | <mask> // lock protects table and tableReverse.
<mask> lock sync.RWMutex
<mask> // table is the host-to-IPs map.
<mask> table map[string][]net.IP
<mask> // tableReverse is the IP-to-hosts map.
<mask> //
<mask> // TODO(a.garipov): Make better use of newtypes. Perhaps a custom map.
<mask> tableReverse map[string][]string
<mask>
<mask> hostsFn string // path to the main hosts-file
<mask> hostsDirs []string // paths to OS-specific directories with hosts-files
<mask> watcher *fsnotify.Watcher // file and directory watcher object
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove list map[string]*Client // name -> client
idIndex map[string]*Client // ID -> client
ipToRC map[string]*RuntimeClient // IP -> runtime client
lock sync.Mutex
</s> add list map[string]*Client // name -> client
idIndex map[string]*Client // ID -> client
// ipToRC is the IP address to *RuntimeClient map.
ipToRC *aghnet.IPMap
lock sync.Mutex </s> remove // ipToHostTable is an alias for the type of Server.tableIPToHost.
//
// TODO(a.garipov): Define an IPMap type in aghnet and use here and in other
// places?
type ipToHostTable = map[string]string
</s> add </s> remove // processClientID extracts the client's ID from the server name of the client's
// DoT or DoQ request or the path of the client's DoH.
func processClientID(dctx *dnsContext) (rc resultCode) {
pctx := dctx.proxyCtx
</s> add // clientIDFromDNSContext extracts the client's ID from the server name of the
// client's DoT or DoQ request or the path of the client's DoH. If the protocol
// is not one of these, clientID is an empty string and err is nil.
func (s *Server) clientIDFromDNSContext(pctx *proxy.DNSContext) (clientID string, err error) { </s> remove // allowedClients are the IP addresses of clients in the allowlist.
allowedClients *aghstrings.Set
</s> add allowedClientIDs *aghstrings.Set
blockedClientIDs *aghstrings.Set | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
log.Error("etchosts: %s", err) | <mask>
<mask> var err error
<mask> ehc.watcher, err = fsnotify.NewWatcher()
<mask> if err != nil {
<mask> log.Error("etchostscontainer: %s", err)
<mask> }
<mask> }
<mask>
<mask> // Start - start module
<mask> func (ehc *EtcHostsContainer) Start() {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove tableRev map[string][]string,
</s> add tableRev *IPMap, </s> remove httpError(r, w, http.StatusInternalServerError, "json.Encode: %s", err)
return
}
}
</s> add httpError(r, w, http.StatusInternalServerError, "encoding response: %s", err) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
log.Debug("etchosts: answer: %s -> %v", host, ipsCopy) | <mask> ipsCopy = make([]net.IP, len(ips))
<mask> copy(ipsCopy, ips)
<mask> }
<mask>
<mask> log.Debug("etchostscontainer: answer: %s -> %v", host, ipsCopy)
<mask> return ipsCopy
<mask> }
<mask>
<mask> // ProcessReverse processes a PTR request. It returns nil if nothing is found.
<mask> func (ehc *EtcHostsContainer) ProcessReverse(addr string, qtype uint16) (hosts []string) {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove log.Debug("etchostscontainer: reverse-lookup: %s -> %s", addr, hosts)
</s> add log.Debug("etchosts: reverse-lookup: %s -> %s", addr, hosts) </s> remove log.Debug("etchostscontainer: added %s -> %s", ipAddr, host)
</s> add log.Debug("etchosts: added %s -> %s", ipAddr, host) </s> remove tableRev[ipStr] = append(tableRev[ipStr], newHost)
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add hosts = append(hosts, newHost)
tableRev.Set(ip, hosts)
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) </s> remove func (ehc *EtcHostsContainer) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) {
ipStr := ipAddr.String()
hosts, ok := tableRev[ipStr]
</s> add func (ehc *EtcHostsContainer) updateTableRev(tableRev *IPMap, newHost string, ip net.IP) {
v, ok := tableRev.Get(ip) </s> remove // List returns an IP-to-hostnames table. It is safe for concurrent use.
func (ehc *EtcHostsContainer) List() (ipToHosts map[string][]string) {
</s> add // List returns an IP-to-hostnames table. The type of the values in the map is
// []string. It is safe for concurrent use.
func (ehc *EtcHostsContainer) List() (ipToHosts *IPMap) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
ip := UnreverseAddr(addr)
if ip == nil { | <mask> if qtype != dns.TypePTR {
<mask> return nil
<mask> }
<mask>
<mask> ipReal := UnreverseAddr(addr)
<mask> if ipReal == nil {
<mask> return nil
<mask> }
<mask>
<mask> ipStr := ipReal.String()
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove ipStr := ipReal.String()
</s> add </s> remove host := ln[:open]
ip := ln[open+2 : close]
if aghnet.ValidateDomainName(host) != nil || net.ParseIP(ip) == nil {
</s> add host := ln[:lparen]
ipStr := ln[lparen+2 : rparen]
ip := net.ParseIP(ipStr)
if aghnet.ValidateDomainName(host) != nil || ip == nil { </s> remove func checkIPCIDRArray(src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
continue
}
_, _, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add return </s> remove return resultCodeSuccess
</s> add return "", nil </s> remove if _, err := upstream.NewResolver(boot, upstream.Options{Timeout: 0}); err != nil {
</s> add if _, err := upstream.NewResolver(boot, nil); err != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
<mask> if ipReal == nil {
<mask> return nil
<mask> }
<mask>
<mask> ipStr := ipReal.String()
<mask>
<mask> ehc.lock.RLock()
<mask> defer ehc.lock.RUnlock()
<mask>
<mask> hosts = ehc.tableReverse[ipStr]
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove ipReal := UnreverseAddr(addr)
if ipReal == nil {
</s> add ip := UnreverseAddr(addr)
if ip == nil { </s> remove hosts = ehc.tableReverse[ipStr]
</s> add v, ok := ehc.tableReverse.Get(ip)
if !ok {
return nil
}
hosts, ok = v.([]string)
if !ok {
log.Error("etchosts: bad type %T in tableReverse for %s", v, ip) </s> remove if len(hosts) == 0 {
return nil // not found
</s> add return nil
} else if len(hosts) == 0 {
return nil </s> remove ipToHosts = make(map[string][]string, len(ehc.tableReverse))
for k, v := range ehc.tableReverse {
ipToHosts[k] = v
}
return ipToHosts
</s> add return ehc.tableReverse.ShallowClone() </s> remove host := ln[:open]
ip := ln[open+2 : close]
if aghnet.ValidateDomainName(host) != nil || net.ParseIP(ip) == nil {
</s> add host := ln[:lparen]
ipStr := ln[lparen+2 : rparen]
ip := net.ParseIP(ipStr)
if aghnet.ValidateDomainName(host) != nil || ip == nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go | |
v, ok := ehc.tableReverse.Get(ip)
if !ok {
return nil
}
hosts, ok = v.([]string)
if !ok {
log.Error("etchosts: bad type %T in tableReverse for %s", v, ip) | <mask>
<mask> ehc.lock.RLock()
<mask> defer ehc.lock.RUnlock()
<mask>
<mask> hosts = ehc.tableReverse[ipStr]
<mask>
<mask> if len(hosts) == 0 {
<mask> return nil // not found
<mask> }
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove if len(hosts) == 0 {
return nil // not found
</s> add return nil
} else if len(hosts) == 0 {
return nil </s> remove ipStr := ipReal.String()
</s> add </s> remove log.Debug("etchostscontainer: reverse-lookup: %s -> %s", addr, hosts)
</s> add log.Debug("etchosts: reverse-lookup: %s -> %s", addr, hosts) </s> remove ipToHosts = make(map[string][]string, len(ehc.tableReverse))
for k, v := range ehc.tableReverse {
ipToHosts[k] = v
}
return ipToHosts
</s> add return ehc.tableReverse.ShallowClone() </s> remove a.lock.Lock()
defer a.lock.Unlock()
</s> add return ok
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
return nil
} else if len(hosts) == 0 {
return nil | <mask> defer ehc.lock.RUnlock()
<mask>
<mask> hosts = ehc.tableReverse[ipStr]
<mask>
<mask> if len(hosts) == 0 {
<mask> return nil // not found
<mask> }
<mask>
<mask> log.Debug("etchostscontainer: reverse-lookup: %s -> %s", addr, hosts)
<mask>
<mask> return hosts
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove log.Debug("etchostscontainer: reverse-lookup: %s -> %s", addr, hosts)
</s> add log.Debug("etchosts: reverse-lookup: %s -> %s", addr, hosts) </s> remove hosts = ehc.tableReverse[ipStr]
</s> add v, ok := ehc.tableReverse.Get(ip)
if !ok {
return nil
}
hosts, ok = v.([]string)
if !ok {
log.Error("etchosts: bad type %T in tableReverse for %s", v, ip) </s> remove ipStr := ipReal.String()
</s> add </s> remove tableRev[ipStr] = append(tableRev[ipStr], newHost)
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add hosts = append(hosts, newHost)
tableRev.Set(ip, hosts)
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) </s> remove tableRev[ipStr] = []string{newHost}
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add tableRev.Set(ip, []string{newHost})
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
log.Debug("etchosts: reverse-lookup: %s -> %s", addr, hosts) | <mask> if len(hosts) == 0 {
<mask> return nil // not found
<mask> }
<mask>
<mask> log.Debug("etchostscontainer: reverse-lookup: %s -> %s", addr, hosts)
<mask>
<mask> return hosts
<mask> }
<mask>
<mask> // List returns an IP-to-hostnames table. It is safe for concurrent use.
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove if len(hosts) == 0 {
return nil // not found
</s> add return nil
} else if len(hosts) == 0 {
return nil </s> remove // List returns an IP-to-hostnames table. It is safe for concurrent use.
func (ehc *EtcHostsContainer) List() (ipToHosts map[string][]string) {
</s> add // List returns an IP-to-hostnames table. The type of the values in the map is
// []string. It is safe for concurrent use.
func (ehc *EtcHostsContainer) List() (ipToHosts *IPMap) { </s> remove hosts = ehc.tableReverse[ipStr]
</s> add v, ok := ehc.tableReverse.Get(ip)
if !ok {
return nil
}
hosts, ok = v.([]string)
if !ok {
log.Error("etchosts: bad type %T in tableReverse for %s", v, ip) </s> remove tableRev[ipStr] = append(tableRev[ipStr], newHost)
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add hosts = append(hosts, newHost)
tableRev.Set(ip, hosts)
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) </s> remove log.Debug("etchostscontainer: answer: %s -> %v", host, ipsCopy)
</s> add log.Debug("etchosts: answer: %s -> %v", host, ipsCopy) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
// List returns an IP-to-hostnames table. The type of the values in the map is
// []string. It is safe for concurrent use.
func (ehc *EtcHostsContainer) List() (ipToHosts *IPMap) { | <mask>
<mask> return hosts
<mask> }
<mask>
<mask> // List returns an IP-to-hostnames table. It is safe for concurrent use.
<mask> func (ehc *EtcHostsContainer) List() (ipToHosts map[string][]string) {
<mask> ehc.lock.RLock()
<mask> defer ehc.lock.RUnlock()
<mask>
<mask> ipToHosts = make(map[string][]string, len(ehc.tableReverse))
<mask> for k, v := range ehc.tableReverse {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove ipToHosts = make(map[string][]string, len(ehc.tableReverse))
for k, v := range ehc.tableReverse {
ipToHosts[k] = v
}
return ipToHosts
</s> add return ehc.tableReverse.ShallowClone() </s> remove log.Debug("etchostscontainer: reverse-lookup: %s -> %s", addr, hosts)
</s> add log.Debug("etchosts: reverse-lookup: %s -> %s", addr, hosts) </s> remove ipStr := ipReal.String()
</s> add </s> remove hosts = ehc.tableReverse[ipStr]
</s> add v, ok := ehc.tableReverse.Get(ip)
if !ok {
return nil
}
hosts, ok = v.([]string)
if !ok {
log.Error("etchosts: bad type %T in tableReverse for %s", v, ip) </s> remove tableRev := make(map[string][]string)
</s> add tableRev := NewIPMap(0) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
return ehc.tableReverse.ShallowClone() | <mask> func (ehc *EtcHostsContainer) List() (ipToHosts map[string][]string) {
<mask> ehc.lock.RLock()
<mask> defer ehc.lock.RUnlock()
<mask>
<mask> ipToHosts = make(map[string][]string, len(ehc.tableReverse))
<mask> for k, v := range ehc.tableReverse {
<mask> ipToHosts[k] = v
<mask> }
<mask>
<mask> return ipToHosts
<mask> }
<mask>
<mask> // update table
<mask> func (ehc *EtcHostsContainer) updateTable(table map[string][]net.IP, host string, ipAddr net.IP) {
<mask> ips, ok := table[host]
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove // List returns an IP-to-hostnames table. It is safe for concurrent use.
func (ehc *EtcHostsContainer) List() (ipToHosts map[string][]string) {
</s> add // List returns an IP-to-hostnames table. The type of the values in the map is
// []string. It is safe for concurrent use.
func (ehc *EtcHostsContainer) List() (ipToHosts *IPMap) { </s> remove func (ehc *EtcHostsContainer) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) {
ipStr := ipAddr.String()
hosts, ok := tableRev[ipStr]
</s> add func (ehc *EtcHostsContainer) updateTableRev(tableRev *IPMap, newHost string, ip net.IP) {
v, ok := tableRev.Get(ip) </s> remove tableRev[ipStr] = []string{newHost}
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add tableRev.Set(ip, []string{newHost})
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) </s> remove log.Debug("etchostscontainer: added %s -> %s", ipAddr, host)
</s> add log.Debug("etchosts: added %s -> %s", ipAddr, host) </s> remove tableRev := make(map[string][]string)
</s> add tableRev := NewIPMap(0) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
log.Debug("etchosts: added %s -> %s", ipAddr, host) | <mask> table[host] = []net.IP{ipAddr}
<mask> ok = true
<mask> }
<mask> if ok {
<mask> log.Debug("etchostscontainer: added %s -> %s", ipAddr, host)
<mask> }
<mask> }
<mask>
<mask> // updateTableRev updates the reverse address table.
<mask> func (ehc *EtcHostsContainer) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove func (ehc *EtcHostsContainer) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) {
ipStr := ipAddr.String()
hosts, ok := tableRev[ipStr]
</s> add func (ehc *EtcHostsContainer) updateTableRev(tableRev *IPMap, newHost string, ip net.IP) {
v, ok := tableRev.Get(ip) </s> remove tableRev[ipStr] = []string{newHost}
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add tableRev.Set(ip, []string{newHost})
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) </s> remove ipToHosts = make(map[string][]string, len(ehc.tableReverse))
for k, v := range ehc.tableReverse {
ipToHosts[k] = v
}
return ipToHosts
</s> add return ehc.tableReverse.ShallowClone() </s> remove tableRev[ipStr] = append(tableRev[ipStr], newHost)
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add hosts = append(hosts, newHost)
tableRev.Set(ip, hosts)
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) </s> remove log.Debug("etchostscontainer: answer: %s -> %v", host, ipsCopy)
</s> add log.Debug("etchosts: answer: %s -> %v", host, ipsCopy) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
func (ehc *EtcHostsContainer) updateTableRev(tableRev *IPMap, newHost string, ip net.IP) {
v, ok := tableRev.Get(ip) | <mask> }
<mask> }
<mask>
<mask> // updateTableRev updates the reverse address table.
<mask> func (ehc *EtcHostsContainer) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) {
<mask> ipStr := ipAddr.String()
<mask> hosts, ok := tableRev[ipStr]
<mask> if !ok {
<mask> tableRev[ipStr] = []string{newHost}
<mask> log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
<mask>
<mask> return
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove tableRev[ipStr] = []string{newHost}
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add tableRev.Set(ip, []string{newHost})
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) </s> remove log.Debug("etchostscontainer: added %s -> %s", ipAddr, host)
</s> add log.Debug("etchosts: added %s -> %s", ipAddr, host) </s> remove tableRev[ipStr] = append(tableRev[ipStr], newHost)
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add hosts = append(hosts, newHost)
tableRev.Set(ip, hosts)
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) </s> remove ipToHosts = make(map[string][]string, len(ehc.tableReverse))
for k, v := range ehc.tableReverse {
ipToHosts[k] = v
}
return ipToHosts
</s> add return ehc.tableReverse.ShallowClone() </s> remove log.Debug("etchostscontainer: answer: %s -> %v", host, ipsCopy)
</s> add log.Debug("etchosts: answer: %s -> %v", host, ipsCopy) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
tableRev.Set(ip, []string{newHost})
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) | <mask> func (ehc *EtcHostsContainer) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) {
<mask> ipStr := ipAddr.String()
<mask> hosts, ok := tableRev[ipStr]
<mask> if !ok {
<mask> tableRev[ipStr] = []string{newHost}
<mask> log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
<mask>
<mask> return
<mask> }
<mask>
<mask> for _, host := range hosts {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove func (ehc *EtcHostsContainer) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) {
ipStr := ipAddr.String()
hosts, ok := tableRev[ipStr]
</s> add func (ehc *EtcHostsContainer) updateTableRev(tableRev *IPMap, newHost string, ip net.IP) {
v, ok := tableRev.Get(ip) </s> remove tableRev[ipStr] = append(tableRev[ipStr], newHost)
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add hosts = append(hosts, newHost)
tableRev.Set(ip, hosts)
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) </s> remove log.Debug("etchostscontainer: added %s -> %s", ipAddr, host)
</s> add log.Debug("etchosts: added %s -> %s", ipAddr, host) </s> remove ipToHosts = make(map[string][]string, len(ehc.tableReverse))
for k, v := range ehc.tableReverse {
ipToHosts[k] = v
}
return ipToHosts
</s> add return ehc.tableReverse.ShallowClone() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
hosts, _ := v.([]string) | <mask>
<mask> return
<mask> }
<mask>
<mask> for _, host := range hosts {
<mask> if host == newHost {
<mask> return
<mask> }
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove tableRev[ipStr] = []string{newHost}
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add tableRev.Set(ip, []string{newHost})
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) </s> remove ok := clients.addHostLocked(ip, name, ClientSourceHostsFile)
</s> add ok = clients.addHostLocked(ip, name, ClientSourceHostsFile) </s> remove if len(d.Req.Question) == 1 {
host := strings.TrimSuffix(d.Req.Question[0].Name, ".")
if s.access.IsBlockedDomain(host) {
log.Tracef("domain %s is blocked by access settings", host)
</s> add if len(pctx.Req.Question) == 1 {
host := strings.TrimSuffix(pctx.Req.Question[0].Name, ".")
if s.access.isBlockedHost(host) {
log.Debug("host %s is in access blocklist", host) </s> remove if len(a.disallowedClientsIPNet) != 0 {
for _, ipnet := range a.disallowedClientsIPNet {
if ipnet.Contains(ip) {
return true, ipnet.String()
}
</s> add for _, ipnet := range ipnets {
if ipnet.Contains(ip) {
return blocked, ipnet.String() </s> remove host := ln[:open]
ip := ln[open+2 : close]
if aghnet.ValidateDomainName(host) != nil || net.ParseIP(ip) == nil {
</s> add host := ln[:lparen]
ipStr := ln[lparen+2 : rparen]
ip := net.ParseIP(ipStr)
if aghnet.ValidateDomainName(host) != nil || ip == nil { | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
hosts = append(hosts, newHost)
tableRev.Set(ip, hosts)
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) | <mask> return
<mask> }
<mask> }
<mask>
<mask> tableRev[ipStr] = append(tableRev[ipStr], newHost)
<mask> log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
<mask> }
<mask>
<mask> // parseHostsLine parses hosts from the fields.
<mask> func parseHostsLine(fields []string) (hosts []string) {
<mask> for _, f := range fields {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove tableRev[ipStr] = []string{newHost}
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add tableRev.Set(ip, []string{newHost})
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) </s> remove func (ehc *EtcHostsContainer) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) {
ipStr := ipAddr.String()
hosts, ok := tableRev[ipStr]
</s> add func (ehc *EtcHostsContainer) updateTableRev(tableRev *IPMap, newHost string, ip net.IP) {
v, ok := tableRev.Get(ip) </s> remove log.Debug("etchostscontainer: added %s -> %s", ipAddr, host)
</s> add log.Debug("etchosts: added %s -> %s", ipAddr, host) </s> remove log.Debug("etchostscontainer: answer: %s -> %v", host, ipsCopy)
</s> add log.Debug("etchosts: answer: %s -> %v", host, ipsCopy) </s> remove log.Debug("etchostscontainer: loading hosts from file %s", fn)
</s> add log.Debug("etchosts: loading hosts from file %s", fn) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
tableRev *IPMap, | <mask> // load reads IP-hostname pairs from the hosts file. Multiple hostnames per
<mask> // line for one IP are supported.
<mask> func (ehc *EtcHostsContainer) load(
<mask> table map[string][]net.IP,
<mask> tableRev map[string][]string,
<mask> fn string,
<mask> ) {
<mask> f, err := os.Open(fn)
<mask> if err != nil {
<mask> log.Error("etchostscontainer: %s", err)
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove tableRev := make(map[string][]string)
</s> add tableRev := NewIPMap(0) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove ipToHosts = make(map[string][]string, len(ehc.tableReverse))
for k, v := range ehc.tableReverse {
ipToHosts[k] = v
}
return ipToHosts
</s> add return ehc.tableReverse.ShallowClone() </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
log.Error("etchosts: %s", err) | <mask> fn string,
<mask> ) {
<mask> f, err := os.Open(fn)
<mask> if err != nil {
<mask> log.Error("etchostscontainer: %s", err)
<mask>
<mask> return
<mask> }
<mask>
<mask> defer func() {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove tableRev map[string][]string,
</s> add tableRev *IPMap, </s> remove log.Error("etchostscontainer: closing file: %s", err)
</s> add log.Error("etchosts: closing file: %s", err) </s> remove log.Error("etchostscontainer: Opening directory: %q: %s", dir, err)
</s> add log.Error("etchosts: Opening directory: %q: %s", dir, err) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
log.Error("etchosts: closing file: %s", err) | <mask>
<mask> defer func() {
<mask> derr := f.Close()
<mask> if derr != nil {
<mask> log.Error("etchostscontainer: closing file: %s", err)
<mask> }
<mask> }()
<mask>
<mask> log.Debug("etchostscontainer: loading hosts from file %s", fn)
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove log.Debug("etchostscontainer: loading hosts from file %s", fn)
</s> add log.Debug("etchosts: loading hosts from file %s", fn) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove log.Error("etchostscontainer: Opening directory: %q: %s", dir, err)
</s> add log.Error("etchosts: Opening directory: %q: %s", dir, err) </s> remove if len(hosts) == 0 {
return nil // not found
</s> add return nil
} else if len(hosts) == 0 {
return nil | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
log.Debug("etchosts: loading hosts from file %s", fn) | <mask> log.Error("etchostscontainer: closing file: %s", err)
<mask> }
<mask> }()
<mask>
<mask> log.Debug("etchostscontainer: loading hosts from file %s", fn)
<mask>
<mask> s := bufio.NewScanner(f)
<mask> for s.Scan() {
<mask> line := strings.TrimSpace(s.Text())
<mask> fields := strings.Fields(line)
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove log.Error("etchostscontainer: closing file: %s", err)
</s> add log.Error("etchosts: closing file: %s", err) </s> remove tableRev[ipStr] = append(tableRev[ipStr], newHost)
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add hosts = append(hosts, newHost)
tableRev.Set(ip, hosts)
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove tableRev map[string][]string,
</s> add tableRev *IPMap, </s> remove log.Error("etchostscontainer: Opening directory: %q: %s", dir, err)
</s> add log.Error("etchosts: Opening directory: %q: %s", dir, err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
log.Error("etchosts: %s", err) | <mask> }
<mask>
<mask> err = s.Err()
<mask> if err != nil {
<mask> log.Error("etchostscontainer: %s", err)
<mask> }
<mask> }
<mask>
<mask> // onlyWrites is a filter for (*fsnotify.Watcher).Events.
<mask> func (ehc *EtcHostsContainer) onlyWrites() {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove log.Error("etchostscontainer: Opening directory: %q: %s", dir, err)
</s> add log.Error("etchosts: Opening directory: %q: %s", dir, err) </s> remove tableRev map[string][]string,
</s> add tableRev *IPMap, </s> remove err = checkIPCIDRArray(j.AllowedClients)
if err == nil {
err = checkIPCIDRArray(j.DisallowedClients)
}
if err != nil {
httpError(r, w, http.StatusBadRequest, "%s", err)
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
log.Debug("etchosts: modified: %s", event.Name) | <mask> }
<mask> }
<mask>
<mask> if event.Op&fsnotify.Write == fsnotify.Write {
<mask> log.Debug("etchostscontainer: modified: %s", event.Name)
<mask> ehc.updateHosts()
<mask> }
<mask>
<mask> case err, ok := <-ehc.watcher.Errors:
<mask> if !ok {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove hosts = ehc.tableReverse[ipStr]
</s> add v, ok := ehc.tableReverse.Get(ip)
if !ok {
return nil
}
hosts, ok = v.([]string)
if !ok {
log.Error("etchosts: bad type %T in tableReverse for %s", v, ip) </s> remove } else if proto == proxy.ProtoQUIC {
</s> add case proxy.ProtoQUIC: </s> remove func (ehc *EtcHostsContainer) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) {
ipStr := ipAddr.String()
hosts, ok := tableRev[ipStr]
</s> add func (ehc *EtcHostsContainer) updateTableRev(tableRev *IPMap, newHost string, ip net.IP) {
v, ok := tableRev.Get(ip) </s> remove if proto == proxy.ProtoTLS {
</s> add switch proto {
case proxy.ProtoTLS: | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
log.Error("etchosts: %s", err) | <mask> case err, ok := <-ehc.watcher.Errors:
<mask> if !ok {
<mask> return
<mask> }
<mask> log.Error("etchostscontainer: %s", err)
<mask> }
<mask> }
<mask> }
<mask>
<mask> // updateHosts - loads system hosts
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove log.Debug("etchostscontainer: modified: %s", event.Name)
</s> add log.Debug("etchosts: modified: %s", event.Name) </s> remove tableRev := make(map[string][]string)
</s> add tableRev := NewIPMap(0) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove hosts = ehc.tableReverse[ipStr]
</s> add v, ok := ehc.tableReverse.Get(ip)
if !ok {
return nil
}
hosts, ok = v.([]string)
if !ok {
log.Error("etchosts: bad type %T in tableReverse for %s", v, ip) </s> remove log.Debug("etchostscontainer: loading hosts from file %s", fn)
</s> add log.Debug("etchosts: loading hosts from file %s", fn) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
tableRev := NewIPMap(0) | <mask>
<mask> // updateHosts - loads system hosts
<mask> func (ehc *EtcHostsContainer) updateHosts() {
<mask> table := make(map[string][]net.IP)
<mask> tableRev := make(map[string][]string)
<mask>
<mask> ehc.load(table, tableRev, ehc.hostsFn)
<mask>
<mask> for _, dir := range ehc.hostsDirs {
<mask> des, err := os.ReadDir(dir)
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove log.Error("etchostscontainer: Opening directory: %q: %s", dir, err)
</s> add log.Error("etchosts: Opening directory: %q: %s", dir, err) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove tableRev map[string][]string,
</s> add tableRev *IPMap, </s> remove ipToHosts = make(map[string][]string, len(ehc.tableReverse))
for k, v := range ehc.tableReverse {
ipToHosts[k] = v
}
return ipToHosts
</s> add return ehc.tableReverse.ShallowClone() </s> remove tableRev[ipStr] = []string{newHost}
log.Debug("etchostscontainer: added reverse-address %s -> %s", ipStr, newHost)
</s> add tableRev.Set(ip, []string{newHost})
log.Debug("etchosts: added reverse-address %s -> %s", ip, newHost) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
log.Error("etchosts: Opening directory: %q: %s", dir, err) | <mask> for _, dir := range ehc.hostsDirs {
<mask> des, err := os.ReadDir(dir)
<mask> if err != nil {
<mask> if !errors.Is(err, os.ErrNotExist) {
<mask> log.Error("etchostscontainer: Opening directory: %q: %s", dir, err)
<mask> }
<mask>
<mask> continue
<mask> }
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove tableRev := make(map[string][]string)
</s> add tableRev := NewIPMap(0) </s> remove func checkIPCIDRArray(src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
continue
}
_, _, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add return </s> remove httpError(r, w, http.StatusInternalServerError, "json.Encode: %s", err)
return
}
}
</s> add httpError(r, w, http.StatusInternalServerError, "encoding response: %s", err) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer.go |
names, ok := ehc.List().Get(net.IP{127, 0, 0, 1}) | <mask> assert.Nil(t, ips)
<mask> })
<mask>
<mask> t.Run("hosts_file", func(t *testing.T) {
<mask> names, ok := ehc.List()["127.0.0.1"]
<mask> require.True(t, ok)
<mask> assert.Equal(t, []string{"host", "localhost"}, names)
<mask> })
<mask>
<mask> t.Run("ptr", func(t *testing.T) {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove assert.False(t, clients.Exists("1.1.1.2", ClientSourceHostsFile))
</s> add assert.False(t, clients.Exists(net.IP{1, 1, 1, 2}, ClientSourceHostsFile)) </s> remove require.NotNil(t, clients.ipToRC["1.1.1.1"])
h := clients.ipToRC["1.1.1.1"]
require.NotNil(t, h)
</s> add rc, ok := v.(*RuntimeClient)
require.True(t, ok)
require.NotNil(t, rc) </s> remove h := clients.ipToRC["1.1.1.255"]
require.NotNil(t, h)
</s> add rc, ok := v.(*RuntimeClient)
require.True(t, ok)
require.NotNil(t, rc) </s> remove assert.Equal(t, tc.want, aCtx.IsBlockedDomain(tc.domain))
</s> add assert.Equal(t, tc.want, a.isBlockedHost(tc.host)) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/aghnet/etchostscontainer_test.go |
<mask> "fmt"
<mask> "net"
<mask> "net/http"
<mask> "strings"
<mask> "sync"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/urlfilter"
<mask> "github.com/AdguardTeam/urlfilter/filterlist"
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go | |
"github.com/AdguardTeam/AdGuardHome/internal/aghnet" | <mask> "net/http"
<mask> "strings"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/urlfilter"
<mask> "github.com/AdguardTeam/urlfilter/filterlist"
<mask> )
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove "sync"
</s> add </s> remove lock sync.Mutex
</s> add allowedIPs *aghnet.IPMap
blockedIPs *aghnet.IPMap | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
// accessCtx controls IP and client blocking that takes place before all other
// processing. An accessCtx is safe for concurrent use. | <mask> "github.com/AdguardTeam/urlfilter/filterlist"
<mask> )
<mask>
<mask> type accessCtx struct {
<mask> allowedIPs *aghnet.IPMap
<mask> blockedIPs *aghnet.IPMap
<mask>
<mask> allowedClientIDs *aghstrings.Set
<mask> blockedClientIDs *aghstrings.Set
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove lock sync.Mutex
</s> add allowedIPs *aghnet.IPMap
blockedIPs *aghnet.IPMap </s> remove // allowedClients are the IP addresses of clients in the allowlist.
allowedClients *aghstrings.Set
</s> add allowedClientIDs *aghstrings.Set
blockedClientIDs *aghstrings.Set </s> remove list map[string]*Client // name -> client
idIndex map[string]*Client // ID -> client
ipToRC map[string]*RuntimeClient // IP -> runtime client
lock sync.Mutex
</s> add list map[string]*Client // name -> client
idIndex map[string]*Client // ID -> client
// ipToRC is the IP address to *RuntimeClient map.
ipToRC *aghnet.IPMap
lock sync.Mutex </s> remove IP string `json:"ip"`
</s> add </s> remove var ipToHost ipToHostTable
</s> add var ipToHost *aghnet.IPMap | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
allowedIPs *aghnet.IPMap
blockedIPs *aghnet.IPMap | <mask> "github.com/AdguardTeam/urlfilter/filterlist"
<mask> )
<mask>
<mask> type accessCtx struct {
<mask> lock sync.Mutex
<mask>
<mask> // allowedClients are the IP addresses of clients in the allowlist.
<mask> allowedClients *aghstrings.Set
<mask>
<mask> // disallowedClients are the IP addresses of clients in the blocklist.
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove // allowedClients are the IP addresses of clients in the allowlist.
allowedClients *aghstrings.Set
</s> add allowedClientIDs *aghstrings.Set
blockedClientIDs *aghstrings.Set </s> remove // disallowedClients are the IP addresses of clients in the blocklist.
disallowedClients *aghstrings.Set
</s> add blockedHostsEng *urlfilter.DNSEngine </s> remove list map[string]*Client // name -> client
idIndex map[string]*Client // ID -> client
ipToRC map[string]*RuntimeClient // IP -> runtime client
lock sync.Mutex
</s> add list map[string]*Client // name -> client
idIndex map[string]*Client // ID -> client
// ipToRC is the IP address to *RuntimeClient map.
ipToRC *aghnet.IPMap
lock sync.Mutex </s> remove allowedClientsIPNet []net.IPNet // CIDRs of whitelist clients
disallowedClientsIPNet []net.IPNet // CIDRs of clients that should be blocked
</s> add // TODO(a.garipov): Create a type for a set of IP networks.
// aghnet.IPNetSet?
allowedNets []*net.IPNet
blockedNets []*net.IPNet
}
// unit is a convenient alias for struct{}
type unit = struct{}
// processAccessClients is a helper for processing a list of client strings,
// which may be an IP address, a CIDR, or a ClientID.
func processAccessClients(
clientStrs []string,
ips *aghnet.IPMap,
nets *[]*net.IPNet,
clientIDs *aghstrings.Set,
) (err error) {
for i, s := range clientStrs {
if ip := net.ParseIP(s); ip != nil {
ips.Set(ip, unit{})
} else if cidrIP, ipnet, cidrErr := net.ParseCIDR(s); cidrErr == nil {
ipnet.IP = cidrIP
*nets = append(*nets, ipnet)
} else {
idErr := ValidateClientID(s)
if idErr != nil {
return fmt.Errorf(
"value %q at index %d: bad ip, cidr, or clientid",
s,
i,
)
}
clientIDs.Add(s)
}
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
allowedClientIDs *aghstrings.Set
blockedClientIDs *aghstrings.Set | <mask>
<mask> type accessCtx struct {
<mask> lock sync.Mutex
<mask>
<mask> // allowedClients are the IP addresses of clients in the allowlist.
<mask> allowedClients *aghstrings.Set
<mask>
<mask> // disallowedClients are the IP addresses of clients in the blocklist.
<mask> disallowedClients *aghstrings.Set
<mask>
<mask> allowedClientsIPNet []net.IPNet // CIDRs of whitelist clients
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove lock sync.Mutex
</s> add allowedIPs *aghnet.IPMap
blockedIPs *aghnet.IPMap </s> remove // disallowedClients are the IP addresses of clients in the blocklist.
disallowedClients *aghstrings.Set
</s> add blockedHostsEng *urlfilter.DNSEngine </s> remove allowedClientsIPNet []net.IPNet // CIDRs of whitelist clients
disallowedClientsIPNet []net.IPNet // CIDRs of clients that should be blocked
</s> add // TODO(a.garipov): Create a type for a set of IP networks.
// aghnet.IPNetSet?
allowedNets []*net.IPNet
blockedNets []*net.IPNet
}
// unit is a convenient alias for struct{}
type unit = struct{}
// processAccessClients is a helper for processing a list of client strings,
// which may be an IP address, a CIDR, or a ClientID.
func processAccessClients(
clientStrs []string,
ips *aghnet.IPMap,
nets *[]*net.IPNet,
clientIDs *aghstrings.Set,
) (err error) {
for i, s := range clientStrs {
if ip := net.ParseIP(s); ip != nil {
ips.Set(ip, unit{})
} else if cidrIP, ipnet, cidrErr := net.ParseCIDR(s); cidrErr == nil {
ipnet.IP = cidrIP
*nets = append(*nets, ipnet)
} else {
idErr := ValidateClientID(s)
if idErr != nil {
return fmt.Errorf(
"value %q at index %d: bad ip, cidr, or clientid",
s,
i,
)
}
clientIDs.Add(s)
}
} </s> remove list map[string]*Client // name -> client
idIndex map[string]*Client // ID -> client
ipToRC map[string]*RuntimeClient // IP -> runtime client
lock sync.Mutex
</s> add list map[string]*Client // name -> client
idIndex map[string]*Client // ID -> client
// ipToRC is the IP address to *RuntimeClient map.
ipToRC *aghnet.IPMap
lock sync.Mutex </s> remove blockedHostsEngine *urlfilter.DNSEngine // finds hosts that should be blocked
</s> add return nil | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
blockedHostsEng *urlfilter.DNSEngine | <mask>
<mask> // allowedClients are the IP addresses of clients in the allowlist.
<mask> allowedClients *aghstrings.Set
<mask>
<mask> // disallowedClients are the IP addresses of clients in the blocklist.
<mask> disallowedClients *aghstrings.Set
<mask>
<mask> allowedClientsIPNet []net.IPNet // CIDRs of whitelist clients
<mask> disallowedClientsIPNet []net.IPNet // CIDRs of clients that should be blocked
<mask>
<mask> blockedHostsEngine *urlfilter.DNSEngine // finds hosts that should be blocked
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove // allowedClients are the IP addresses of clients in the allowlist.
allowedClients *aghstrings.Set
</s> add allowedClientIDs *aghstrings.Set
blockedClientIDs *aghstrings.Set </s> remove lock sync.Mutex
</s> add allowedIPs *aghnet.IPMap
blockedIPs *aghnet.IPMap </s> remove blockedHostsEngine *urlfilter.DNSEngine // finds hosts that should be blocked
</s> add return nil </s> remove allowedClientsIPNet []net.IPNet // CIDRs of whitelist clients
disallowedClientsIPNet []net.IPNet // CIDRs of clients that should be blocked
</s> add // TODO(a.garipov): Create a type for a set of IP networks.
// aghnet.IPNetSet?
allowedNets []*net.IPNet
blockedNets []*net.IPNet
}
// unit is a convenient alias for struct{}
type unit = struct{}
// processAccessClients is a helper for processing a list of client strings,
// which may be an IP address, a CIDR, or a ClientID.
func processAccessClients(
clientStrs []string,
ips *aghnet.IPMap,
nets *[]*net.IPNet,
clientIDs *aghstrings.Set,
) (err error) {
for i, s := range clientStrs {
if ip := net.ParseIP(s); ip != nil {
ips.Set(ip, unit{})
} else if cidrIP, ipnet, cidrErr := net.ParseCIDR(s); cidrErr == nil {
ipnet.IP = cidrIP
*nets = append(*nets, ipnet)
} else {
idErr := ValidateClientID(s)
if idErr != nil {
return fmt.Errorf(
"value %q at index %d: bad ip, cidr, or clientid",
s,
i,
)
}
clientIDs.Add(s)
}
} </s> remove list map[string]*Client // name -> client
idIndex map[string]*Client // ID -> client
ipToRC map[string]*RuntimeClient // IP -> runtime client
lock sync.Mutex
</s> add list map[string]*Client // name -> client
idIndex map[string]*Client // ID -> client
// ipToRC is the IP address to *RuntimeClient map.
ipToRC *aghnet.IPMap
lock sync.Mutex | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
// TODO(a.garipov): Create a type for a set of IP networks.
// aghnet.IPNetSet?
allowedNets []*net.IPNet
blockedNets []*net.IPNet
}
// unit is a convenient alias for struct{}
type unit = struct{}
// processAccessClients is a helper for processing a list of client strings,
// which may be an IP address, a CIDR, or a ClientID.
func processAccessClients(
clientStrs []string,
ips *aghnet.IPMap,
nets *[]*net.IPNet,
clientIDs *aghstrings.Set,
) (err error) {
for i, s := range clientStrs {
if ip := net.ParseIP(s); ip != nil {
ips.Set(ip, unit{})
} else if cidrIP, ipnet, cidrErr := net.ParseCIDR(s); cidrErr == nil {
ipnet.IP = cidrIP
*nets = append(*nets, ipnet)
} else {
idErr := ValidateClientID(s)
if idErr != nil {
return fmt.Errorf(
"value %q at index %d: bad ip, cidr, or clientid",
s,
i,
)
}
clientIDs.Add(s)
}
} | <mask>
<mask> // disallowedClients are the IP addresses of clients in the blocklist.
<mask> disallowedClients *aghstrings.Set
<mask>
<mask> allowedClientsIPNet []net.IPNet // CIDRs of whitelist clients
<mask> disallowedClientsIPNet []net.IPNet // CIDRs of clients that should be blocked
<mask>
<mask> blockedHostsEngine *urlfilter.DNSEngine // finds hosts that should be blocked
<mask> }
<mask>
<mask> func newAccessCtx(allowedClients, disallowedClients, blockedHosts []string) (a *accessCtx, err error) {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove // disallowedClients are the IP addresses of clients in the blocklist.
disallowedClients *aghstrings.Set
</s> add blockedHostsEng *urlfilter.DNSEngine </s> remove blockedHostsEngine *urlfilter.DNSEngine // finds hosts that should be blocked
</s> add return nil </s> remove // allowedClients are the IP addresses of clients in the allowlist.
allowedClients *aghstrings.Set
</s> add allowedClientIDs *aghstrings.Set
blockedClientIDs *aghstrings.Set </s> remove func newAccessCtx(allowedClients, disallowedClients, blockedHosts []string) (a *accessCtx, err error) {
</s> add // newAccessCtx creates a new accessCtx.
func newAccessCtx(allowed, blocked, blockedHosts []string) (a *accessCtx, err error) { </s> remove lock sync.Mutex
</s> add allowedIPs *aghnet.IPMap
blockedIPs *aghnet.IPMap | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
return nil | <mask>
<mask> allowedClientsIPNet []net.IPNet // CIDRs of whitelist clients
<mask> disallowedClientsIPNet []net.IPNet // CIDRs of clients that should be blocked
<mask>
<mask> blockedHostsEngine *urlfilter.DNSEngine // finds hosts that should be blocked
<mask> }
<mask>
<mask> func newAccessCtx(allowedClients, disallowedClients, blockedHosts []string) (a *accessCtx, err error) {
<mask> a = &accessCtx{
<mask> allowedClients: aghstrings.NewSet(),
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove // disallowedClients are the IP addresses of clients in the blocklist.
disallowedClients *aghstrings.Set
</s> add blockedHostsEng *urlfilter.DNSEngine </s> remove func newAccessCtx(allowedClients, disallowedClients, blockedHosts []string) (a *accessCtx, err error) {
</s> add // newAccessCtx creates a new accessCtx.
func newAccessCtx(allowed, blocked, blockedHosts []string) (a *accessCtx, err error) { </s> remove allowedClientsIPNet []net.IPNet // CIDRs of whitelist clients
disallowedClientsIPNet []net.IPNet // CIDRs of clients that should be blocked
</s> add // TODO(a.garipov): Create a type for a set of IP networks.
// aghnet.IPNetSet?
allowedNets []*net.IPNet
blockedNets []*net.IPNet
}
// unit is a convenient alias for struct{}
type unit = struct{}
// processAccessClients is a helper for processing a list of client strings,
// which may be an IP address, a CIDR, or a ClientID.
func processAccessClients(
clientStrs []string,
ips *aghnet.IPMap,
nets *[]*net.IPNet,
clientIDs *aghstrings.Set,
) (err error) {
for i, s := range clientStrs {
if ip := net.ParseIP(s); ip != nil {
ips.Set(ip, unit{})
} else if cidrIP, ipnet, cidrErr := net.ParseCIDR(s); cidrErr == nil {
ipnet.IP = cidrIP
*nets = append(*nets, ipnet)
} else {
idErr := ValidateClientID(s)
if idErr != nil {
return fmt.Errorf(
"value %q at index %d: bad ip, cidr, or clientid",
s,
i,
)
}
clientIDs.Add(s)
}
} </s> remove allowedClients: aghstrings.NewSet(),
disallowedClients: aghstrings.NewSet(),
</s> add allowedIPs: aghnet.NewIPMap(0),
blockedIPs: aghnet.NewIPMap(0),
allowedClientIDs: aghstrings.NewSet(),
blockedClientIDs: aghstrings.NewSet(), </s> remove // allowedClients are the IP addresses of clients in the allowlist.
allowedClients *aghstrings.Set
</s> add allowedClientIDs *aghstrings.Set
blockedClientIDs *aghstrings.Set | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
// newAccessCtx creates a new accessCtx.
func newAccessCtx(allowed, blocked, blockedHosts []string) (a *accessCtx, err error) { | <mask>
<mask> blockedHostsEngine *urlfilter.DNSEngine // finds hosts that should be blocked
<mask> }
<mask>
<mask> func newAccessCtx(allowedClients, disallowedClients, blockedHosts []string) (a *accessCtx, err error) {
<mask> a = &accessCtx{
<mask> allowedClients: aghstrings.NewSet(),
<mask> disallowedClients: aghstrings.NewSet(),
<mask> }
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove blockedHostsEngine *urlfilter.DNSEngine // finds hosts that should be blocked
</s> add return nil </s> remove allowedClients: aghstrings.NewSet(),
disallowedClients: aghstrings.NewSet(),
</s> add allowedIPs: aghnet.NewIPMap(0),
blockedIPs: aghnet.NewIPMap(0),
allowedClientIDs: aghstrings.NewSet(),
blockedClientIDs: aghstrings.NewSet(), </s> remove allowedClientsIPNet []net.IPNet // CIDRs of whitelist clients
disallowedClientsIPNet []net.IPNet // CIDRs of clients that should be blocked
</s> add // TODO(a.garipov): Create a type for a set of IP networks.
// aghnet.IPNetSet?
allowedNets []*net.IPNet
blockedNets []*net.IPNet
}
// unit is a convenient alias for struct{}
type unit = struct{}
// processAccessClients is a helper for processing a list of client strings,
// which may be an IP address, a CIDR, or a ClientID.
func processAccessClients(
clientStrs []string,
ips *aghnet.IPMap,
nets *[]*net.IPNet,
clientIDs *aghstrings.Set,
) (err error) {
for i, s := range clientStrs {
if ip := net.ParseIP(s); ip != nil {
ips.Set(ip, unit{})
} else if cidrIP, ipnet, cidrErr := net.ParseCIDR(s); cidrErr == nil {
ipnet.IP = cidrIP
*nets = append(*nets, ipnet)
} else {
idErr := ValidateClientID(s)
if idErr != nil {
return fmt.Errorf(
"value %q at index %d: bad ip, cidr, or clientid",
s,
i,
)
}
clientIDs.Add(s)
}
} </s> remove // disallowedClients are the IP addresses of clients in the blocklist.
disallowedClients *aghstrings.Set
</s> add blockedHostsEng *urlfilter.DNSEngine </s> remove err = processIPCIDRArray(a.allowedClients, &a.allowedClientsIPNet, allowedClients)
</s> add err = processAccessClients(allowed, a.allowedIPs, &a.allowedNets, a.allowedClientIDs) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
allowedIPs: aghnet.NewIPMap(0),
blockedIPs: aghnet.NewIPMap(0),
allowedClientIDs: aghstrings.NewSet(),
blockedClientIDs: aghstrings.NewSet(), | <mask> }
<mask>
<mask> func newAccessCtx(allowedClients, disallowedClients, blockedHosts []string) (a *accessCtx, err error) {
<mask> a = &accessCtx{
<mask> allowedClients: aghstrings.NewSet(),
<mask> disallowedClients: aghstrings.NewSet(),
<mask> }
<mask>
<mask> err = processIPCIDRArray(a.allowedClients, &a.allowedClientsIPNet, allowedClients)
<mask> if err != nil {
<mask> return nil, fmt.Errorf("processing allowed clients: %w", err)
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove func newAccessCtx(allowedClients, disallowedClients, blockedHosts []string) (a *accessCtx, err error) {
</s> add // newAccessCtx creates a new accessCtx.
func newAccessCtx(allowed, blocked, blockedHosts []string) (a *accessCtx, err error) { </s> remove err = processIPCIDRArray(a.allowedClients, &a.allowedClientsIPNet, allowedClients)
</s> add err = processAccessClients(allowed, a.allowedIPs, &a.allowedNets, a.allowedClientIDs) </s> remove return nil, fmt.Errorf("processing allowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding allowed: %w", err) </s> remove blockedHostsEngine *urlfilter.DNSEngine // finds hosts that should be blocked
</s> add return nil </s> remove err = processIPCIDRArray(a.disallowedClients, &a.disallowedClientsIPNet, disallowedClients)
</s> add err = processAccessClients(blocked, a.blockedIPs, &a.blockedNets, a.blockedClientIDs) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
err = processAccessClients(allowed, a.allowedIPs, &a.allowedNets, a.allowedClientIDs) | <mask> allowedClients: aghstrings.NewSet(),
<mask> disallowedClients: aghstrings.NewSet(),
<mask> }
<mask>
<mask> err = processIPCIDRArray(a.allowedClients, &a.allowedClientsIPNet, allowedClients)
<mask> if err != nil {
<mask> return nil, fmt.Errorf("processing allowed clients: %w", err)
<mask> }
<mask>
<mask> err = processIPCIDRArray(a.disallowedClients, &a.disallowedClientsIPNet, disallowedClients)
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove return nil, fmt.Errorf("processing allowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding allowed: %w", err) </s> remove allowedClients: aghstrings.NewSet(),
disallowedClients: aghstrings.NewSet(),
</s> add allowedIPs: aghnet.NewIPMap(0),
blockedIPs: aghnet.NewIPMap(0),
allowedClientIDs: aghstrings.NewSet(),
blockedClientIDs: aghstrings.NewSet(), </s> remove err = processIPCIDRArray(a.disallowedClients, &a.disallowedClientsIPNet, disallowedClients)
</s> add err = processAccessClients(blocked, a.blockedIPs, &a.blockedNets, a.blockedClientIDs) </s> remove return nil, fmt.Errorf("processing disallowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding blocked: %w", err) </s> remove func newAccessCtx(allowedClients, disallowedClients, blockedHosts []string) (a *accessCtx, err error) {
</s> add // newAccessCtx creates a new accessCtx.
func newAccessCtx(allowed, blocked, blockedHosts []string) (a *accessCtx, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
return nil, fmt.Errorf("adding allowed: %w", err) | <mask> }
<mask>
<mask> err = processIPCIDRArray(a.allowedClients, &a.allowedClientsIPNet, allowedClients)
<mask> if err != nil {
<mask> return nil, fmt.Errorf("processing allowed clients: %w", err)
<mask> }
<mask>
<mask> err = processIPCIDRArray(a.disallowedClients, &a.disallowedClientsIPNet, disallowedClients)
<mask> if err != nil {
<mask> return nil, fmt.Errorf("processing disallowed clients: %w", err)
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove err = processIPCIDRArray(a.disallowedClients, &a.disallowedClientsIPNet, disallowedClients)
</s> add err = processAccessClients(blocked, a.blockedIPs, &a.blockedNets, a.blockedClientIDs) </s> remove err = processIPCIDRArray(a.allowedClients, &a.allowedClientsIPNet, allowedClients)
</s> add err = processAccessClients(allowed, a.allowedIPs, &a.allowedNets, a.allowedClientIDs) </s> remove return nil, fmt.Errorf("processing disallowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding blocked: %w", err) </s> remove allowedClients: aghstrings.NewSet(),
disallowedClients: aghstrings.NewSet(),
</s> add allowedIPs: aghnet.NewIPMap(0),
blockedIPs: aghnet.NewIPMap(0),
allowedClientIDs: aghstrings.NewSet(),
blockedClientIDs: aghstrings.NewSet(), </s> remove return nil, fmt.Errorf("filterlist.NewRuleStorage(): %w", err)
</s> add return nil, fmt.Errorf("adding blocked hosts: %w", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
err = processAccessClients(blocked, a.blockedIPs, &a.blockedNets, a.blockedClientIDs) | <mask> if err != nil {
<mask> return nil, fmt.Errorf("processing allowed clients: %w", err)
<mask> }
<mask>
<mask> err = processIPCIDRArray(a.disallowedClients, &a.disallowedClientsIPNet, disallowedClients)
<mask> if err != nil {
<mask> return nil, fmt.Errorf("processing disallowed clients: %w", err)
<mask> }
<mask>
<mask> b := &strings.Builder{}
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove return nil, fmt.Errorf("processing allowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding allowed: %w", err) </s> remove return nil, fmt.Errorf("processing disallowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding blocked: %w", err) </s> remove err = processIPCIDRArray(a.allowedClients, &a.allowedClientsIPNet, allowedClients)
</s> add err = processAccessClients(allowed, a.allowedIPs, &a.allowedNets, a.allowedClientIDs) </s> remove for _, s := range blockedHosts {
aghstrings.WriteToBuilder(b, strings.ToLower(s), "\n")
</s> add for _, h := range blockedHosts {
aghstrings.WriteToBuilder(b, strings.ToLower(h), "\n") </s> remove allowedClients: aghstrings.NewSet(),
disallowedClients: aghstrings.NewSet(),
</s> add allowedIPs: aghnet.NewIPMap(0),
blockedIPs: aghnet.NewIPMap(0),
allowedClientIDs: aghstrings.NewSet(),
blockedClientIDs: aghstrings.NewSet(), | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
return nil, fmt.Errorf("adding blocked: %w", err) | <mask> }
<mask>
<mask> err = processIPCIDRArray(a.disallowedClients, &a.disallowedClientsIPNet, disallowedClients)
<mask> if err != nil {
<mask> return nil, fmt.Errorf("processing disallowed clients: %w", err)
<mask> }
<mask>
<mask> b := &strings.Builder{}
<mask> for _, s := range blockedHosts {
<mask> aghstrings.WriteToBuilder(b, strings.ToLower(s), "\n")
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove for _, s := range blockedHosts {
aghstrings.WriteToBuilder(b, strings.ToLower(s), "\n")
</s> add for _, h := range blockedHosts {
aghstrings.WriteToBuilder(b, strings.ToLower(h), "\n") </s> remove err = processIPCIDRArray(a.disallowedClients, &a.disallowedClientsIPNet, disallowedClients)
</s> add err = processAccessClients(blocked, a.blockedIPs, &a.blockedNets, a.blockedClientIDs) </s> remove return nil, fmt.Errorf("processing allowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding allowed: %w", err) </s> remove listArray := []filterlist.RuleList{}
list := &filterlist.StringRuleList{
ID: int(0),
RulesText: b.String(),
IgnoreCosmetic: true,
</s> add lists := []filterlist.RuleList{
&filterlist.StringRuleList{
ID: int(0),
RulesText: b.String(),
IgnoreCosmetic: true,
}, </s> remove err = processIPCIDRArray(a.allowedClients, &a.allowedClientsIPNet, allowedClients)
</s> add err = processAccessClients(allowed, a.allowedIPs, &a.allowedNets, a.allowedClientIDs) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
for _, h := range blockedHosts {
aghstrings.WriteToBuilder(b, strings.ToLower(h), "\n") | <mask> return nil, fmt.Errorf("processing disallowed clients: %w", err)
<mask> }
<mask>
<mask> b := &strings.Builder{}
<mask> for _, s := range blockedHosts {
<mask> aghstrings.WriteToBuilder(b, strings.ToLower(s), "\n")
<mask> }
<mask>
<mask> listArray := []filterlist.RuleList{}
<mask> list := &filterlist.StringRuleList{
<mask> ID: int(0),
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove listArray := []filterlist.RuleList{}
list := &filterlist.StringRuleList{
ID: int(0),
RulesText: b.String(),
IgnoreCosmetic: true,
</s> add lists := []filterlist.RuleList{
&filterlist.StringRuleList{
ID: int(0),
RulesText: b.String(),
IgnoreCosmetic: true,
}, </s> remove return nil, fmt.Errorf("processing disallowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding blocked: %w", err) </s> remove err = processIPCIDRArray(a.disallowedClients, &a.disallowedClientsIPNet, disallowedClients)
</s> add err = processAccessClients(blocked, a.blockedIPs, &a.blockedNets, a.blockedClientIDs) </s> remove listArray = append(listArray, list)
rulesStorage, err := filterlist.NewRuleStorage(listArray)
</s> add rulesStrg, err := filterlist.NewRuleStorage(lists) </s> remove return nil, fmt.Errorf("processing allowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding allowed: %w", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
lists := []filterlist.RuleList{
&filterlist.StringRuleList{
ID: int(0),
RulesText: b.String(),
IgnoreCosmetic: true,
}, | <mask> for _, s := range blockedHosts {
<mask> aghstrings.WriteToBuilder(b, strings.ToLower(s), "\n")
<mask> }
<mask>
<mask> listArray := []filterlist.RuleList{}
<mask> list := &filterlist.StringRuleList{
<mask> ID: int(0),
<mask> RulesText: b.String(),
<mask> IgnoreCosmetic: true,
<mask> }
<mask> listArray = append(listArray, list)
<mask> rulesStorage, err := filterlist.NewRuleStorage(listArray)
<mask> if err != nil {
<mask> return nil, fmt.Errorf("filterlist.NewRuleStorage(): %w", err)
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove listArray = append(listArray, list)
rulesStorage, err := filterlist.NewRuleStorage(listArray)
</s> add rulesStrg, err := filterlist.NewRuleStorage(lists) </s> remove for _, s := range blockedHosts {
aghstrings.WriteToBuilder(b, strings.ToLower(s), "\n")
</s> add for _, h := range blockedHosts {
aghstrings.WriteToBuilder(b, strings.ToLower(h), "\n") </s> remove return nil, fmt.Errorf("filterlist.NewRuleStorage(): %w", err)
</s> add return nil, fmt.Errorf("adding blocked hosts: %w", err) </s> remove return nil, fmt.Errorf("processing disallowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding blocked: %w", err) </s> remove a.blockedHostsEngine = urlfilter.NewDNSEngine(rulesStorage)
</s> add a.blockedHostsEng = urlfilter.NewDNSEngine(rulesStrg) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
rulesStrg, err := filterlist.NewRuleStorage(lists) | <mask> ID: int(0),
<mask> RulesText: b.String(),
<mask> IgnoreCosmetic: true,
<mask> }
<mask> listArray = append(listArray, list)
<mask> rulesStorage, err := filterlist.NewRuleStorage(listArray)
<mask> if err != nil {
<mask> return nil, fmt.Errorf("filterlist.NewRuleStorage(): %w", err)
<mask> }
<mask> a.blockedHostsEngine = urlfilter.NewDNSEngine(rulesStorage)
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove listArray := []filterlist.RuleList{}
list := &filterlist.StringRuleList{
ID: int(0),
RulesText: b.String(),
IgnoreCosmetic: true,
</s> add lists := []filterlist.RuleList{
&filterlist.StringRuleList{
ID: int(0),
RulesText: b.String(),
IgnoreCosmetic: true,
}, </s> remove return nil, fmt.Errorf("filterlist.NewRuleStorage(): %w", err)
</s> add return nil, fmt.Errorf("adding blocked hosts: %w", err) </s> remove a.blockedHostsEngine = urlfilter.NewDNSEngine(rulesStorage)
</s> add a.blockedHostsEng = urlfilter.NewDNSEngine(rulesStrg) </s> remove for _, s := range blockedHosts {
aghstrings.WriteToBuilder(b, strings.ToLower(s), "\n")
</s> add for _, h := range blockedHosts {
aghstrings.WriteToBuilder(b, strings.ToLower(h), "\n") </s> remove return nil, fmt.Errorf("processing allowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding allowed: %w", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
return nil, fmt.Errorf("adding blocked hosts: %w", err) | <mask> }
<mask> listArray = append(listArray, list)
<mask> rulesStorage, err := filterlist.NewRuleStorage(listArray)
<mask> if err != nil {
<mask> return nil, fmt.Errorf("filterlist.NewRuleStorage(): %w", err)
<mask> }
<mask> a.blockedHostsEngine = urlfilter.NewDNSEngine(rulesStorage)
<mask>
<mask> return a, nil
<mask> }
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove listArray = append(listArray, list)
rulesStorage, err := filterlist.NewRuleStorage(listArray)
</s> add rulesStrg, err := filterlist.NewRuleStorage(lists) </s> remove a.blockedHostsEngine = urlfilter.NewDNSEngine(rulesStorage)
</s> add a.blockedHostsEng = urlfilter.NewDNSEngine(rulesStrg) </s> remove listArray := []filterlist.RuleList{}
list := &filterlist.StringRuleList{
ID: int(0),
RulesText: b.String(),
IgnoreCosmetic: true,
</s> add lists := []filterlist.RuleList{
&filterlist.StringRuleList{
ID: int(0),
RulesText: b.String(),
IgnoreCosmetic: true,
}, </s> remove return nil, fmt.Errorf("processing allowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding allowed: %w", err) </s> remove err = processIPCIDRArray(a.disallowedClients, &a.disallowedClientsIPNet, disallowedClients)
</s> add err = processAccessClients(blocked, a.blockedIPs, &a.blockedNets, a.blockedClientIDs) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
a.blockedHostsEng = urlfilter.NewDNSEngine(rulesStrg) | <mask> rulesStorage, err := filterlist.NewRuleStorage(listArray)
<mask> if err != nil {
<mask> return nil, fmt.Errorf("filterlist.NewRuleStorage(): %w", err)
<mask> }
<mask> a.blockedHostsEngine = urlfilter.NewDNSEngine(rulesStorage)
<mask>
<mask> return a, nil
<mask> }
<mask>
<mask> // Split array of IP or CIDR into 2 containers for fast search
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove return nil, fmt.Errorf("filterlist.NewRuleStorage(): %w", err)
</s> add return nil, fmt.Errorf("adding blocked hosts: %w", err) </s> remove // Split array of IP or CIDR into 2 containers for fast search
func processIPCIDRArray(dst *aghstrings.Set, dstIPNet *[]net.IPNet, src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
dst.Add(s)
continue
}
</s> add // allowlistMode returns true if this *accessCtx is in the allowlist mode.
func (a *accessCtx) allowlistMode() (ok bool) {
return a.allowedIPs.Len() != 0 || a.allowedClientIDs.Len() != 0 || len(a.allowedNets) != 0
} </s> remove listArray = append(listArray, list)
rulesStorage, err := filterlist.NewRuleStorage(listArray)
</s> add rulesStrg, err := filterlist.NewRuleStorage(lists) </s> remove listArray := []filterlist.RuleList{}
list := &filterlist.StringRuleList{
ID: int(0),
RulesText: b.String(),
IgnoreCosmetic: true,
</s> add lists := []filterlist.RuleList{
&filterlist.StringRuleList{
ID: int(0),
RulesText: b.String(),
IgnoreCosmetic: true,
}, </s> remove return nil, fmt.Errorf("processing allowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding allowed: %w", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
// allowlistMode returns true if this *accessCtx is in the allowlist mode.
func (a *accessCtx) allowlistMode() (ok bool) {
return a.allowedIPs.Len() != 0 || a.allowedClientIDs.Len() != 0 || len(a.allowedNets) != 0
} | <mask>
<mask> return a, nil
<mask> }
<mask>
<mask> // Split array of IP or CIDR into 2 containers for fast search
<mask> func processIPCIDRArray(dst *aghstrings.Set, dstIPNet *[]net.IPNet, src []string) error {
<mask> for _, s := range src {
<mask> ip := net.ParseIP(s)
<mask> if ip != nil {
<mask> dst.Add(s)
<mask>
<mask> continue
<mask> }
<mask>
<mask> _, ipnet, err := net.ParseCIDR(s)
<mask> if err != nil {
<mask> return err
<mask> }
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove func checkIPCIDRArray(src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
continue
}
_, _, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add return </s> remove a.blockedHostsEngine = urlfilter.NewDNSEngine(rulesStorage)
</s> add a.blockedHostsEng = urlfilter.NewDNSEngine(rulesStrg) </s> remove httpError(r, w, http.StatusInternalServerError, "json.Encode: %s", err)
return
}
}
</s> add httpError(r, w, http.StatusInternalServerError, "encoding response: %s", err) </s> remove _, ipnet, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add // isBlockedClientID returns true if the ClientID should be blocked.
func (a *accessCtx) isBlockedClientID(id string) (ok bool) {
allowlistMode := a.allowlistMode()
if id == "" {
// In allowlist mode, consider requests without client IDs
// blocked by default.
return allowlistMode
} </s> remove d = append(d, net.ParseIP(it.Name))
</s> add ip := net.ParseIP(it.Name)
if ip != nil {
d = append(d, ip)
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
// isBlockedClientID returns true if the ClientID should be blocked.
func (a *accessCtx) isBlockedClientID(id string) (ok bool) {
allowlistMode := a.allowlistMode()
if id == "" {
// In allowlist mode, consider requests without client IDs
// blocked by default.
return allowlistMode
} | <mask>
<mask> continue
<mask> }
<mask>
<mask> _, ipnet, err := net.ParseCIDR(s)
<mask> if err != nil {
<mask> return err
<mask> }
<mask>
<mask> *dstIPNet = append(*dstIPNet, *ipnet)
<mask> }
<mask>
<mask> return nil
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove *dstIPNet = append(*dstIPNet, *ipnet)
</s> add if allowlistMode {
return !a.allowedClientIDs.Has(id) </s> remove func checkIPCIDRArray(src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
continue
}
_, _, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add return </s> remove // Split array of IP or CIDR into 2 containers for fast search
func processIPCIDRArray(dst *aghstrings.Set, dstIPNet *[]net.IPNet, src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
dst.Add(s)
continue
}
</s> add // allowlistMode returns true if this *accessCtx is in the allowlist mode.
func (a *accessCtx) allowlistMode() (ok bool) {
return a.allowedIPs.Len() != 0 || a.allowedClientIDs.Len() != 0 || len(a.allowedNets) != 0
} </s> remove if _, err := upstream.NewResolver(boot, upstream.Options{Timeout: 0}); err != nil {
</s> add if _, err := upstream.NewResolver(boot, nil); err != nil { </s> remove log.Error("etchostscontainer: Opening directory: %q: %s", dir, err)
</s> add log.Error("etchosts: Opening directory: %q: %s", dir, err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
if allowlistMode {
return !a.allowedClientIDs.Has(id) | <mask> if err != nil {
<mask> return err
<mask> }
<mask>
<mask> *dstIPNet = append(*dstIPNet, *ipnet)
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove _, ipnet, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add // isBlockedClientID returns true if the ClientID should be blocked.
func (a *accessCtx) isBlockedClientID(id string) (ok bool) {
allowlistMode := a.allowlistMode()
if id == "" {
// In allowlist mode, consider requests without client IDs
// blocked by default.
return allowlistMode
} </s> remove return nil
</s> add return a.blockedClientIDs.Has(id) </s> remove func checkIPCIDRArray(src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
continue
}
_, _, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add return </s> remove
return nil
</s> add </s> remove if _, err := upstream.NewResolver(boot, upstream.Options{Timeout: 0}); err != nil {
</s> add if _, err := upstream.NewResolver(boot, nil); err != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
return a.blockedClientIDs.Has(id) | <mask>
<mask> *dstIPNet = append(*dstIPNet, *ipnet)
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
<mask> // IsBlockedIP - return TRUE if this client should be blocked
<mask> // Returns the item from the "disallowedClients" list that lead to blocking IP.
<mask> // If it returns TRUE and an empty string, it means that the "allowedClients" is not empty,
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove // IsBlockedIP - return TRUE if this client should be blocked
// Returns the item from the "disallowedClients" list that lead to blocking IP.
// If it returns TRUE and an empty string, it means that the "allowedClients" is not empty,
// but the ip does not belong to it.
func (a *accessCtx) IsBlockedIP(ip net.IP) (bool, string) {
ipStr := ip.String()
</s> add // isBlockedHost returns true if host should be blocked.
func (a *accessCtx) isBlockedHost(host string) (ok bool) {
_, ok = a.blockedHostsEng.Match(strings.ToLower(host)) </s> remove The rule due to which the client is disallowed. If disallowed is
set to true, and this string is empty, then the client IP is
disallowed by the "allowed IP list", that is it is not included in
the allowed list.
</s> add The rule due to which the client is allowed or blocked. </s> remove // IsBlockedIP - return TRUE if this client should be blocked
func (s *Server) IsBlockedIP(ip net.IP) (bool, string) {
if ip == nil {
return false, ""
</s> add // IsBlockedClient returns true if the client is blocked by the current access
// settings.
func (s *Server) IsBlockedClient(ip net.IP, clientID string) (blocked bool, rule string) {
s.serverLock.RLock()
defer s.serverLock.RUnlock()
allowlistMode := s.access.allowlistMode()
blockedByIP, rule := s.access.isBlockedIP(ip)
blockedByClientID := s.access.isBlockedClientID(clientID)
// Allow if at least one of the checks allows in allowlist mode, but
// block if at least one of the checks blocks in blocklist mode.
if allowlistMode && blockedByIP && blockedByClientID {
log.Debug("client %s (id %q) is not in access allowlist", ip, clientID)
// Return now without substituting the empty rule for the
// clientID because the rule can't be empty here.
return true, rule
} else if !allowlistMode && (blockedByIP || blockedByClientID) {
log.Debug("client %s (id %q) is in access blocklist", ip, clientID)
blocked = true
}
if rule == "" {
rule = clientID </s> remove _, ipnet, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add // isBlockedClientID returns true if the ClientID should be blocked.
func (a *accessCtx) isBlockedClientID(id string) (ok bool) {
allowlistMode := a.allowlistMode()
if id == "" {
// In allowlist mode, consider requests without client IDs
// blocked by default.
return allowlistMode
} </s> remove // disallowedClients are the IP addresses of clients in the blocklist.
disallowedClients *aghstrings.Set
</s> add blockedHostsEng *urlfilter.DNSEngine | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
// isBlockedHost returns true if host should be blocked.
func (a *accessCtx) isBlockedHost(host string) (ok bool) {
_, ok = a.blockedHostsEng.Match(strings.ToLower(host)) | <mask>
<mask> return nil
<mask> }
<mask>
<mask> // IsBlockedIP - return TRUE if this client should be blocked
<mask> // Returns the item from the "disallowedClients" list that lead to blocking IP.
<mask> // If it returns TRUE and an empty string, it means that the "allowedClients" is not empty,
<mask> // but the ip does not belong to it.
<mask> func (a *accessCtx) IsBlockedIP(ip net.IP) (bool, string) {
<mask> ipStr := ip.String()
<mask>
<mask> a.lock.Lock()
<mask> defer a.lock.Unlock()
<mask>
<mask> if a.allowedClients.Len() != 0 || len(a.allowedClientsIPNet) != 0 {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove return nil
</s> add return a.blockedClientIDs.Has(id) </s> remove a.lock.Lock()
defer a.lock.Unlock()
</s> add return ok
} </s> remove if a.allowedClients.Len() != 0 || len(a.allowedClientsIPNet) != 0 {
if a.allowedClients.Has(ipStr) {
return false, ""
}
</s> add // isBlockedIP returns the status of the IP address blocking as well as the rule
// that blocked it.
func (a *accessCtx) isBlockedIP(ip net.IP) (blocked bool, rule string) {
blocked = true
ips := a.blockedIPs
ipnets := a.blockedNets </s> remove // IsBlockedIP - return TRUE if this client should be blocked
func (s *Server) IsBlockedIP(ip net.IP) (bool, string) {
if ip == nil {
return false, ""
</s> add // IsBlockedClient returns true if the client is blocked by the current access
// settings.
func (s *Server) IsBlockedClient(ip net.IP, clientID string) (blocked bool, rule string) {
s.serverLock.RLock()
defer s.serverLock.RUnlock()
allowlistMode := s.access.allowlistMode()
blockedByIP, rule := s.access.isBlockedIP(ip)
blockedByClientID := s.access.isBlockedClientID(clientID)
// Allow if at least one of the checks allows in allowlist mode, but
// block if at least one of the checks blocks in blocklist mode.
if allowlistMode && blockedByIP && blockedByClientID {
log.Debug("client %s (id %q) is not in access allowlist", ip, clientID)
// Return now without substituting the empty rule for the
// clientID because the rule can't be empty here.
return true, rule
} else if !allowlistMode && (blockedByIP || blockedByClientID) {
log.Debug("client %s (id %q) is in access blocklist", ip, clientID)
blocked = true
}
if rule == "" {
rule = clientID </s> remove The rule due to which the client is disallowed. If disallowed is
set to true, and this string is empty, then the client IP is
disallowed by the "allowed IP list", that is it is not included in
the allowed list.
</s> add The rule due to which the client is allowed or blocked. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
return ok
} | <mask> // but the ip does not belong to it.
<mask> func (a *accessCtx) IsBlockedIP(ip net.IP) (bool, string) {
<mask> ipStr := ip.String()
<mask>
<mask> a.lock.Lock()
<mask> defer a.lock.Unlock()
<mask>
<mask> if a.allowedClients.Len() != 0 || len(a.allowedClientsIPNet) != 0 {
<mask> if a.allowedClients.Has(ipStr) {
<mask> return false, ""
<mask> }
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove // IsBlockedIP - return TRUE if this client should be blocked
// Returns the item from the "disallowedClients" list that lead to blocking IP.
// If it returns TRUE and an empty string, it means that the "allowedClients" is not empty,
// but the ip does not belong to it.
func (a *accessCtx) IsBlockedIP(ip net.IP) (bool, string) {
ipStr := ip.String()
</s> add // isBlockedHost returns true if host should be blocked.
func (a *accessCtx) isBlockedHost(host string) (ok bool) {
_, ok = a.blockedHostsEng.Match(strings.ToLower(host)) </s> remove if a.allowedClients.Len() != 0 || len(a.allowedClientsIPNet) != 0 {
if a.allowedClients.Has(ipStr) {
return false, ""
}
</s> add // isBlockedIP returns the status of the IP address blocking as well as the rule
// that blocked it.
func (a *accessCtx) isBlockedIP(ip net.IP) (blocked bool, rule string) {
blocked = true
ips := a.blockedIPs
ipnets := a.blockedNets </s> remove if len(a.allowedClientsIPNet) != 0 {
for _, ipnet := range a.allowedClientsIPNet {
if ipnet.Contains(ip) {
return false, ""
}
}
}
return true, ""
</s> add if a.allowlistMode() {
// Enable allowlist mode and use the allowlist sets.
blocked = false
ips = a.allowedIPs
ipnets = a.allowedNets </s> remove return false, ""
}
// IsBlockedDomain - return TRUE if this domain should be blocked
func (a *accessCtx) IsBlockedDomain(host string) (ok bool) {
a.lock.Lock()
defer a.lock.Unlock()
_, ok = a.blockedHostsEngine.Match(strings.ToLower(host))
return ok
</s> add return !blocked, "" </s> remove // Split array of IP or CIDR into 2 containers for fast search
func processIPCIDRArray(dst *aghstrings.Set, dstIPNet *[]net.IPNet, src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
dst.Add(s)
continue
}
</s> add // allowlistMode returns true if this *accessCtx is in the allowlist mode.
func (a *accessCtx) allowlistMode() (ok bool) {
return a.allowedIPs.Len() != 0 || a.allowedClientIDs.Len() != 0 || len(a.allowedNets) != 0
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
// isBlockedIP returns the status of the IP address blocking as well as the rule
// that blocked it.
func (a *accessCtx) isBlockedIP(ip net.IP) (blocked bool, rule string) {
blocked = true
ips := a.blockedIPs
ipnets := a.blockedNets | <mask>
<mask> a.lock.Lock()
<mask> defer a.lock.Unlock()
<mask>
<mask> if a.allowedClients.Len() != 0 || len(a.allowedClientsIPNet) != 0 {
<mask> if a.allowedClients.Has(ipStr) {
<mask> return false, ""
<mask> }
<mask>
<mask> if len(a.allowedClientsIPNet) != 0 {
<mask> for _, ipnet := range a.allowedClientsIPNet {
<mask> if ipnet.Contains(ip) {
<mask> return false, ""
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove a.lock.Lock()
defer a.lock.Unlock()
</s> add return ok
} </s> remove if len(a.allowedClientsIPNet) != 0 {
for _, ipnet := range a.allowedClientsIPNet {
if ipnet.Contains(ip) {
return false, ""
}
}
}
return true, ""
</s> add if a.allowlistMode() {
// Enable allowlist mode and use the allowlist sets.
blocked = false
ips = a.allowedIPs
ipnets = a.allowedNets </s> remove if len(a.disallowedClientsIPNet) != 0 {
for _, ipnet := range a.disallowedClientsIPNet {
if ipnet.Contains(ip) {
return true, ipnet.String()
}
</s> add for _, ipnet := range ipnets {
if ipnet.Contains(ip) {
return blocked, ipnet.String() </s> remove if a.disallowedClients.Has(ipStr) {
return true, ipStr
</s> add if _, ok := ips.Get(ip); ok {
return blocked, ip.String() </s> remove // IsBlockedIP - return TRUE if this client should be blocked
// Returns the item from the "disallowedClients" list that lead to blocking IP.
// If it returns TRUE and an empty string, it means that the "allowedClients" is not empty,
// but the ip does not belong to it.
func (a *accessCtx) IsBlockedIP(ip net.IP) (bool, string) {
ipStr := ip.String()
</s> add // isBlockedHost returns true if host should be blocked.
func (a *accessCtx) isBlockedHost(host string) (ok bool) {
_, ok = a.blockedHostsEng.Match(strings.ToLower(host)) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
if a.allowlistMode() {
// Enable allowlist mode and use the allowlist sets.
blocked = false
ips = a.allowedIPs
ipnets = a.allowedNets | <mask> if a.allowedClients.Has(ipStr) {
<mask> return false, ""
<mask> }
<mask>
<mask> if len(a.allowedClientsIPNet) != 0 {
<mask> for _, ipnet := range a.allowedClientsIPNet {
<mask> if ipnet.Contains(ip) {
<mask> return false, ""
<mask> }
<mask> }
<mask> }
<mask>
<mask> return true, ""
<mask> }
<mask>
<mask> if a.disallowedClients.Has(ipStr) {
<mask> return true, ipStr
<mask> }
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove if len(a.disallowedClientsIPNet) != 0 {
for _, ipnet := range a.disallowedClientsIPNet {
if ipnet.Contains(ip) {
return true, ipnet.String()
}
</s> add for _, ipnet := range ipnets {
if ipnet.Contains(ip) {
return blocked, ipnet.String() </s> remove if a.disallowedClients.Has(ipStr) {
return true, ipStr
</s> add if _, ok := ips.Get(ip); ok {
return blocked, ip.String() </s> remove if a.allowedClients.Len() != 0 || len(a.allowedClientsIPNet) != 0 {
if a.allowedClients.Has(ipStr) {
return false, ""
}
</s> add // isBlockedIP returns the status of the IP address blocking as well as the rule
// that blocked it.
func (a *accessCtx) isBlockedIP(ip net.IP) (blocked bool, rule string) {
blocked = true
ips := a.blockedIPs
ipnets := a.blockedNets </s> remove a.lock.Lock()
defer a.lock.Unlock()
</s> add return ok
} </s> remove return s.access.IsBlockedIP(ip)
</s> add return blocked, rule | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
if _, ok := ips.Get(ip); ok {
return blocked, ip.String() | <mask>
<mask> return true, ""
<mask> }
<mask>
<mask> if a.disallowedClients.Has(ipStr) {
<mask> return true, ipStr
<mask> }
<mask>
<mask> if len(a.disallowedClientsIPNet) != 0 {
<mask> for _, ipnet := range a.disallowedClientsIPNet {
<mask> if ipnet.Contains(ip) {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove if len(a.disallowedClientsIPNet) != 0 {
for _, ipnet := range a.disallowedClientsIPNet {
if ipnet.Contains(ip) {
return true, ipnet.String()
}
</s> add for _, ipnet := range ipnets {
if ipnet.Contains(ip) {
return blocked, ipnet.String() </s> remove if len(a.allowedClientsIPNet) != 0 {
for _, ipnet := range a.allowedClientsIPNet {
if ipnet.Contains(ip) {
return false, ""
}
}
}
return true, ""
</s> add if a.allowlistMode() {
// Enable allowlist mode and use the allowlist sets.
blocked = false
ips = a.allowedIPs
ipnets = a.allowedNets </s> remove if a.allowedClients.Len() != 0 || len(a.allowedClientsIPNet) != 0 {
if a.allowedClients.Has(ipStr) {
return false, ""
}
</s> add // isBlockedIP returns the status of the IP address blocking as well as the rule
// that blocked it.
func (a *accessCtx) isBlockedIP(ip net.IP) (blocked bool, rule string) {
blocked = true
ips := a.blockedIPs
ipnets := a.blockedNets </s> remove a.lock.Lock()
defer a.lock.Unlock()
</s> add return ok
} </s> remove func checkIPCIDRArray(src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
continue
}
_, _, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add return | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
for _, ipnet := range ipnets {
if ipnet.Contains(ip) {
return blocked, ipnet.String() | <mask> if a.disallowedClients.Has(ipStr) {
<mask> return true, ipStr
<mask> }
<mask>
<mask> if len(a.disallowedClientsIPNet) != 0 {
<mask> for _, ipnet := range a.disallowedClientsIPNet {
<mask> if ipnet.Contains(ip) {
<mask> return true, ipnet.String()
<mask> }
<mask> }
<mask> }
<mask>
<mask> return false, ""
<mask> }
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove if a.disallowedClients.Has(ipStr) {
return true, ipStr
</s> add if _, ok := ips.Get(ip); ok {
return blocked, ip.String() </s> remove if len(a.allowedClientsIPNet) != 0 {
for _, ipnet := range a.allowedClientsIPNet {
if ipnet.Contains(ip) {
return false, ""
}
}
}
return true, ""
</s> add if a.allowlistMode() {
// Enable allowlist mode and use the allowlist sets.
blocked = false
ips = a.allowedIPs
ipnets = a.allowedNets </s> remove if a.allowedClients.Len() != 0 || len(a.allowedClientsIPNet) != 0 {
if a.allowedClients.Has(ipStr) {
return false, ""
}
</s> add // isBlockedIP returns the status of the IP address blocking as well as the rule
// that blocked it.
func (a *accessCtx) isBlockedIP(ip net.IP) (blocked bool, rule string) {
blocked = true
ips := a.blockedIPs
ipnets := a.blockedNets </s> remove a.lock.Lock()
defer a.lock.Unlock()
</s> add return ok
} </s> remove func checkIPCIDRArray(src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
continue
}
_, _, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add return | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
return !blocked, "" | <mask> }
<mask> }
<mask> }
<mask>
<mask> return false, ""
<mask> }
<mask>
<mask> // IsBlockedDomain - return TRUE if this domain should be blocked
<mask> func (a *accessCtx) IsBlockedDomain(host string) (ok bool) {
<mask> a.lock.Lock()
<mask> defer a.lock.Unlock()
<mask>
<mask> _, ok = a.blockedHostsEngine.Match(strings.ToLower(host))
<mask>
<mask> return ok
<mask> }
<mask>
<mask> type accessListJSON struct {
<mask> AllowedClients []string `json:"allowed_clients"`
<mask> DisallowedClients []string `json:"disallowed_clients"`
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove // IsBlockedIP - return TRUE if this client should be blocked
// Returns the item from the "disallowedClients" list that lead to blocking IP.
// If it returns TRUE and an empty string, it means that the "allowedClients" is not empty,
// but the ip does not belong to it.
func (a *accessCtx) IsBlockedIP(ip net.IP) (bool, string) {
ipStr := ip.String()
</s> add // isBlockedHost returns true if host should be blocked.
func (a *accessCtx) isBlockedHost(host string) (ok bool) {
_, ok = a.blockedHostsEng.Match(strings.ToLower(host)) </s> remove a.lock.Lock()
defer a.lock.Unlock()
</s> add return ok
} </s> remove _, ipnet, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add // isBlockedClientID returns true if the ClientID should be blocked.
func (a *accessCtx) isBlockedClientID(id string) (ok bool) {
allowlistMode := a.allowlistMode()
if id == "" {
// In allowlist mode, consider requests without client IDs
// blocked by default.
return allowlistMode
} </s> remove if a.allowedClients.Len() != 0 || len(a.allowedClientsIPNet) != 0 {
if a.allowedClients.Has(ipStr) {
return false, ""
}
</s> add // isBlockedIP returns the status of the IP address blocking as well as the rule
// that blocked it.
func (a *accessCtx) isBlockedIP(ip net.IP) (blocked bool, rule string) {
blocked = true
ips := a.blockedIPs
ipnets := a.blockedNets </s> remove _, ok = clients.findLocked(id)
</s> add _, ok = clients.findLocked(ip.String()) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
httpError(r, w, http.StatusInternalServerError, "encoding response: %s", err) | <mask>
<mask> w.Header().Set("Content-Type", "application/json")
<mask> err := json.NewEncoder(w).Encode(j)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusInternalServerError, "json.Encode: %s", err)
<mask> return
<mask> }
<mask> }
<mask>
<mask> func checkIPCIDRArray(src []string) error {
<mask> for _, s := range src {
<mask> ip := net.ParseIP(s)
<mask> if ip != nil {
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove func checkIPCIDRArray(src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
continue
}
_, _, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add return </s> remove // Split array of IP or CIDR into 2 containers for fast search
func processIPCIDRArray(dst *aghstrings.Set, dstIPNet *[]net.IPNet, src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
dst.Add(s)
continue
}
</s> add // allowlistMode returns true if this *accessCtx is in the allowlist mode.
func (a *accessCtx) allowlistMode() (ok bool) {
return a.allowedIPs.Len() != 0 || a.allowedClientIDs.Len() != 0 || len(a.allowedNets) != 0
} </s> remove httpError(r, w, http.StatusBadRequest, "json.Decode: %s", err)
return
}
</s> add httpError(r, w, http.StatusBadRequest, "decoding request: %s", err) </s> remove j := accessListJSON{}
err := json.NewDecoder(r.Body).Decode(&j)
</s> add list := accessListJSON{}
err := json.NewDecoder(r.Body).Decode(&list) </s> remove err = checkIPCIDRArray(j.AllowedClients)
if err == nil {
err = checkIPCIDRArray(j.DisallowedClients)
}
if err != nil {
httpError(r, w, http.StatusBadRequest, "%s", err)
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
return | <mask> return
<mask> }
<mask> }
<mask>
<mask> func checkIPCIDRArray(src []string) error {
<mask> for _, s := range src {
<mask> ip := net.ParseIP(s)
<mask> if ip != nil {
<mask> continue
<mask> }
<mask>
<mask> _, _, err := net.ParseCIDR(s)
<mask> if err != nil {
<mask> return err
<mask> }
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove httpError(r, w, http.StatusInternalServerError, "json.Encode: %s", err)
return
}
}
</s> add httpError(r, w, http.StatusInternalServerError, "encoding response: %s", err) </s> remove // Split array of IP or CIDR into 2 containers for fast search
func processIPCIDRArray(dst *aghstrings.Set, dstIPNet *[]net.IPNet, src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
dst.Add(s)
continue
}
</s> add // allowlistMode returns true if this *accessCtx is in the allowlist mode.
func (a *accessCtx) allowlistMode() (ok bool) {
return a.allowedIPs.Len() != 0 || a.allowedClientIDs.Len() != 0 || len(a.allowedNets) != 0
} </s> remove d = append(d, net.ParseIP(it.Name))
</s> add ip := net.ParseIP(it.Name)
if ip != nil {
d = append(d, ip)
} </s> remove if _, err := upstream.NewResolver(boot, upstream.Options{Timeout: 0}); err != nil {
</s> add if _, err := upstream.NewResolver(boot, nil); err != nil { </s> remove return nil, fmt.Errorf("processing disallowed clients: %w", err)
</s> add return nil, fmt.Errorf("adding blocked: %w", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
<mask> if err != nil {
<mask> return err
<mask> }
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
<mask> func (s *Server) handleAccessSet(w http.ResponseWriter, r *http.Request) {
<mask> j := accessListJSON{}
<mask> err := json.NewDecoder(r.Body).Decode(&j)
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove j := accessListJSON{}
err := json.NewDecoder(r.Body).Decode(&j)
</s> add list := accessListJSON{}
err := json.NewDecoder(r.Body).Decode(&list) </s> remove httpError(r, w, http.StatusBadRequest, "json.Decode: %s", err)
return
}
</s> add httpError(r, w, http.StatusBadRequest, "decoding request: %s", err) </s> remove func checkIPCIDRArray(src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
continue
}
_, _, err := net.ParseCIDR(s)
if err != nil {
return err
}
</s> add return </s> remove return resultCodeError
</s> add return clientID, nil
}
// processClientID puts the clientID into the DNS context, if there is one.
func (s *Server) processClientID(dctx *dnsContext) (rc resultCode) {
pctx := dctx.proxyCtx
var key [8]byte
binary.BigEndian.PutUint64(key[:], pctx.RequestID)
clientIDData := s.clientIDCache.Get(key[:])
if clientIDData == nil {
return resultCodeSuccess </s> remove
return cj
}
// runtimeClientToJSON converts a RuntimeClient into a JSON struct.
func runtimeClientToJSON(ip string, rc RuntimeClient) (cj clientJSON) {
cj = clientJSON{
Name: rc.Host,
IDs: []string{ip},
WHOISInfo: rc.WHOISInfo,
}
return cj
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go | |
list := accessListJSON{}
err := json.NewDecoder(r.Body).Decode(&list) | <mask> return nil
<mask> }
<mask>
<mask> func (s *Server) handleAccessSet(w http.ResponseWriter, r *http.Request) {
<mask> j := accessListJSON{}
<mask> err := json.NewDecoder(r.Body).Decode(&j)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusBadRequest, "json.Decode: %s", err)
<mask> return
<mask> }
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove httpError(r, w, http.StatusBadRequest, "json.Decode: %s", err)
return
}
</s> add httpError(r, w, http.StatusBadRequest, "decoding request: %s", err) </s> remove
return nil
</s> add </s> remove err = checkIPCIDRArray(j.AllowedClients)
if err == nil {
err = checkIPCIDRArray(j.DisallowedClients)
}
if err != nil {
httpError(r, w, http.StatusBadRequest, "%s", err)
</s> add </s> remove httpError(r, w, http.StatusInternalServerError, "json.Encode: %s", err)
return
}
}
</s> add httpError(r, w, http.StatusInternalServerError, "encoding response: %s", err) </s> remove a, err = newAccessCtx(j.AllowedClients, j.DisallowedClients, j.BlockedHosts)
</s> add a, err = newAccessCtx(list.AllowedClients, list.DisallowedClients, list.BlockedHosts) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
httpError(r, w, http.StatusBadRequest, "decoding request: %s", err) | <mask> func (s *Server) handleAccessSet(w http.ResponseWriter, r *http.Request) {
<mask> j := accessListJSON{}
<mask> err := json.NewDecoder(r.Body).Decode(&j)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusBadRequest, "json.Decode: %s", err)
<mask> return
<mask> }
<mask>
<mask> err = checkIPCIDRArray(j.AllowedClients)
<mask> if err == nil {
<mask> err = checkIPCIDRArray(j.DisallowedClients)
<mask> }
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove j := accessListJSON{}
err := json.NewDecoder(r.Body).Decode(&j)
</s> add list := accessListJSON{}
err := json.NewDecoder(r.Body).Decode(&list) </s> remove
return nil
</s> add </s> remove err = checkIPCIDRArray(j.AllowedClients)
if err == nil {
err = checkIPCIDRArray(j.DisallowedClients)
}
if err != nil {
httpError(r, w, http.StatusBadRequest, "%s", err)
</s> add </s> remove httpError(r, w, http.StatusInternalServerError, "json.Encode: %s", err)
return
}
}
</s> add httpError(r, w, http.StatusInternalServerError, "encoding response: %s", err) </s> remove a, err = newAccessCtx(j.AllowedClients, j.DisallowedClients, j.BlockedHosts)
</s> add a, err = newAccessCtx(list.AllowedClients, list.DisallowedClients, list.BlockedHosts) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
<mask> httpError(r, w, http.StatusBadRequest, "json.Decode: %s", err)
<mask> return
<mask> }
<mask>
<mask> err = checkIPCIDRArray(j.AllowedClients)
<mask> if err == nil {
<mask> err = checkIPCIDRArray(j.DisallowedClients)
<mask> }
<mask> if err != nil {
<mask> httpError(r, w, http.StatusBadRequest, "%s", err)
<mask> return
<mask> }
<mask>
<mask> var a *accessCtx
<mask> a, err = newAccessCtx(j.AllowedClients, j.DisallowedClients, j.BlockedHosts)
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove a, err = newAccessCtx(j.AllowedClients, j.DisallowedClients, j.BlockedHosts)
</s> add a, err = newAccessCtx(list.AllowedClients, list.DisallowedClients, list.BlockedHosts) </s> remove httpError(r, w, http.StatusBadRequest, "json.Decode: %s", err)
return
}
</s> add httpError(r, w, http.StatusBadRequest, "decoding request: %s", err) </s> remove j := accessListJSON{}
err := json.NewDecoder(r.Body).Decode(&j)
</s> add list := accessListJSON{}
err := json.NewDecoder(r.Body).Decode(&list) </s> remove httpError(r, w, http.StatusInternalServerError, "json.Encode: %s", err)
return
}
}
</s> add httpError(r, w, http.StatusInternalServerError, "encoding response: %s", err) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go | |
a, err = newAccessCtx(list.AllowedClients, list.DisallowedClients, list.BlockedHosts) | <mask> return
<mask> }
<mask>
<mask> var a *accessCtx
<mask> a, err = newAccessCtx(j.AllowedClients, j.DisallowedClients, j.BlockedHosts)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusBadRequest, "creating access ctx: %s", err)
<mask>
<mask> return
<mask> }
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove err = checkIPCIDRArray(j.AllowedClients)
if err == nil {
err = checkIPCIDRArray(j.DisallowedClients)
}
if err != nil {
httpError(r, w, http.StatusBadRequest, "%s", err)
</s> add </s> remove httpError(r, w, http.StatusBadRequest, "json.Decode: %s", err)
return
}
</s> add httpError(r, w, http.StatusBadRequest, "decoding request: %s", err) </s> remove j := accessListJSON{}
err := json.NewDecoder(r.Body).Decode(&j)
</s> add list := accessListJSON{}
err := json.NewDecoder(r.Body).Decode(&list) </s> remove httpError(r, w, http.StatusInternalServerError, "json.Encode: %s", err)
return
}
}
</s> add httpError(r, w, http.StatusInternalServerError, "encoding response: %s", err) </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
defer log.Debug(
"access: updated lists: %d, %d, %d",
len(list.AllowedClients),
len(list.DisallowedClients),
len(list.BlockedHosts),
) | <mask>
<mask> return
<mask> }
<mask>
<mask> defer log.Debug("Access: updated lists: %d, %d, %d",
<mask> len(j.AllowedClients), len(j.DisallowedClients), len(j.BlockedHosts))
<mask>
<mask> defer s.conf.ConfigModified()
<mask>
<mask> s.serverLock.Lock()
<mask> defer s.serverLock.Unlock()
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove s.conf.AllowedClients = j.AllowedClients
s.conf.DisallowedClients = j.DisallowedClients
s.conf.BlockedHosts = j.BlockedHosts
</s> add s.conf.AllowedClients = list.AllowedClients
s.conf.DisallowedClients = list.DisallowedClients
s.conf.BlockedHosts = list.BlockedHosts </s> remove ipStr := ipReal.String()
</s> add </s> remove func (s *Server) setTableIPToHost(t ipToHostTable) {
</s> add func (s *Server) setTableIPToHost(t *aghnet.IPMap) { </s> remove log.Error("etchostscontainer: %s", err)
</s> add log.Error("etchosts: %s", err) </s> remove rc, ok := clients.ipToRC[ip]
if ok {
return *rc, true
}
return RuntimeClient{}, false
</s> add return clients.findRuntimeClientLocked(ip) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
s.conf.AllowedClients = list.AllowedClients
s.conf.DisallowedClients = list.DisallowedClients
s.conf.BlockedHosts = list.BlockedHosts | <mask>
<mask> s.serverLock.Lock()
<mask> defer s.serverLock.Unlock()
<mask>
<mask> s.conf.AllowedClients = j.AllowedClients
<mask> s.conf.DisallowedClients = j.DisallowedClients
<mask> s.conf.BlockedHosts = j.BlockedHosts
<mask> s.access = a
<mask> }
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove defer log.Debug("Access: updated lists: %d, %d, %d",
len(j.AllowedClients), len(j.DisallowedClients), len(j.BlockedHosts))
</s> add defer log.Debug(
"access: updated lists: %d, %d, %d",
len(list.AllowedClients),
len(list.DisallowedClients),
len(list.BlockedHosts),
) </s> remove d = append(d, net.ParseIP(it.Name))
</s> add ip := net.ParseIP(it.Name)
if ip != nil {
d = append(d, ip)
} </s> remove func (s *Server) setTableIPToHost(t ipToHostTable) {
</s> add func (s *Server) setTableIPToHost(t *aghnet.IPMap) { </s> remove ipStr := ipReal.String()
</s> add </s> remove
return cj
}
// runtimeClientToJSON converts a RuntimeClient into a JSON struct.
func runtimeClientToJSON(ip string, rc RuntimeClient) (cj clientJSON) {
cj = clientJSON{
Name: rc.Host,
IDs: []string{ip},
WHOISInfo: rc.WHOISInfo,
}
return cj
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access.go |
func TestIsBlockedClientID(t *testing.T) {
clientID := "client-1"
clients := []string{clientID} | <mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> func TestIsBlockedIP(t *testing.T) {
<mask> const (
<mask> ip int = iota
<mask> cidr
<mask> )
<mask>
<mask> rules := []string{
<mask> ip: "1.1.1.1",
<mask> cidr: "2.2.0.0/16",
<mask> }
<mask>
<mask> testCases := []struct {
<mask> name string
<mask> allowed bool
<mask> ip net.IP
<mask> wantDis bool
<mask> wantRule string
<mask> }{{
<mask> name: "allow_ip",
<mask> allowed: true,
<mask> ip: net.IPv4(1, 1, 1, 1),
<mask> wantDis: false,
<mask> wantRule: "",
<mask> }, {
<mask> name: "disallow_ip",
<mask> allowed: true,
<mask> ip: net.IPv4(1, 1, 1, 2),
<mask> wantDis: true,
<mask> wantRule: "",
<mask> }, {
<mask> name: "allow_cidr",
<mask> allowed: true,
<mask> ip: net.IPv4(2, 2, 1, 1),
<mask> wantDis: false,
<mask> wantRule: "",
<mask> }, {
<mask> name: "disallow_cidr",
<mask> allowed: true,
<mask> ip: net.IPv4(2, 3, 1, 1),
<mask> wantDis: true,
<mask> wantRule: "",
<mask> }, {
<mask> name: "allow_ip",
<mask> allowed: false,
<mask> ip: net.IPv4(1, 1, 1, 1),
<mask> wantDis: true,
<mask> wantRule: rules[ip],
<mask> }, {
<mask> name: "disallow_ip",
<mask> allowed: false,
<mask> ip: net.IPv4(1, 1, 1, 2),
<mask> wantDis: false,
<mask> wantRule: "",
<mask> }, {
<mask> name: "allow_cidr",
<mask> allowed: false,
<mask> ip: net.IPv4(2, 2, 1, 1),
<mask> wantDis: true,
<mask> wantRule: rules[cidr],
<mask> }, {
<mask> name: "disallow_cidr",
<mask> allowed: false,
<mask> ip: net.IPv4(2, 3, 1, 1),
<mask> wantDis: false,
<mask> wantRule: "",
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> prefix := "allowed_"
<mask> if !tc.allowed {
<mask> prefix = "disallowed_"
<mask> }
<mask>
<mask> t.Run(prefix+tc.name, func(t *testing.T) {
<mask> allowedRules := rules
<mask> var disallowedRules []string
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove name: "wildcard_type-2_mismatch",
domain: ".host3.com",
want: false,
</s> add name: "rule_mismatch",
host: ".host3.com",
want: false, </s> remove name: "plain_match",
domain: "host1",
want: true,
</s> add name: "plain_match",
host: "host1",
want: true, </s> remove name: "plain_mismatch",
domain: "host2",
want: false,
</s> add name: "plain_mismatch",
host: "host2",
want: false, </s> remove name: "wildcard_type-1_mismatch_no-lead",
domain: "host.com",
want: false,
</s> add name: "subdomain_mismatch_no_lead",
host: "host.com",
want: false, </s> remove name: "wildcard_type-1_mismatch_bad-asterisk",
domain: "asdf.zhost.com",
want: false,
</s> add name: "subdomain_mismatch_bad_asterisk",
host: "asdf.zhost.com",
want: false, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access_test.go |
a, err := newAccessCtx(clients, nil, nil)
require.NoError(t, err) | <mask> if !tc.allowed {
<mask> prefix = "disallowed_"
<mask> }
<mask>
<mask> t.Run(prefix+tc.name, func(t *testing.T) {
<mask> allowedRules := rules
<mask> var disallowedRules []string
<mask>
<mask> if !tc.allowed {
<mask> allowedRules, disallowedRules = disallowedRules, allowedRules
<mask> }
<mask>
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove if !tc.allowed {
allowedRules, disallowedRules = disallowedRules, allowedRules
}
</s> add assert.False(t, a.isBlockedClientID(clientID)) </s> remove aCtx, err := newAccessCtx(allowedRules, disallowedRules, nil)
require.NoError(t, err)
</s> add a, err = newAccessCtx(nil, clients, nil)
require.NoError(t, err) </s> remove func TestIsBlockedIP(t *testing.T) {
const (
ip int = iota
cidr
)
rules := []string{
ip: "1.1.1.1",
cidr: "2.2.0.0/16",
}
testCases := []struct {
name string
allowed bool
ip net.IP
wantDis bool
wantRule string
}{{
name: "allow_ip",
allowed: true,
ip: net.IPv4(1, 1, 1, 1),
wantDis: false,
wantRule: "",
}, {
name: "disallow_ip",
allowed: true,
ip: net.IPv4(1, 1, 1, 2),
wantDis: true,
wantRule: "",
}, {
name: "allow_cidr",
allowed: true,
ip: net.IPv4(2, 2, 1, 1),
wantDis: false,
wantRule: "",
}, {
name: "disallow_cidr",
allowed: true,
ip: net.IPv4(2, 3, 1, 1),
wantDis: true,
wantRule: "",
}, {
name: "allow_ip",
allowed: false,
ip: net.IPv4(1, 1, 1, 1),
wantDis: true,
wantRule: rules[ip],
}, {
name: "disallow_ip",
allowed: false,
ip: net.IPv4(1, 1, 1, 2),
wantDis: false,
wantRule: "",
}, {
name: "allow_cidr",
allowed: false,
ip: net.IPv4(2, 2, 1, 1),
wantDis: true,
wantRule: rules[cidr],
}, {
name: "disallow_cidr",
allowed: false,
ip: net.IPv4(2, 3, 1, 1),
wantDis: false,
wantRule: "",
}}
for _, tc := range testCases {
prefix := "allowed_"
if !tc.allowed {
prefix = "disallowed_"
}
</s> add func TestIsBlockedClientID(t *testing.T) {
clientID := "client-1"
clients := []string{clientID} </s> remove assert.Equal(t, tc.want, aCtx.IsBlockedDomain(tc.domain))
</s> add assert.Equal(t, tc.want, a.isBlockedHost(tc.host)) </s> remove disallowed, rule := aCtx.IsBlockedIP(tc.ip)
assert.Equal(t, tc.wantDis, disallowed)
assert.Equal(t, tc.wantRule, rule)
})
}
</s> add assert.True(t, a.isBlockedClientID(clientID)) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access_test.go |
assert.False(t, a.isBlockedClientID(clientID)) | <mask> t.Run(prefix+tc.name, func(t *testing.T) {
<mask> allowedRules := rules
<mask> var disallowedRules []string
<mask>
<mask> if !tc.allowed {
<mask> allowedRules, disallowedRules = disallowedRules, allowedRules
<mask> }
<mask>
<mask> aCtx, err := newAccessCtx(allowedRules, disallowedRules, nil)
<mask> require.NoError(t, err)
<mask>
<mask> disallowed, rule := aCtx.IsBlockedIP(tc.ip)
</s> Pull request: all: allow clientid in access settings
Updates #2624.
Updates #3162.
Squashed commit of the following:
commit 68860da717a23a0bfeba14b7fe10b5e4ad38726d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:41:33 2021 +0300
all: imp types, names
commit ebd4ec26636853d0d58c4e331e6a78feede20813
Merge: 239eb721 16e5e09c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:14:33 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 239eb7215abc47e99a0300a0f4cf56002689b1a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 15:13:10 2021 +0300
all: fix client blocking check
commit e6bece3ea8367b3cbe3d90702a3368c870ad4f13
Merge: 9935f2a3 9d1656b5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Jun 29 13:12:28 2021 +0300
Merge branch 'master' into 2624-clientid-access
commit 9935f2a30bcfae2b853f3ef610c0ab7a56a8f448
Author: Ildar Kamalov <ik@adguard.com>
Date: Tue Jun 29 11:26:51 2021 +0300
client: show block button for client id
commit ed786a6a74a081cd89e9d67df3537a4fadd54831
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:56:23 2021 +0300
client: imp i18n
commit 4fed21c68473ad408960c08a7d87624cabce1911
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 15:34:09 2021 +0300
all: imp i18n, docs
commit 55e65c0d6b939560c53dcb834a4557eb3853d194
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jun 25 13:34:01 2021 +0300
all: fix cache, imp code, docs, tests
commit c1e5a83e76deb44b1f92729bb9ddfcc6a96ac4a8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jun 24 19:27:12 2021 +0300
all: allow clientid in access settings </s> remove t.Run(prefix+tc.name, func(t *testing.T) {
allowedRules := rules
var disallowedRules []string
</s> add a, err := newAccessCtx(clients, nil, nil)
require.NoError(t, err) </s> remove aCtx, err := newAccessCtx(allowedRules, disallowedRules, nil)
require.NoError(t, err)
</s> add a, err = newAccessCtx(nil, clients, nil)
require.NoError(t, err) </s> remove disallowed, rule := aCtx.IsBlockedIP(tc.ip)
assert.Equal(t, tc.wantDis, disallowed)
assert.Equal(t, tc.wantRule, rule)
})
}
</s> add assert.True(t, a.isBlockedClientID(clientID)) </s> remove func TestIsBlockedIP(t *testing.T) {
const (
ip int = iota
cidr
)
rules := []string{
ip: "1.1.1.1",
cidr: "2.2.0.0/16",
}
testCases := []struct {
name string
allowed bool
ip net.IP
wantDis bool
wantRule string
}{{
name: "allow_ip",
allowed: true,
ip: net.IPv4(1, 1, 1, 1),
wantDis: false,
wantRule: "",
}, {
name: "disallow_ip",
allowed: true,
ip: net.IPv4(1, 1, 1, 2),
wantDis: true,
wantRule: "",
}, {
name: "allow_cidr",
allowed: true,
ip: net.IPv4(2, 2, 1, 1),
wantDis: false,
wantRule: "",
}, {
name: "disallow_cidr",
allowed: true,
ip: net.IPv4(2, 3, 1, 1),
wantDis: true,
wantRule: "",
}, {
name: "allow_ip",
allowed: false,
ip: net.IPv4(1, 1, 1, 1),
wantDis: true,
wantRule: rules[ip],
}, {
name: "disallow_ip",
allowed: false,
ip: net.IPv4(1, 1, 1, 2),
wantDis: false,
wantRule: "",
}, {
name: "allow_cidr",
allowed: false,
ip: net.IPv4(2, 2, 1, 1),
wantDis: true,
wantRule: rules[cidr],
}, {
name: "disallow_cidr",
allowed: false,
ip: net.IPv4(2, 3, 1, 1),
wantDis: false,
wantRule: "",
}}
for _, tc := range testCases {
prefix := "allowed_"
if !tc.allowed {
prefix = "disallowed_"
}
</s> add func TestIsBlockedClientID(t *testing.T) {
clientID := "client-1"
clients := []string{clientID} </s> remove func TestIsBlockedDomain(t *testing.T) {
aCtx, err := newAccessCtx(nil, nil, []string{
</s> add func TestIsBlockedHost(t *testing.T) {
a, err := newAccessCtx(nil, nil, []string{ | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e08a64ebe4919579275130e5a0c2e3f7c7ff070e | internal/dnsforward/access_test.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.