-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add changes from upstream up to v.107.48 (#102)
* add `serve_plain_dns` to TLS config * client ids are now returned sorted, convert attribute to set * local PTR upsteams must be provided when local PTR resolver is enabled * pin container version for testing
- Loading branch information
Showing
20 changed files
with
153 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package adguard | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/hashicorp/terraform-plugin-framework/schema/validator" | ||
"github.com/hashicorp/terraform-plugin-framework/types" | ||
) | ||
|
||
// validator confirms the DNS Config local PTR upstreams are set when the private PTR resolvers are enabled | ||
var _ validator.Bool = checkDnsEncryptionValidator{} | ||
|
||
type checkDnsEncryptionValidator struct { | ||
} | ||
|
||
func (v checkDnsEncryptionValidator) Description(_ context.Context) string { | ||
return "\"tls.serve_plain_dns\" must be `true` when \"tls.enabled\" is set to `false`" | ||
} | ||
|
||
func (v checkDnsEncryptionValidator) MarkdownDescription(ctx context.Context) string { | ||
return v.Description(ctx) | ||
} | ||
|
||
func (v checkDnsEncryptionValidator) ValidateBool(ctx context.Context, req validator.BoolRequest, resp *validator.BoolResponse) { | ||
if req.ConfigValue.ValueBool() || req.ConfigValue.IsNull() { | ||
// if set to true or null, config is valid | ||
return | ||
} | ||
|
||
tlsEnabledPath := req.Path.ParentPath().AtName("enabled") | ||
|
||
var tlsEnabled types.Bool | ||
|
||
diags := req.Config.GetAttribute(ctx, tlsEnabledPath, &tlsEnabled) | ||
resp.Diagnostics.Append(diags...) | ||
|
||
if resp.Diagnostics.HasError() { | ||
return | ||
} | ||
|
||
if !tlsEnabled.ValueBool() { | ||
resp.Diagnostics.AddAttributeError( | ||
tlsEnabledPath, | ||
"DNS Encryption Config Invalid", | ||
v.Description(ctx), | ||
) | ||
} | ||
} | ||
|
||
func checkDnsEncryption() validator.Bool { | ||
return checkDnsEncryptionValidator{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package adguard | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/hashicorp/terraform-plugin-framework/schema/validator" | ||
"github.com/hashicorp/terraform-plugin-framework/types" | ||
) | ||
|
||
// validator confirms the DNS Config local PTR upstreams are set when the private PTR resolvers are enabled | ||
var _ validator.Bool = checkLocalPtrUpstreamsValidator{} | ||
|
||
type checkLocalPtrUpstreamsValidator struct { | ||
} | ||
|
||
func (v checkLocalPtrUpstreamsValidator) Description(_ context.Context) string { | ||
return "\"dns.local_ptr_upstreams\" must contain values when \"dns.use_private_ptr_resolvers\" is set to `true`" | ||
} | ||
|
||
func (v checkLocalPtrUpstreamsValidator) MarkdownDescription(ctx context.Context) string { | ||
return v.Description(ctx) | ||
} | ||
|
||
func (v checkLocalPtrUpstreamsValidator) ValidateBool(ctx context.Context, req validator.BoolRequest, resp *validator.BoolResponse) { | ||
if !req.ConfigValue.ValueBool() || req.ConfigValue.IsNull() || req.ConfigValue.IsUnknown() { | ||
// if set to false or not set, config is valid | ||
return | ||
} | ||
|
||
ptrUpstreamsPath := req.Path.ParentPath().AtName("local_ptr_upstreams") | ||
|
||
var ptrUpstreams types.Set | ||
|
||
diags := req.Config.GetAttribute(ctx, ptrUpstreamsPath, &ptrUpstreams) | ||
resp.Diagnostics.Append(diags...) | ||
|
||
if resp.Diagnostics.HasError() { | ||
return | ||
} | ||
|
||
if ptrUpstreams.IsNull() || ptrUpstreams.IsUnknown() { | ||
resp.Diagnostics.AddAttributeError( | ||
ptrUpstreamsPath, | ||
"DNS Config Use Private PTR Resolvers Invalid", | ||
v.Description(ctx), | ||
) | ||
} | ||
} | ||
|
||
func checkLocalPtrUpstreams() validator.Bool { | ||
return checkLocalPtrUpstreamsValidator{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters