diff --git a/cmd/dns/main.go b/cmd/dns/main.go index 3ba386a3..f969d700 100644 --- a/cmd/dns/main.go +++ b/cmd/dns/main.go @@ -49,7 +49,9 @@ func main() { logger := log.New() settingsSources := []reader.Source{ flag.New(os.Args), - env.New(os.Environ()), + env.New(env.Settings{ + Environ: os.Environ(), + }), } settingsReader := reader.New(reader.Settings{ Sources: settingsSources, diff --git a/go.mod b/go.mod index 3d4c8509..f5940bb4 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/prometheus/client_golang v1.16.0 github.com/prometheus/client_model v0.3.0 github.com/qdm12/goservices v0.1.0 - github.com/qdm12/gosettings v0.4.0-rc5 + github.com/qdm12/gosettings v0.4.1 github.com/qdm12/gosplash v0.1.0 github.com/qdm12/gotree v0.2.0 github.com/qdm12/log v0.1.0 @@ -38,4 +38,6 @@ require ( golang.org/x/tools v0.15.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + kernel.org/pub/linux/libs/security/libcap/cap v1.2.69 // indirect + kernel.org/pub/linux/libs/security/libcap/psx v1.2.69 // indirect ) diff --git a/go.sum b/go.sum index df6f25c2..b54750fe 100644 --- a/go.sum +++ b/go.sum @@ -45,8 +45,8 @@ github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+Pymzi github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/qdm12/goservices v0.1.0 h1:9sODefm/yuIGS7ynCkEnNlMTAYn9GzPhtcK4F69JWvc= github.com/qdm12/goservices v0.1.0/go.mod h1:/JOFsAnHFiSjyoXxa5FlfX903h20K5u/3rLzCjYVMck= -github.com/qdm12/gosettings v0.4.0-rc5 h1:DZ4PjfF/Xtx0QGMbinNPr7xRf0rtLfkIg4zZNXUoypY= -github.com/qdm12/gosettings v0.4.0-rc5/go.mod h1:kZtFrO3sfWmMGG3scQB3GcawGe41LKo/4dR4h0dG104= +github.com/qdm12/gosettings v0.4.1 h1:c7+14jO1Y2kFXBCUfS2+QE2NgwTKfzcdJzGEFRItCI8= +github.com/qdm12/gosettings v0.4.1/go.mod h1:uItKwGXibJp2pQ0am6MBKilpjfvYTGiH+zXHd10jFj8= github.com/qdm12/gosplash v0.1.0 h1:Sfl+zIjFZFP7b0iqf2l5UkmEY97XBnaKkH3FNY6Gf7g= github.com/qdm12/gosplash v0.1.0/go.mod h1:+A3fWW4/rUeDXhY3ieBzwghKdnIPFJgD8K3qQkenJlw= github.com/qdm12/gotree v0.2.0 h1:+58ltxkNLUyHtATFereAcOjBVfY6ETqRex8XK90Fb/c= @@ -111,3 +111,7 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +kernel.org/pub/linux/libs/security/libcap/cap v1.2.69 h1:N0m3tKYbkRMmDobh/47ngz+AWeV7PcfXMDi8xu3Vrag= +kernel.org/pub/linux/libs/security/libcap/cap v1.2.69/go.mod h1:Tk5Ip2TuxaWGpccL7//rAsLRH6RQ/jfqTGxuN/+i/FQ= +kernel.org/pub/linux/libs/security/libcap/psx v1.2.69 h1:IdrOs1ZgwGw5CI+BH6GgVVlOt+LAXoPyh7enr8lfaXs= +kernel.org/pub/linux/libs/security/libcap/psx v1.2.69/go.mod h1:+l6Ee2F59XiJ2I6WR5ObpC1utCQJZ/VLsEbQCD8RG24= diff --git a/internal/config/settings.go b/internal/config/settings.go index 99f84b4c..39b81d5a 100644 --- a/internal/config/settings.go +++ b/internal/config/settings.go @@ -65,8 +65,7 @@ func (s *Settings) Validate() (err error) { return fmt.Errorf("upstream type: %w", err) } - const privilegedAllowedPort = 53 - err = validate.ListeningAddress(*s.ListeningAddress, os.Getuid(), privilegedAllowedPort) + err = validate.ListeningAddress(*s.ListeningAddress, os.Getuid()) if err != nil { return fmt.Errorf("listening address: %w", err) } diff --git a/pkg/doh/settings.go b/pkg/doh/settings.go index 231f384d..8c71317f 100644 --- a/pkg/doh/settings.go +++ b/pkg/doh/settings.go @@ -68,8 +68,7 @@ func (s ServerSettings) Validate() (err error) { return fmt.Errorf("resolver settings: %w", err) } - const defaultUDPPort = 53 - err = validate.ListeningAddress(*s.ListeningAddress, os.Getuid(), defaultUDPPort) + err = validate.ListeningAddress(*s.ListeningAddress, os.Getuid()) if err != nil { return fmt.Errorf("%w: %s", ErrListeningAddressNotValid, *s.ListeningAddress) } diff --git a/pkg/dot/settings.go b/pkg/dot/settings.go index 39a12c8c..c1eb75e0 100644 --- a/pkg/dot/settings.go +++ b/pkg/dot/settings.go @@ -79,8 +79,7 @@ func (s ServerSettings) Validate() (err error) { return fmt.Errorf("resolver settings: %w", err) } - const defaultUDPPort = 53 - err = validate.ListeningAddress(*s.ListeningAddress, os.Getuid(), defaultUDPPort) + err = validate.ListeningAddress(*s.ListeningAddress, os.Getuid()) if err != nil { return fmt.Errorf("%w: %s", ErrListeningAddressNotValid, *s.ListeningAddress) }