Documentation
¶
Index ¶
- Constants
- type AllowEmailValidationConfig
- type AllowedBotConfig
- type BotConfig
- type BotEntity
- type BotResult
- type Callbacks
- type DeniedBotConfig
- type DenyEmailValidationConfig
- type DetectedSensitiveInfoEntity
- type EmailValidationConfig
- type EmailValidationResult
- type EmailValidatorOverridesValidatorResponse
- type EmailValidity
- type FilterResult
- type IJsReqBotIdentifier
- type IJsReqEmailValidatorOverrides
- type IJsReqFilterOverrides
- type IJsReqSensitiveInformationIdentifier
- type IJsReqVerifyBot
- type JsReqFactory
- type JsReqInstance
- func (i *JsReqInstance) Close(ctx context.Context) error
- func (i *JsReqInstance) DetectBot(ctx context.Context, request string, options interface{}) (BotResult, error)
- func (i *JsReqInstance) DetectSensitiveInfo(ctx context.Context, content string, options SensitiveInfoConfig) SensitiveInfoResult
- func (i *JsReqInstance) GenerateFingerprint(ctx context.Context, request string, characteristics []string) (string, error)
- func (i *JsReqInstance) IsValidEmail(ctx context.Context, candidate string, options interface{}) (EmailValidationResult, error)
- func (i *JsReqInstance) MatchFilters(ctx context.Context, request string, localFields string, expressions []string, ...) (FilterResult, error)
- func (i *JsReqInstance) ValidateCharacteristics(ctx context.Context, request string, characteristics []string) error
- type SensitiveInfoConfig
- type SensitiveInfoEntities
- type SensitiveInfoEntitiesAllow
- type SensitiveInfoEntitiesDeny
- type SensitiveInfoEntity
- type SensitiveInfoEntityCreditCardNumber
- type SensitiveInfoEntityCustom
- type SensitiveInfoEntityEmail
- type SensitiveInfoEntityIpAddress
- type SensitiveInfoEntityPhoneNumber
- type SensitiveInfoResult
- type VerifyBotValidatorResponse
Constants ¶
View Source
const ( Yes emailValidatorOverridesValidatorResponse = iota No emailValidatorOverridesValidatorResponse = iota Unknown emailValidatorOverridesValidatorResponse = iota )
View Source
const ( Verified verifyBotValidatorResponse = iota Spoofed verifyBotValidatorResponse = iota Unverifiable verifyBotValidatorResponse = iota )
View Source
const ( Valid emailValidity = iota Invalid emailValidity = iota )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowedBotConfig ¶
type Callbacks ¶
type Callbacks struct {
// DetectSensitiveInfo classifies tokens that the native analyzer didn't
// recognise. Return nil for a token to leave it unclassified.
DetectSensitiveInfo func(ctx context.Context, tokens []string) []SensitiveInfoEntity
}
Callbacks lets callers override the default fail-open import implementations. Any nil field uses a built-in default.
Mirrors arcjet-py's `ImportCallbacks` so the user-visible custom-detect hook has parity across SDKs.
type DeniedBotConfig ¶
type DetectedSensitiveInfoEntity ¶
type DetectedSensitiveInfoEntity struct {
Start uint32
End uint32
IdentifiedType SensitiveInfoEntity
}
type EmailValidationConfig ¶
type EmailValidationConfig interface {
// contains filtered or unexported methods
}
type EmailValidationResult ¶
type EmailValidationResult struct {
Validity EmailValidity
Blocked []string
}
type EmailValidatorOverridesValidatorResponse ¶
type EmailValidatorOverridesValidatorResponse interface {
// contains filtered or unexported methods
}
type EmailValidity ¶
type EmailValidity interface {
// contains filtered or unexported methods
}
type FilterResult ¶
type IJsReqBotIdentifier ¶
type IJsReqEmailValidatorOverrides ¶
type IJsReqEmailValidatorOverrides interface {
IsFreeEmail(
ctx context.Context,
domain string,
) EmailValidatorOverridesValidatorResponse
IsDisposableEmail(
ctx context.Context,
domain string,
) EmailValidatorOverridesValidatorResponse
HasMxRecords(
ctx context.Context,
domain string,
) EmailValidatorOverridesValidatorResponse
HasGravatar(
ctx context.Context,
email string,
) EmailValidatorOverridesValidatorResponse
}
type IJsReqFilterOverrides ¶
type IJsReqSensitiveInformationIdentifier ¶
type IJsReqSensitiveInformationIdentifier interface {
Detect(
ctx context.Context,
tokens []string,
) []*SensitiveInfoEntity
}
type IJsReqVerifyBot ¶
type IJsReqVerifyBot interface {
Verify(
ctx context.Context,
botId string,
ip string,
) VerifyBotValidatorResponse
}
type JsReqFactory ¶
type JsReqFactory struct {
// contains filtered or unexported fields
}
func NewFactory ¶
func NewFactory(ctx context.Context, cb Callbacks) (*JsReqFactory, error)
NewFactory compiles the js_req component and wires its host import callbacks, applying fail-open defaults for any callback left unset.
Mirrors arcjet-py's wire_imports and arcjet-js's createCoreImports: callbacks in, a ready-to-instantiate factory out. Keeping the five-interface wiring inside this package means callers never handle the import interfaces individually.
func NewJsReqFactory ¶
func NewJsReqFactory( ctx context.Context, emailValidatorOverrides IJsReqEmailValidatorOverrides, sensitiveInformationIdentifier IJsReqSensitiveInformationIdentifier, verifyBot IJsReqVerifyBot, botIdentifier IJsReqBotIdentifier, filterOverrides IJsReqFilterOverrides, ) (*JsReqFactory, error)
func (*JsReqFactory) Close ¶
func (f *JsReqFactory) Close(ctx context.Context)
func (*JsReqFactory) Instantiate ¶
func (f *JsReqFactory) Instantiate(ctx context.Context) (*JsReqInstance, error)
type JsReqInstance ¶
type JsReqInstance struct {
// contains filtered or unexported fields
}
func (*JsReqInstance) DetectSensitiveInfo ¶
func (i *JsReqInstance) DetectSensitiveInfo( ctx context.Context, content string, options SensitiveInfoConfig, ) SensitiveInfoResult
func (*JsReqInstance) GenerateFingerprint ¶
func (*JsReqInstance) IsValidEmail ¶
func (i *JsReqInstance) IsValidEmail( ctx context.Context, candidate string, options interface{}, ) (EmailValidationResult, error)
func (*JsReqInstance) MatchFilters ¶
func (i *JsReqInstance) MatchFilters( ctx context.Context, request string, localFields string, expressions []string, allowIfMatch bool, ) (FilterResult, error)
func (*JsReqInstance) ValidateCharacteristics ¶
type SensitiveInfoConfig ¶
type SensitiveInfoConfig struct {
Entities SensitiveInfoEntities
ContextWindowSize *uint32
SkipCustomDetect bool
}
type SensitiveInfoEntities ¶
type SensitiveInfoEntities interface {
// contains filtered or unexported methods
}
type SensitiveInfoEntitiesAllow ¶
type SensitiveInfoEntitiesAllow struct {
Value []SensitiveInfoEntity
}
type SensitiveInfoEntitiesDeny ¶
type SensitiveInfoEntitiesDeny struct {
Value []SensitiveInfoEntity
}
type SensitiveInfoEntity ¶
type SensitiveInfoEntity interface {
// contains filtered or unexported methods
}
type SensitiveInfoEntityCreditCardNumber ¶
type SensitiveInfoEntityCreditCardNumber struct{}
type SensitiveInfoEntityCustom ¶
type SensitiveInfoEntityCustom struct {
Value string
}
type SensitiveInfoEntityEmail ¶
type SensitiveInfoEntityEmail struct{}
type SensitiveInfoEntityIpAddress ¶
type SensitiveInfoEntityIpAddress struct{}
type SensitiveInfoEntityPhoneNumber ¶
type SensitiveInfoEntityPhoneNumber struct{}
type SensitiveInfoResult ¶
type SensitiveInfoResult struct {
Allowed []DetectedSensitiveInfoEntity
Denied []DetectedSensitiveInfoEntity
}
type VerifyBotValidatorResponse ¶
type VerifyBotValidatorResponse interface {
// contains filtered or unexported methods
}
Click to show internal directories.
Click to hide internal directories.