domain_checker

package
v0.22.5 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseIPs

func ParseIPs(ctx context.Context, s 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 CreateGetSelfPublicBinded

func CreateGetSelfPublicBinded(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
	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)
}

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