data HTTP::Proxies(networks: Array[[Bytes, Int]])

Trusted proxies: addresses or networks (10.0.0.0/8, fd00::/8).

proxies = HTTP::Proxies.of(["10.0.0.0/8", "::1"])
proxies.include?("10.1.2.3")    # => true
proxies.include?("192.0.2.1")   # => false
HTTP::Proxies.of(["10.0.0.0/33"])   # raises ArgumentError

<std:http>:600

Class methods

def self.none -> HTTP::Proxies

No trusted proxy.

<std:http>:605

def self.of(specs: Array[String]) -> HTTP::Proxies

The proxies at specs, each a numeric address (127.0.0.1, ::1) or a network (10.0.0.0/8). Raises ArgumentError for anything else.

<std:http>:609

Methods

def networks -> Array[[Bytes, Int]]

Each network's address bytes (4 or 16) and prefix length in bits.

<std:http>:602

def to_h -> Hash[Symbol, Object]

The fields as a Hash, by name.

<std:http>:605

def with(networks: Array[[Bytes, Int]] = …) -> HTTP::Proxies

A copy with the fields given replaced.

<std:http>:605

def empty? -> Bool

Whether no proxy is trusted.

<std:http>:623

def include?(host: String) -> Bool

Whether the numeric address host is in one of the networks; false for anything that is not an address.

<std:http>:627