Skip to content

Commit 47eb59f

Browse files
committed
update docs and make Request::forwarded_for private
1 parent 031253c commit 47eb59f

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/request.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,28 @@ impl Request {
5959
}
6060
}
6161

62-
#[doc(hidden)]
62+
/// Sets a string representation of the peer address of this
63+
/// request. This might take the form of an ip/fqdn and port or a
64+
/// local socket address.
6365
pub fn set_peer_addr(&mut self, peer_addr: Option<impl std::string::ToString>) {
6466
self.peer_addr = peer_addr.map(|addr| addr.to_string());
6567
}
6668

67-
#[doc(hidden)]
69+
/// Sets a string representation of the local address that this
70+
/// request was received on. This might take the form of an ip/fqdn and
71+
/// port, or a local socket address.
6872
pub fn set_local_addr(&mut self, local_addr: Option<impl std::string::ToString>) {
6973
self.local_addr = local_addr.map(|addr| addr.to_string());
7074
}
7175

72-
/// Get the peer socket address for the underlying transport, if appropriate
76+
/// Get the peer socket address for the underlying transport, if
77+
/// that information is available for this request.
7378
pub fn peer_addr(&self) -> Option<&str> {
7479
self.peer_addr.as_deref()
7580
}
7681

77-
/// Get the local socket address for the underlying transport, if appropriate
82+
/// Get the local socket address for the underlying transport, if
83+
/// that information is available for this request.
7884
pub fn local_addr(&self) -> Option<&str> {
7985
self.local_addr.as_deref()
8086
}
@@ -84,9 +90,7 @@ impl Request {
8490
self.forwarded_for().or(self.peer_addr())
8591
}
8692

87-
/// Parses the Forwarded or X-Forwarded-For headers.
88-
/// The returned String will either be an IP address or a domain and an optional port.
89-
pub fn forwarded_for(&self) -> Option<&str> {
93+
fn forwarded_for(&self) -> Option<&str> {
9094
if let Some(header) = self.header(&"Forwarded".parse().unwrap()) {
9195
header.as_str().split(";").find_map(|key_equals_value| {
9296
let parts = key_equals_value.split("=").collect::<Vec<_>>();

src/response.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,16 @@ impl Response {
335335
self.version
336336
}
337337

338-
#[doc(hidden)]
338+
/// Sets a string representation of the peer address that this
339+
/// response was sent to. This might take the form of an ip/fqdn
340+
/// and port or a local socket address.
339341
pub fn set_peer_addr(&mut self, peer_addr: Option<impl std::string::ToString>) {
340342
self.peer_addr = peer_addr.map(|addr| addr.to_string());
341343
}
342344

343-
#[doc(hidden)]
345+
/// Sets a string representation of the local address that this
346+
/// response was sent on. This might take the form of an ip/fqdn and
347+
/// port, or a local socket address.
344348
pub fn set_local_addr(&mut self, local_addr: Option<impl std::string::ToString>) {
345349
self.local_addr = local_addr.map(|addr| addr.to_string());
346350
}

0 commit comments

Comments
 (0)