ExAbby.BotDetector (ex_abby v0.5.1)

Copy Markdown

Configurable, transient bot classification for request-aware integrations.

Detectors receive an ExAbby.BotDetector.Context and return either :human or {:bot, static_atom_name}. The returned atom is safe to place in a session; user-agent and connection data stay in the transient context.

Summary

Functions

Returns the effective bot detection configuration.

Classifies a raw user-agent string or Plug.Conn as :human or a bot.

Functions

config()

@spec config() :: keyword()

Returns the effective bot detection configuration.

Detection is enabled by default with the built-in user-agent detector and a "control" fallback variation.

detect(input)

@spec detect(
  String.t()
  | Plug.Conn.t()
  | ExAbby.BotDetector.Context.t()
  | nil
  | term()
) ::
  :human | {:bot, atom()}

Classifies a raw user-agent string or Plug.Conn as :human or a bot.

Configured detector modules are called in order with a normalized context. Invalid detector responses are ignored so request-derived data cannot become bot status.