Skip to content

Commit 2b540f1

Browse files
authored
dependencies up (#92)
1 parent 78b2e50 commit 2b540f1

File tree

8 files changed

+42
-33
lines changed

8 files changed

+42
-33
lines changed

.github/workflows/ci.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
branches:
1010
- master
1111

12+
concurrency:
13+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
14+
cancel-in-progress: true
15+
1216
jobs:
1317
lint:
1418
runs-on: ubuntu-latest
@@ -22,7 +26,7 @@ jobs:
2226
with:
2327
go-version: ^1.22
2428
- name: golangci-lint
25-
uses: golangci/golangci-lint-action@v3
29+
uses: golangci/golangci-lint-action@v5
2630
- name: goreleaser-check
2731
uses: goreleaser/goreleaser-action@v5
2832
with:
@@ -43,8 +47,8 @@ jobs:
4347
if: ${{ github.event_name == 'pull_request' }}
4448
run: make test
4549
- name: test-coverage
46-
if: ${{ false && github.event_name == 'push' }}
47-
uses: paambaati/codeclimate-action@v5.0.0
50+
if: ${{ github.event_name == 'push' }}
51+
uses: paambaati/codeclimate-action@v6.0.0
4852
env:
4953
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
5054
with:

.golangci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ issues:
5757
- gosec
5858
- path: ._test\.go
5959
linters:
60+
- canonicalheader
6061
- dupword
6162
- ifshort
6263
- cyclop

cmd/crawley/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var (
4141
fBrute, fNoHeads bool
4242
fSkipSSL, fScanJS bool
4343
fScanCSS, fScanALL bool
44-
fSubdomains bool
44+
fSubdomains bool
4545
fDirsPolicy, fProxyAuth string
4646
fRobotsPolicy, fUA string
4747
fDelay time.Duration

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ go 1.22
55
require (
66
github.com/s0rg/compflag v1.1.0
77
github.com/s0rg/set v1.2.0
8-
github.com/tdewolff/parse/v2 v2.7.12
9-
golang.org/x/net v0.24.0
8+
github.com/tdewolff/parse/v2 v2.7.14
9+
golang.org/x/net v0.26.0
1010
)

go.sum

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ github.com/s0rg/compflag v1.1.0 h1:xhCUPLy+5Ue/Q9I/nIcLti2Ul6P42JYx4UvtYoDXmlQ=
22
github.com/s0rg/compflag v1.1.0/go.mod h1:XMntVpc3+jpmBe0s8xo4w9swH8T9ARGkMC9HFiDRoUw=
33
github.com/s0rg/set v1.2.0 h1:53b207YMktNQJXYei/oHuTR5oOO2e9+eieZOncYsh9g=
44
github.com/s0rg/set v1.2.0/go.mod h1:xz3nDbjF4nyMLvAHvmE7rigXpNrKKTsi6iANznIB1/4=
5-
github.com/tdewolff/parse/v2 v2.7.12 h1:tgavkHc2ZDEQVKy1oWxwIyh5bP4F5fEh/JmBwPP/3LQ=
6-
github.com/tdewolff/parse/v2 v2.7.12/go.mod h1:3FbJWZp3XT9OWVN3Hmfp0p/a08v4h8J9W1aghka0soA=
5+
github.com/tdewolff/parse/v2 v2.7.14 h1:100KJ+QAO3PpMb3uUjzEU/NpmCdbBYz6KPmCIAfWpR8=
6+
github.com/tdewolff/parse/v2 v2.7.14/go.mod h1:3FbJWZp3XT9OWVN3Hmfp0p/a08v4h8J9W1aghka0soA=
77
github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52 h1:gAQliwn+zJrkjAHVcBEYW/RFvd2St4yYimisvozAYlA=
88
github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
9-
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
10-
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
9+
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
10+
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=

internal/crawler/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (c *config) String() (rv string) {
6060
sb.WriteString(" +css")
6161
}
6262

63-
if c.Subdomains{
63+
if c.Subdomains {
6464
sb.WriteString(" +subdomains")
6565
}
6666

internal/crawler/util.go

+23-19
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,28 @@ func prepareFilter(tags []string) links.TokenFilter {
7373

7474
func canCrawl(a, b *url.URL, d int, subdomains bool) (yes bool) {
7575
if a.Host != b.Host {
76-
if subdomains{
77-
domainA := strings.Split(a.Host, ".")
78-
domainB := strings.Split(b.Host, ".")
79-
if len(domainA) >= len(domainB){
80-
// The base domain must be shorter than the found domain
81-
return
82-
}
83-
j := len(domainB) - 1
84-
for i := len(domainA) - 1; i >= 0 && j >= 0; i-- {
85-
// Traverse each domain from the end, to check if their top-level domain are the same
86-
if domainA[i] != domainB[j] {
87-
// not the same top-level host
88-
return
89-
}
90-
j--
76+
if !subdomains {
77+
return false
78+
}
79+
80+
domainA := strings.Split(a.Host, ".")
81+
domainB := strings.Split(b.Host, ".")
82+
83+
if len(domainA) >= len(domainB) {
84+
// The base domain must be shorter than the found domain
85+
return false
86+
}
87+
88+
j := len(domainB) - 1
89+
90+
for i := len(domainA) - 1; i >= 0 && j >= 0; i-- {
91+
// Traverse each domain from the end, to check if their top-level domain are the same
92+
if domainA[i] != domainB[j] {
93+
// not the same top-level host
94+
return false
9195
}
92-
} else{
93-
return
96+
97+
j--
9498
}
9599
}
96100

@@ -106,11 +110,11 @@ func canCrawl(a, b *url.URL, d int, subdomains bool) (yes bool) {
106110

107111
depth, found := relativeDepth(apath, bpath)
108112
if !found {
109-
return
113+
return false
110114
}
111115

112116
if d >= 0 && depth > d {
113-
return
117+
return false
114118
}
115119

116120
return true

internal/crawler/util_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ func TestCanCrawl(t *testing.T) {
117117
t.Parallel()
118118

119119
type args struct {
120-
b *url.URL
121-
u *url.URL
122-
d int
120+
b *url.URL
121+
u *url.URL
122+
d int
123123
subdomains bool
124124
}
125125

0 commit comments

Comments
 (0)