Skip to content

Commit 91812c5

Browse files
authored
Merge pull request #38 from grishy/sg-update-2025-10
Update deps 2025-10
2 parents 7b6aaa5 + 2346bfc commit 91812c5

11 files changed

Lines changed: 517 additions & 97 deletions

File tree

.github/workflows/commit.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ jobs:
1616
test:
1717
runs-on: ubuntu-24.04
1818
steps:
19-
- uses: actions/checkout@v4
20-
- uses: actions/setup-go@v5
19+
- uses: actions/checkout@v5
20+
- uses: actions/setup-go@v6
2121
with:
22-
go-version: "1.25.0"
22+
go-version: "1.25.2"
2323

2424
- run: go mod verify
2525

2626
- run: go test -v ./...
2727

2828
- uses: golangci/golangci-lint-action@v8
2929
with:
30-
version: v2.4.0
30+
version: v2.5.0
3131

3232
build:
3333
runs-on: ubuntu-24.04
3434
steps:
35-
- uses: actions/checkout@v4
36-
- uses: actions/setup-go@v5
35+
- uses: actions/checkout@v5
36+
- uses: actions/setup-go@v6
3737
with:
38-
go-version: "1.25.0"
38+
go-version: "1.25.2"
3939

4040
- name: Set up QEMU for cross-compilation of Docker images
4141
uses: docker/setup-qemu-action@v3
@@ -64,7 +64,7 @@ jobs:
6464
type=raw,value=${{ fromJSON(steps.goreleaser.outputs.metadata).version }}
6565
6666
- name: Test build of Docker images
67-
uses: docker/build-push-action@v5
67+
uses: docker/build-push-action@v6
6868
with:
6969
context: .
7070
push: false

.github/workflows/release.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ jobs:
1313
release:
1414
runs-on: ubuntu-24.04
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
with:
1818
fetch-depth: 0
1919

20-
- uses: actions/setup-go@v5
20+
- uses: actions/setup-go@v6
2121
with:
22-
go-version: "1.25.0"
22+
go-version: "1.25.2"
2323

2424
- name: Set up QEMU for cross-compilation of Docker images
2525
uses: docker/setup-qemu-action@v3
@@ -56,7 +56,7 @@ jobs:
5656
type=raw,value=${{ fromJSON(steps.goreleaser.outputs.metadata).version }}
5757
5858
- name: Build and push Docker images
59-
uses: docker/build-push-action@v5
59+
uses: docker/build-push-action@v6
6060
with:
6161
context: .
6262
push: true
@@ -72,3 +72,5 @@ jobs:
7272
DATE=${{ fromJSON(steps.goreleaser.outputs.metadata).date }}
7373
cache-from: type=gha
7474
cache-to: type=gha,mode=max
75+
provenance: true
76+
sbom: true

.golangci.yml

Lines changed: 459 additions & 43 deletions
Large diffs are not rendered by default.

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ release:
3838
target_commitish: "{{ .Commit }}"
3939
mode: replace
4040
header: |
41-
## ℹ️ For information on how to install and use, please see [README.md](https://github.com/grishy/go-avahi-cname)
41+
## [README.md](https://github.com/grishy/go-avahi-cname) - for information on how to install and use
4242
footer: |
4343
Your PRs and issues are welcome! Thanks 🙂
4444
disable: false

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Need a lot of additional configuration to build multi-arch images
55

66
# STAGE 1: building the executable
7-
FROM docker.io/golang:1.25.0-alpine3.22 AS builder
7+
FROM docker.io/golang:1.25.2-alpine3.22 AS builder
88
WORKDIR /build
99

1010
ARG VERSION

avahi/publisher.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010
)
1111

1212
const (
13-
// https://github.com/lathiat/avahi/blob/v0.8/avahi-common/defs.h#L343
14-
AVAHI_DNS_CLASS_IN = uint16(0x01)
15-
// https://github.com/lathiat/avahi/blob/v0.8/avahi-common/defs.h#L331
16-
AVAHI_DNS_TYPE_CNAME = uint16(0x05)
13+
// AvahiDNSClassIn from https://github.com/lathiat/avahi/blob/v0.8/avahi-common/defs.h#L343
14+
AvahiDNSClassIn = uint16(0x01)
15+
// AvahiDNSTypeCName from https://github.com/lathiat/avahi/blob/v0.8/avahi-common/defs.h#L331
16+
AvahiDNSTypeCName = uint16(0x05)
1717
)
1818

