Phx2Ban.ConnData (Phx2Ban v0.2.2)

This module exposes a struct that contains a subset of the data contained within the Plug.Conn struct. This struct is passed to the Phx2Ban.Rule.valid_request?/1 callback so that you can analyze the incoming traffic.

Summary

Functions

Convert a Plug.Conn struct to a Phx2Ban.ConnData struct

Types

@type t() :: %Phx2Ban.ConnData{
  host: Plug.Conn.host(),
  method: Plug.Conn.method(),
  raw_remote_ip: :inet.ip_address(),
  remote_ip: binary(),
  req_headers: Plug.Conn.headers(),
  req_route_exists?: boolean() | nil,
  request_path: binary(),
  status: Plug.Conn.int_status()
}

Functions

Link to this function

from_conn(conn)

@spec from_conn(conn :: Plug.Conn.t()) :: {:ok, t()} | {:error, atom()}

Convert a Plug.Conn struct to a Phx2Ban.ConnData struct