Skip to content

How to set the source IP address for forwarded requests when using the https_connect_proxy setting #558

Answered by GlenDC
ShabbirHasan1 asked this question in Q&A
Discussion options

You must be logged in to vote

Instead of binding many proxies to each IP you can just bind to an interface:

// create tls proxy
shutdown.spawn_task_fn(async |guard| {
    let tcp_service = TcpListener::build()
        .bind(Interface::new_device("ens18"))
        .await
        .expect("proxy to bind to interface ens18");

Or if you need more options you can use socket options:

// create tls proxy
shutdown.spawn_task_fn(async |guard| {
    let tcp_service = TcpListener::build()
        .bind(SocketOptions {
            device: Some(DeviceName::new("ens18")),
            ..
        })
        .await
        .expect("proxy to bind to interface ens18");

Note that this only is available on linux, android and the like.
An…

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ShabbirHasan1
Comment options

Answer selected by ShabbirHasan1
Comment options

You must be logged in to vote
3 replies
@ShabbirHasan1
Comment options

@ShabbirHasan1
Comment options

@GlenDC
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants