Skip to content

Commit 3e926c7

Browse files
committed
Document that RightmostForwarded requires "forwarded-header" feature, closes #42
1 parent a79604a commit 3e926c7

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ separate extractors for each proxy / source header.
3535
| [`XRealIp`] | `X-Real-Ip` | Nginx |
3636
| [`ConnectInfo`] | N/A (uses socket address) | No proxy, e.g. listening directly to 80 port |
3737

38+
[`RightmostForwarded`] requires enabling the `forwarded-header` feature.
39+
3840
## Configurable extractor
3941

4042
The configurable extractor assumes initializing [`ClientIpSource`] at runtime

src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg_attr(docsrs, feature(doc_cfg))]
12
#![doc = include_str!("../README.md")]
23
#[cfg(feature = "connect-info")]
34
use std::net::SocketAddr;
@@ -70,6 +71,9 @@ define_extractor!(
7071
#[cfg(feature = "forwarded-header")]
7172
define_extractor!(
7273
/// Extracts the rightmost IP from `Forwarded` header
74+
///
75+
/// Requires the `forwarded-header` feature.
76+
#[cfg_attr(docsrs, doc(cfg(feature = "forwarded-header")))]
7377
RightmostForwarded,
7478
client_ip::rightmost_forwarded
7579
);
@@ -125,7 +129,10 @@ pub enum ClientIpSource {
125129
/// IP from the `Fly-Client-IP` header
126130
FlyClientIp,
127131
#[cfg(feature = "forwarded-header")]
128-
/// Rightmost IP from the `Forwarded` header
132+
/// Rightmost IP from the `Forwarded` header.
133+
///
134+
/// Requires the `forwarded-header` feature.
135+
#[cfg_attr(docsrs, doc(cfg(feature = "forwarded-header")))]
129136
RightmostForwarded,
130137
/// Rightmost IP from the `X-Forwarded-For` header
131138
RightmostXForwardedFor,

0 commit comments

Comments
 (0)