Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bakito/adguardhome-sync
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 870051c042326219359fec8f3196317c5df23e09
Choose a base ref
..
head repository: bakito/adguardhome-sync
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8d2d3a479d093185933a2df15b9f215ef27d6469
Choose a head ref
Showing with 7 additions and 12 deletions.
  1. +0 −2 .golangci.yml
  2. +2 −4 pkg/client/client.go
  3. +5 −6 pkg/client/model/client/client.go
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -31,8 +31,6 @@ linters-settings:
gosec:
# Exclude generated files
exclude-generated: true
excludes:
- G402
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
6 changes: 2 additions & 4 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
@@ -53,10 +53,8 @@ func New(config types.AdGuardInstance) (Client, error) {
u.Path = path.Clean(u.Path)
cl := resty.New().SetBaseURL(u.String()).SetDisableWarn(true)

if config.InsecureSkipVerify {
// #nosec G402 has to be explicitly enabled
cl.SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true})
}
// #nosec G402 has to be explicitly enabled
cl.SetTLSClientConfig(&tls.Config{InsecureSkipVerify: config.InsecureSkipVerify})

cookieParts := strings.Split(config.Cookie, "=")
if len(cookieParts) == 2 {
11 changes: 5 additions & 6 deletions pkg/client/model/client/client.go
Original file line number Diff line number Diff line change
@@ -33,12 +33,11 @@ func New(config types.AdGuardInstance) (Client, error) {
}
u.Path = path.Clean(u.Path)

httpClient := &http.Client{}
if config.InsecureSkipVerify {
// #nosec G402 has to be explicitly enabled
httpClient.Transport = &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
httpClient := &http.Client{
Transport: &http.Transport{
// #nosec G402 has to be explicitly enabled
TLSClientConfig: &tls.Config{InsecureSkipVerify: config.InsecureSkipVerify},
},
}

aghClient, err := model.NewClient(u.String(), func(client *model.AdguardHomeClient) error {