Skip to content

Commit

Permalink
feat: auto-detect when IPv6 is disabled
Browse files Browse the repository at this point in the history
Set `connectIPVersion` automatically, but not `filtering.queryTypes`
since clients might have functional IPv6.
  • Loading branch information
ThinkChaos committed Sep 24, 2024
1 parent e93da08 commit 2be049f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"github.com/miekg/dns"
"github.com/sirupsen/logrus"
"golang.org/x/net/nettest"

. "github.com/0xERR0R/blocky/config/migration"
"github.com/0xERR0R/blocky/log"
Expand Down Expand Up @@ -263,6 +264,12 @@ type Config struct {
} `yaml:",inline"`
}

func (c *Config) SetDefaults() {

Check failure on line 267 in config/config.go

View workflow job for this annotation

GitHub Actions / make (lint, true, false)

ST1016: methods on the same type should have the same receiver name (seen 1x "c", 2x "cfg") (stylecheck)
if !nettest.SupportsIPv6() {
c.ConnectIPVersion = IPVersionV4
}
}

type Ports struct {
DNS ListenConfig `yaml:"dns" default:"53"`
HTTP ListenConfig `yaml:"http"`
Expand Down

0 comments on commit 2be049f

Please sign in to comment.