-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: transparent proxy support (linux only) #343
Changes from 9 commits
c232281
9833874
c207d67
3eb4f40
00e5047
93838be
9a2e8e9
e065316
1955376
c0d682e
d58d874
651a9df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
tproxy-port: 7893 | ||
external-controller: 127.0.0.1:9090 | ||
mode: global | ||
log-level: debug |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,7 @@ impl Dispatcher { | |
|
||
/// Dispatch a UDP packet to outbound handler | ||
/// returns the close sender | ||
/// will ignore the source and destination in `Session` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this comment still valid? |
||
#[instrument] | ||
pub fn dispatch_datagram( | ||
&self, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,7 @@ impl InboundManager { | |
}; | ||
self.network_listeners | ||
.values() | ||
.for_each(|x| match x.listener_type { | ||
.for_each(|x: &NetworkInboundListener| match x.listener_type { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this necessary |
||
ListenerType::Http => { | ||
ports.port = Some(x.port); | ||
} | ||
|
@@ -98,6 +98,9 @@ impl InboundManager { | |
ListenerType::Mixed => { | ||
ports.mixed_port = Some(x.port); | ||
} | ||
ListenerType::TProxy => { | ||
ports.tproxy_port = Some(x.port); | ||
} | ||
}); | ||
|
||
ports | ||
|
@@ -147,6 +150,20 @@ impl InboundManager { | |
); | ||
} | ||
|
||
if let Some(tproxy_port) = ports.tproxy_port { | ||
network_listeners.insert( | ||
ListenerType::TProxy, | ||
NetworkInboundListener { | ||
name: "TProxy".to_string(), | ||
bind_addr: self.bind_address.clone(), | ||
port: tproxy_port, | ||
listener_type: ListenerType::TProxy, | ||
dispatcher: self.dispatcher.clone(), | ||
authenticator: self.authenticator.clone(), | ||
}, | ||
); | ||
} | ||
|
||
self.network_listeners = network_listeners; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a big fan of executing system commands in a program - at lease should we print out what we are executing so the users know what's happening under the hood?