Skip to content

Commit acc25fc

Browse files
committed
Format with gofumpt
1 parent 07b4ec3 commit acc25fc

15 files changed

+49
-42
lines changed

dnscrypt-proxy/dnsutils.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ func RefusedResponseFromMessage(srcMsg *dns.Msg, refusedCode bool, ipv4 net.IP,
7171

7272
if sendHInfoResponse {
7373
hinfo := new(dns.HINFO)
74-
hinfo.Hdr = dns.RR_Header{Name: question.Name, Rrtype: dns.TypeHINFO,
75-
Class: dns.ClassINET, Ttl: ttl}
74+
hinfo.Hdr = dns.RR_Header{
75+
Name: question.Name, Rrtype: dns.TypeHINFO,
76+
Class: dns.ClassINET, Ttl: ttl,
77+
}
7678
hinfo.Cpu = "This query has been locally blocked"
7779
hinfo.Os = "by dnscrypt-proxy"
7880
dstMsg.Answer = []dns.RR{hinfo}

dnscrypt-proxy/fuzzing_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ package main
55

66
import (
77
"encoding/hex"
8-
stamps "github.com/jedisct1/go-dnsstamps"
98
"testing"
9+
10+
stamps "github.com/jedisct1/go-dnsstamps"
1011
)
1112

1213
func FuzzParseODoHTargetConfigs(f *testing.F) {

dnscrypt-proxy/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func Logger(logMaxSize int, logMaxAge int, logMaxBackups int, fileName string) i
1616
if st.Mode().IsDir() {
1717
dlog.Fatalf("[%v] is a directory", fileName)
1818
}
19-
fp, err := os.OpenFile(fileName, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)
19+
fp, err := os.OpenFile(fileName, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0o644)
2020
if err != nil {
2121
dlog.Fatalf("Unable to access [%v]: [%v]", fileName, err)
2222
}

dnscrypt-proxy/pidfile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ func PidFileCreate() error {
1515
if pidFile == nil || len(*pidFile) == 0 {
1616
return nil
1717
}
18-
if err := os.MkdirAll(filepath.Dir(*pidFile), 0755); err != nil {
18+
if err := os.MkdirAll(filepath.Dir(*pidFile), 0o755); err != nil {
1919
return err
2020
}
21-
return safefile.WriteFile(*pidFile, []byte(strconv.Itoa(os.Getpid())), 0644)
21+
return safefile.WriteFile(*pidFile, []byte(strconv.Itoa(os.Getpid())), 0o644)
2222
}
2323

2424
func PidFileRemove() error {

dnscrypt-proxy/plugin_block_ipv6.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ func (plugin *PluginBlockIPv6) Eval(pluginsState *PluginsState, msg *dns.Msg) er
3535
}
3636
synth := EmptyResponseFromMessage(msg)
3737
hinfo := new(dns.HINFO)
38-
hinfo.Hdr = dns.RR_Header{Name: question.Name, Rrtype: dns.TypeHINFO,
39-
Class: dns.ClassINET, Ttl: 86400}
38+
hinfo.Hdr = dns.RR_Header{
39+
Name: question.Name, Rrtype: dns.TypeHINFO,
40+
Class: dns.ClassINET, Ttl: 86400,
41+
}
4042
hinfo.Cpu = "AAAA queries have been locally blocked by dnscrypt-proxy"
4143
hinfo.Os = "Set block_ipv6 to false to disable that feature"
4244
synth.Answer = []dns.RR{hinfo}
@@ -54,8 +56,10 @@ func (plugin *PluginBlockIPv6) Eval(pluginsState *PluginsState, msg *dns.Msg) er
5456
soa.Minttl = 2400
5557
soa.Expire = 604800
5658
soa.Retry = 300
57-
soa.Hdr = dns.RR_Header{Name: parentZone, Rrtype: dns.TypeSOA,
58-
Class: dns.ClassINET, Ttl: 60}
59+
soa.Hdr = dns.RR_Header{
60+
Name: parentZone, Rrtype: dns.TypeSOA,
61+
Class: dns.ClassINET, Ttl: 60,
62+
}
5963
synth.Ns = []dns.RR{soa}
6064
pluginsState.synthResponse = synth
6165
pluginsState.action = PluginsActionSynth

dnscrypt-proxy/plugin_block_name.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ func (blockedNames *BlockedNames) check(pluginsState *PluginsState, qName string
7171

7272
// ---
7373

74-
type PluginBlockName struct {
75-
}
74+
type PluginBlockName struct{}
7675

7776
func (plugin *PluginBlockName) Name() string {
7877
return "block_name"
@@ -148,8 +147,7 @@ func (plugin *PluginBlockName) Eval(pluginsState *PluginsState, msg *dns.Msg) er
148147

149148
// ---
150149

151-
type PluginBlockNameResponse struct {
152-
}
150+
type PluginBlockNameResponse struct{}
153151

154152
func (plugin *PluginBlockNameResponse) Name() string {
155153
return "block_name"

dnscrypt-proxy/plugin_block_unqualified.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import (
66
"github.com/miekg/dns"
77
)
88

9-
type PluginBlockUnqualified struct {
10-
}
9+
type PluginBlockUnqualified struct{}
1110

1211
func (plugin *PluginBlockUnqualified) Name() string {
1312
return "block_unqualified"

dnscrypt-proxy/plugin_cache.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ func computeCacheKey(pluginsState *PluginsState, msg *dns.Msg) [32]byte {
4545

4646
// ---
4747

48-
type PluginCache struct {
49-
}
48+
type PluginCache struct{}
5049

5150
func (plugin *PluginCache) Name() string {
5251
return "cache"
@@ -108,8 +107,7 @@ func (plugin *PluginCache) Eval(pluginsState *PluginsState, msg *dns.Msg) error
108107

109108
// ---
110109

111-
type PluginCacheResponse struct {
112-
}
110+
type PluginCacheResponse struct{}
113111

114112
func (plugin *PluginCacheResponse) Name() string {
115113
return "cache_response"

dnscrypt-proxy/plugin_dns64.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ func (plugin *PluginDNS64) fetchPref64(resolver string) error {
191191

192192
client := new(dns.Client)
193193
resp, _, err := client.Exchange(msg, resolver)
194-
195194
if err != nil {
196195
return err
197196
}
@@ -209,17 +208,17 @@ func (plugin *PluginDNS64) fetchPref64(resolver string) error {
209208
prefEnd := 0
210209

211210
if wka := net.IPv4(ipv6[12], ipv6[13], ipv6[14], ipv6[15]); wka.Equal(rfc7050WKA1) ||
212-
wka.Equal(rfc7050WKA2) { //96
211+
wka.Equal(rfc7050WKA2) { // 96
213212
prefEnd = 12
214-
} else if wka := net.IPv4(ipv6[9], ipv6[10], ipv6[11], ipv6[12]); wka.Equal(rfc7050WKA1) || wka.Equal(rfc7050WKA2) { //64
213+
} else if wka := net.IPv4(ipv6[9], ipv6[10], ipv6[11], ipv6[12]); wka.Equal(rfc7050WKA1) || wka.Equal(rfc7050WKA2) { // 64
215214
prefEnd = 8
216-
} else if wka := net.IPv4(ipv6[7], ipv6[9], ipv6[10], ipv6[11]); wka.Equal(rfc7050WKA1) || wka.Equal(rfc7050WKA2) { //56
215+
} else if wka := net.IPv4(ipv6[7], ipv6[9], ipv6[10], ipv6[11]); wka.Equal(rfc7050WKA1) || wka.Equal(rfc7050WKA2) { // 56
217216
prefEnd = 7
218-
} else if wka := net.IPv4(ipv6[6], ipv6[7], ipv6[9], ipv6[10]); wka.Equal(rfc7050WKA1) || wka.Equal(rfc7050WKA2) { //48
217+
} else if wka := net.IPv4(ipv6[6], ipv6[7], ipv6[9], ipv6[10]); wka.Equal(rfc7050WKA1) || wka.Equal(rfc7050WKA2) { // 48
219218
prefEnd = 6
220-
} else if wka := net.IPv4(ipv6[5], ipv6[6], ipv6[7], ipv6[9]); wka.Equal(rfc7050WKA1) || wka.Equal(rfc7050WKA2) { //40
219+
} else if wka := net.IPv4(ipv6[5], ipv6[6], ipv6[7], ipv6[9]); wka.Equal(rfc7050WKA1) || wka.Equal(rfc7050WKA2) { // 40
221220
prefEnd = 5
222-
} else if wka := net.IPv4(ipv6[4], ipv6[5], ipv6[6], ipv6[7]); wka.Equal(rfc7050WKA1) || wka.Equal(rfc7050WKA2) { //32
221+
} else if wka := net.IPv4(ipv6[4], ipv6[5], ipv6[6], ipv6[7]); wka.Equal(rfc7050WKA1) || wka.Equal(rfc7050WKA2) { // 32
223222
prefEnd = 4
224223
}
225224

dnscrypt-proxy/plugin_firefox.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import (
99
"github.com/miekg/dns"
1010
)
1111

12-
type PluginFirefox struct {
13-
}
12+
type PluginFirefox struct{}
1413

1514
func (plugin *PluginFirefox) Name() string {
1615
return "firefox"

0 commit comments

Comments
 (0)