submissionlimit

package module
v0.0.0-...-8724532 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIPIsTorExitNode = errors.New("IP is from a Tor exit node")

	TorDefaultRefreshInterval = 30 * time.Minute
)
View Source
var (
	ErrEMailInvalidOrOnDenyList = errors.New("email invalid or domain on deny list")
)

Functions

func NewUniqueMemoryStorage

func NewUniqueMemoryStorage() *uniqueMemoryStorage

func WithEMail

func WithEMail(ec EMailConfig) option

func WithIP

func WithIP(ipc IPConfig) option

func WithTor

func WithTor(tc TorConfig) option

func WithUnique

func WithUnique(uc UniqueConfig) option

Types

type EMailConfig

type EMailConfig struct {
	AdditionalDenyDomains []string

	DoValidateDomain        bool
	DoValidateDomainAndUser bool

	SMTPHostname string
	SMTPEMail    string

	Unique bool
}

type IPConfig

type IPConfig struct {
	AllowIPv4 bool
	AllowIPv6 bool

	Unique bool
}

type Limiter

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

func New

func New(opts ...option) *Limiter

func (*Limiter) Limit

func (l *Limiter) Limit(s Submission) error

type Submission

type Submission struct {
	IP string

	EMail string

	Unique map[string]string
}

type TorConfig

type TorConfig struct {
	ListRefreshInterval         time.Duration
	NoWaitForInitialListRefresh bool
}

type UniqueConfig

type UniqueConfig struct {
	Storage UniqueStorage
}

type UniqueStorage

type UniqueStorage interface {
	Store(k, v string) error
}

Jump to

Keyboard shortcuts

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