-
Hi all, I want to implement simple transparent proxy. According to the kernel documentation I should enable IP_TRANSPARENT option for listener socket. How I can enable this option? |
Beta Was this translation helpful? Give feedback.
Answered by
Darksonn
Apr 14, 2021
Replies: 1 comment 1 reply
-
You can use the use nix::sys::socket::setsockopt;
use nix::sys::socket::sockopt::IpTransparent;
use std::os::unix::io::AsRawFd;
let listener = ...;
let fd = listener.as_raw_fd();
let res = setsockopt(fd, IpTransparent, &true); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
alishir
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use the
setsockopt
method in thenix
crate for this.