AdGuardDNS/internal/cmd/access.go

28 lines
727 B
Go
Raw Permalink Normal View History

2023-09-06 08:22:07 +03:00
package cmd
import (
2024-10-14 17:44:24 +03:00
"github.com/AdguardTeam/golibs/errors"
2024-03-11 12:21:07 +03:00
"github.com/AdguardTeam/golibs/netutil"
2023-09-06 08:22:07 +03:00
)
// accessConfig is the configuration that controls IP and hosts blocking.
type accessConfig struct {
// BlockedQuestionDomains is a list of AdBlock rules used to block access.
BlockedQuestionDomains []string `yaml:"blocked_question_domains"`
// BlockedClientSubnets is a list of IP addresses or subnets to block.
2024-03-11 12:21:07 +03:00
BlockedClientSubnets []netutil.Prefix `yaml:"blocked_client_subnets"`
2023-09-06 08:22:07 +03:00
}
2024-10-14 17:44:24 +03:00
// type check
var _ validator = (*accessConfig)(nil)
// validate implements the [validator] interface for *accessConfig.
func (c *accessConfig) validate() (err error) {
if c == nil {
return errors.ErrNoValue
2023-09-06 08:22:07 +03:00
}
return nil
}