domain_checker

package
v0.29.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AWSMetadataAvailable added in v0.23.10

func AWSMetadataAvailable() bool

func ParseIPList added in v0.23.10

func ParseIPList(ctx context.Context, s, sep string) ([]net.IP, error)

func SetDefaultResolver added in v0.20.5

func SetDefaultResolver(resolver Resolver)

Types

type All

type All []DomainChecker

func NewAll

func NewAll(checkers ...DomainChecker) All

func (All) IsDomainAllowed

func (all All) IsDomainAllowed(ctx context.Context, domain string) (bool, error)

type AllowedIPAddresses

type AllowedIPAddresses func(ctx context.Context) ([]net.IP, error)

func AWSPublicIPs added in v0.23.10

func AWSPublicIPs() AllowedIPAddresses

func GetIPByExternalRequest added in v0.23.10

func GetIPByExternalRequest(url string) AllowedIPAddresses

func SelfBindedPublicIPs added in v0.23.10

func SelfBindedPublicIPs(binded InterfacesAddrFunc) AllowedIPAddresses

type Any

type Any []DomainChecker

func NewAny

func NewAny(checkers ...DomainChecker) Any

func (Any) IsDomainAllowed

func (any Any) IsDomainAllowed(ctx context.Context, domain string) (bool, error)

type Config

type Config struct {
	IPSelf                    bool
	IPSelfDetectMethod        string
	IPSelfExternalDetectorURL string
	IPWhiteList               string
	BlackList                 string
	WhiteList                 string
	Resolver                  string
}

func (*Config) CreateDomainChecker

func (c *Config) CreateDomainChecker(ctx context.Context) (DomainChecker, error)

type DomainChecker

type DomainChecker interface {
	// IsDomainAllowed called for check domain for allow certificate
	// It can call concurrency for many domains same time
	// guarantee about domain will correct domain name (as minimum for character set)
	IsDomainAllowed(ctx context.Context, domain string) (bool, error)
}

func NewSelfIPChecker added in v0.23.10

func NewSelfIPChecker(ctx context.Context, config *Config) (DomainChecker, error)

type False

type False struct{}

func (False) IsDomainAllowed

func (False) IsDomainAllowed(ctx context.Context, domain string) (bool, error)

type IPList

type IPList struct {
	Addresses          AllowedIPAddresses
	Resolver           Resolver
	AutoUpdateInterval time.Duration // Set zero for disable autorenew.
	// contains filtered or unexported fields
}

func NewIPList

func NewIPList(ctx context.Context, addresses AllowedIPAddresses) *IPList

After create can change settings fields, than can call StartAutoRenew struct fields MUST NOT changes after call StartAutoRenew or concurrency with usage.

func (*IPList) IsDomainAllowed

func (s *IPList) IsDomainAllowed(ctx context.Context, domain string) (bool, error)

func (*IPList) StartAutoRenew

func (s *IPList) StartAutoRenew()

Can called most once - for autorenew internal ips

type InterfacesAddrFunc

type InterfacesAddrFunc func() ([]net.Addr, error)

type Not

type Not struct {
	// contains filtered or unexported fields
}

func NewNot

func NewNot(origin DomainChecker) Not

func (Not) IsDomainAllowed

func (n Not) IsDomainAllowed(ctx context.Context, domain string) (bool, error)

type Regexp

type Regexp regexp.Regexp

func NewRegexp

func NewRegexp(r *regexp.Regexp) *Regexp

func (*Regexp) IsDomainAllowed

func (r *Regexp) IsDomainAllowed(ctx context.Context, domain string) (bool, error)

type Resolver

type Resolver interface {
	LookupIPAddr(ctx context.Context, host string) ([]net.IPAddr, error)
}

type True

type True struct{}

func (True) IsDomainAllowed

func (True) IsDomainAllowed(ctx context.Context, domain string) (bool, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL