Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CheckErrorMessages = map[CheckErrorMSG]string{
ErrInvalidSchema: "Invalid URL schema. Only 'http' or 'https' are allowed.",
ErrFileNotAllowed: "Files are not allowed.",
ErrMaxRedirectsExceeded: "Maximum number of redirects exceeded.",
ErrSizeExceeded: "URL size exceeds the maximum allowed size.",
ErrURLLengthExceeded: "URL length exceeds the maximum allowed length.",
ErrUnreachable: "URL is unreachable.",
ErrMustHaveTLD: "URL must have a valid top-level domain (TLD).",
ErrURLCannotContainCreds: "URL should not contain credentials.",
ErrURLCannotEndWithSlash: "URL should not end with a slash.",
ErrHTTPClientTimeout: "Website is taking too long to respond",
ErrHTTPSRequired: "HTTPS is required.",
ErrDNSRecordNotFound: "DNS record not found.",
ErrSeekerNotInitialized: "Seeker is not initialized.",
ErrIsNotAbsoluteURL: "URL is not absolute.",
ErrContentTypeNotAllowed: "Content type is not allowed.",
ErrContentTypeIsEmpty: "Content type is empty.",
ErrDNSNameValueNull: "DNS name value is null.",
}
View Source
var DefaultCheckConfig = CheckConfig{ MaxRedirects: 2, MaxSize: 4194304, MaxURLLength: 2048, CheckForFile: true, CheckIsReachable: true, CannotEndWithSlash: true, HTTPSRequired: false, HTTPClientTimeout: 10 * time.Second, ContentTypeMustBeHTML: true, }
Functions ¶
func HasValidTLD ¶
Types ¶
type CheckConfig ¶
type CheckConfig struct { MaxRedirects int `koanf:"max_redirects"` MaxSize int64 `koanf:"max_size"` MaxURLLength int `koanf:"max_url_length"` CheckForFile bool `koanf:"check_for_file"` CheckIsReachable bool `koanf:"check_is_reachable"` CannotEndWithSlash bool `koanf:"cannot_end_with_slash"` HTTPClientTimeout time.Duration `koanf:"http_client_timeout"` HTTPSRequired bool `koanf:"https_required"` ContentTypeMustBeHTML bool `koanf:"content_type_must_be_html"` }
CheckConfig holds the configuration for URL checking.
type CheckError ¶
type CheckError struct {
Msg string
}
func (CheckError) Error ¶
func (e CheckError) Error() string
type CheckErrorMSG ¶
type CheckErrorMSG int
const ( ErrInvalidSchema CheckErrorMSG = iota ErrFileNotAllowed ErrMaxRedirectsExceeded ErrSizeExceeded ErrURLLengthExceeded ErrLoginKeywordsFound ErrXSSDetected ErrUnreachable ErrMustHaveTLD ErrURLCannotContainCreds ErrURLCannotEndWithSlash ErrHTTPClientTimeout ErrHTTPSRequired ErrDNSRecordNotFound ErrSeekerNotInitialized ErrIsNotAbsoluteURL ErrContentTypeNotAllowed ErrContentTypeIsEmpty ErrDNSNameValueNull )
type Seeker ¶
type Seeker struct { Config CheckConfig InputURL string Client *colly.Collector Logs *SeekerLogs }
func NewSeeker ¶
func NewSeeker(config CheckConfig, collector *colly.Collector) (seeker *Seeker)
func (Seeker) GetCollector ¶
func (s Seeker) GetCollector() *colly.Collector
type SeekerLogs ¶
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func DefaultValidator ¶
func DefaultValidator() *Validator
func NewValidator ¶
func NewValidator(config CheckConfig) *Validator
func (Validator) ValidateOwnershipOverDNSTxtRecord ¶
func (Validator) ValidateSite ¶ added in v0.0.4
Validate a Website via visiting the URL and checking the response according to the configuration.
Click to show internal directories.
Click to hide internal directories.