1919
type Publisher struct {
@@ -91,8 +91,8 @@ func (p *Publisher) PublishCNAMES(cnames []string, ttl uint32) error {
9191
avahi.ProtoUnspec,
9292
uint32(0), // From Avahi Python bindings https://gist.github.com/gdamjan/3168336#file-avahi-alias-py-L42
9393
cname,
94-
AVAHI_DNS_CLASS_IN,
95-
AVAHI_DNS_TYPE_CNAME,
94+
AvahiDNSClassIn,
95+
AvahiDNSTypeCName,
9696
ttl,
9797
p.rdataField,
9898
)

cmd/cname.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"log/slog"
78
"time"
@@ -117,7 +118,7 @@ func Cname(ctx context.Context) *cli.Command {
117118
cnames := cCtx.Args().Slice()
118119

119120
if len(cnames) == 0 {
120-
return fmt.Errorf("at least one CNAME should be provided")
121+
return errors.New("at least one CNAME should be provided")
121122
}
122123

123124
slog.Info("creating publisher")

cmd/subdomain.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ func reader(ctx context.Context, conn *net.UDPConn) chan *dnsMsg {
6666
}
6767
slog.Debug("received UDP message", "bytes", bytesRead, "from", remoteAddress)
6868

69-
if err := dnsMsg.msg.Unpack(buf[:bytesRead]); err != nil {
70-
dnsMsg.err = errors.Join(dnsMsg.err, fmt.Errorf("failed to unpack message: %w", err))
69+
if unpackErr := dnsMsg.msg.Unpack(buf[:bytesRead]); unpackErr != nil {
70+
dnsMsg.err = errors.Join(dnsMsg.err, fmt.Errorf("failed to unpack message: %w", unpackErr))
7171
msgCh <- dnsMsg
7272
continue
7373
}
@@ -81,10 +81,11 @@ func reader(ctx context.Context, conn *net.UDPConn) chan *dnsMsg {
8181
}
8282

8383
// selectQuestion filters and selects questions with the given FQDN suffix.
84-
func selectQuestion(fqdn string, qs []dns.Question) (res []string) {
84+
func selectQuestion(fqdn string, qs []dns.Question) []string {
8585
suffix := strings.ToLower("." + fqdn)
8686
slog.Debug("filtering DNS questions", "suffix", suffix, "questions", len(qs))
8787

88+
res := make([]string, 0, len(qs))
8889
for _, q := range qs {
8990
slog.Debug("processing question", "name", q.Name, "type", dns.TypeToString[q.Qtype])
9091

@@ -114,8 +115,8 @@ func runSubdomain(ctx context.Context, publisher *avahi.Publisher, fqdn string,
114115
<-ctx.Done()
115116
fmt.Println() // Add new line after ^C
116117
slog.Info("closing connection")
117-
if err := conn.Close(); err != nil {
118-
slog.Error("failed to close connection", "error", err)
118+
if closeErr := conn.Close(); closeErr != nil {
119+
slog.Error("failed to close connection", "error", closeErr)
119120
}
120121
}()
121122

@@ -132,8 +133,8 @@ func runSubdomain(ctx context.Context, publisher *avahi.Publisher, fqdn string,
132133

133134
if len(found) > 0 {
134135
slog.Debug("publishing matching CNAMEs", "count", len(found))
135-
if err := publisher.PublishCNAMES(found, ttl); err != nil {
136-
return fmt.Errorf("failed to publish CNAMEs: %w", err)
136+
if publishErr := publisher.PublishCNAMES(found, ttl); publishErr != nil {
137+
return fmt.Errorf("failed to publish CNAMEs: %w", publishErr)
137138
}
138139
}
139140
}

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module github.com/grishy/go-avahi-cname
22

3-
go 1.25.0
3+
go 1.25.2
44

55
require (
6-
github.com/caarlos0/go-version v0.2.1
6+
github.com/caarlos0/go-version v0.2.2
77
github.com/godbus/dbus/v5 v5.1.0
88
github.com/holoplot/go-avahi v1.0.1
99
github.com/lmittmann/tint v1.1.2
@@ -16,9 +16,9 @@ require (
1616
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
1717
github.com/russross/blackfriday/v2 v2.1.0 // indirect
1818
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect
19-
golang.org/x/mod v0.27.0 // indirect
20-
golang.org/x/net v0.43.0 // indirect
21-
golang.org/x/sync v0.16.0 // indirect
22-
golang.org/x/sys v0.35.0 // indirect
23-
golang.org/x/tools v0.36.0 // indirect
19+
golang.org/x/mod v0.29.0 // indirect
20+
golang.org/x/net v0.46.0 // indirect
21+
golang.org/x/sync v0.17.0 // indirect
22+
golang.org/x/sys v0.37.0 // indirect
23+
golang.org/x/tools v0.38.0 // indirect
2424
)

go.sum

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/caarlos0/go-version v0.2.1 h1:bJY5WRvs2RXErLKBELd1WR0U72whX8ELbKg0WtQ9/7A=
2-
github.com/caarlos0/go-version v0.2.1/go.mod h1:X+rI5VAtJDpcjCjeEIXpxGa5+rTcgur1FK66wS0/944=
1+
github.com/caarlos0/go-version v0.2.2 h1:5r+nlrg4H2wOVwWjqRqRRIRbZ7ytRmjC9xoMIP0a5kQ=
2+
github.com/caarlos0/go-version v0.2.2/go.mod h1:X+rI5VAtJDpcjCjeEIXpxGa5+rTcgur1FK66wS0/944=
33
github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo=
44
github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
55
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
@@ -21,14 +21,14 @@ github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU=
2121
github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4=
2222
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 h1:FnBeRrxr7OU4VvAzt5X7s6266i6cSVkkFPS0TuXWbIg=
2323
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
24-
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
25-
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
26-
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
27-
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
28-
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
29-
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
24+
golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
25+
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
26+
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
27+
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
28+
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
29+
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
3030
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
31-
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
32-
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
33-
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
34-
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
31+
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
32+
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
33+
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
34+
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=

0 commit comments

Comments
 (0)