Skip to content

Commit 11428df

Browse files
committed
Suffix Socket::(set_)ip_transparent with v4
To indicate it an option for IPv4 sockets.
1 parent 0e3f436 commit 11428df

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/socket.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,12 +1189,12 @@ impl Socket {
11891189

11901190
/// Get the value of the `IP_TRANSPARENT` option on this socket.
11911191
///
1192-
/// For more information about this option, see [`set_ip_transparent`].
1192+
/// For more information about this option, see [`set_ip_transparent_v4`].
11931193
///
1194-
/// [`set_ip_transparent`]: Socket::set_ip_transparent
1194+
/// [`set_ip_transparent_v4`]: Socket::set_ip_transparent_v4
11951195
#[cfg(all(feature = "all", target_os = "linux"))]
11961196
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
1197-
pub fn ip_transparent(&self) -> io::Result<bool> {
1197+
pub fn ip_transparent_v4(&self) -> io::Result<bool> {
11981198
unsafe {
11991199
getsockopt::<c_int>(self.as_raw(), sys::IPPROTO_IP, libc::IP_TRANSPARENT)
12001200
.map(|transparent| transparent != 0)
@@ -1218,7 +1218,7 @@ impl Socket {
12181218
/// requires that this option be set on the redirected socket.
12191219
#[cfg(all(feature = "all", target_os = "linux"))]
12201220
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
1221-
pub fn set_ip_transparent(&self, transparent: bool) -> io::Result<()> {
1221+
pub fn set_ip_transparent_v4(&self, transparent: bool) -> io::Result<()> {
12221222
unsafe {
12231223
setsockopt(
12241224
self.as_raw(),

tests/socket.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,8 +1366,8 @@ test!(
13661366
#[cfg(all(feature = "all", target_os = "linux"))]
13671367
test!(
13681368
#[ignore = "setting `IP_TRANSPARENT` requires the `CAP_NET_ADMIN` capability (works when running as root)"]
1369-
ip_transparent,
1370-
set_ip_transparent(true)
1369+
ip_transparent_v4,
1370+
set_ip_transparent_v4(true)
13711371
);
13721372
#[cfg(all(feature = "all", any(target_os = "fuchsia", target_os = "linux")))]
13731373
test!(

0 commit comments

Comments
 (0)