Liking cljdoc? Tell your friends :D

wagoe.platform.core.http.client-ip

The address a request came from, as opposed to the proxy that delivered it.

:remote-addr is the peer, which behind a reverse proxy is the proxy. Any client can send X-Forwarded-For, so it is read only when the peer is a trusted proxy, and from the right: each proxy appends the address it saw, so the first hop that is not one of ours is the client.

The address a request came from, as opposed to the proxy that delivered it.

`:remote-addr` is the peer, which behind a reverse proxy is the proxy. Any
client can send X-Forwarded-For, so it is read only when the peer is a
trusted proxy, and from the right: each proxy appends the address it saw,
so the first hop that is not one of ours is the client.
raw docstring

client-ipclj

(client-ip request cidrs)

The client's address: :remote-addr, unless that is a trusted proxy, in which case the right-most X-Forwarded-For hop that is not one. Nil when the hop the walk stops at is not an address (unknown): the proxy's own address would put an outside client inside the proxy's network. cidrs comes from parse-trusted-proxies.

The client's address: `:remote-addr`, unless that is a trusted proxy, in
which case the right-most X-Forwarded-For hop that is not one. Nil when the
hop the walk stops at is not an address (`unknown`): the proxy's own address
would put an outside client inside the proxy's network. `cidrs` comes from
`parse-trusted-proxies`.
sourceraw docstring

in-any?clj

(in-any? ip cidrs)

True when ip lies in one of cidrs, each read as the trust walk reads it (strings or parse-ip / parse-cidr values). Anything unparseable, nil included, is false.

True when `ip` lies in one of `cidrs`, each read as the trust walk reads it
(strings or `parse-ip` / `parse-cidr` values). Anything unparseable, nil
included, is false.
sourceraw docstring

in-network?clj

(in-network? ip cidr)

True when ip lies in cidr; see in-any?.

True when `ip` lies in `cidr`; see `in-any?`.
sourceraw docstring

parse-cidrclj

(parse-cidr s)

{:bytes .. :prefix n} for "10.0.0.0/8", "2001:db8::/32", or a bare address (a /32 or /128); nil when it is none of these.

`{:bytes .. :prefix n}` for "10.0.0.0/8", "2001:db8::/32", or a bare
address (a /32 or /128); nil when it is none of these.
sourceraw docstring

parse-ipclj

(parse-ip s)

The bytes of an IPv4 (4) or IPv6 (16) literal, or nil. An IPv4-mapped IPv6 address parses as its IPv4 address, so a dual-stack socket matches IPv4 ranges.

The bytes of an IPv4 (4) or IPv6 (16) literal, or nil. An IPv4-mapped IPv6
address parses as its IPv4 address, so a dual-stack socket matches IPv4
ranges.
sourceraw docstring

parse-trusted-proxiesclj

(parse-trusted-proxies entries)

{:cidrs [..]} for the :trusted-proxies setting, or a configuration error naming the entries that are not CIDRs. Absent means trust nothing.

`{:cidrs [..]}` for the `:trusted-proxies` setting, or a configuration error
naming the entries that are not CIDRs. Absent means trust nothing.
sourceraw docstring

request-ipclj

(request-ip request)

The client address resolved on the request; nil when the middleware could not resolve one. The peer only when the request did not pass through the client-ip middleware.

The client address resolved on the request; nil when the middleware could
not resolve one. The peer only when the request did not pass through the
client-ip middleware.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close