-
Notifications
You must be signed in to change notification settings - Fork 232
proxy: revive TCP proxy mode #496
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
Conversation
This was intentionally disabled as we did some major refactoring. Add it back now that things have stablized.
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.
Pull Request Overview
This PR revives the TCP proxy functionality that was previously disabled during major refactoring. The purpose is to restore TCP proxy mode now that the codebase has stabilized.
- Restores TCP proxy route conversion and backend handling
- Adds TCP connection support to the client module
- Implements proper TCP proxy logic with bidirectional copying
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/agentgateway/src/types/local.rs | Restores TCP route conversion logic and backend reference handling |
| crates/agentgateway/src/types/agent_xds.rs | Adds missing alpn field to BackendTLS configuration |
| crates/agentgateway/src/test_helpers/proxymock.rs | Adds TCP proxy test helpers and mock setup functions |
| crates/agentgateway/src/proxy/tcpproxy.rs | Implements complete TCP proxy functionality with backend resolution |
| crates/agentgateway/src/proxy/mod.rs | Adds TCP-specific error types for upstream call failures |
| crates/agentgateway/src/proxy/httpproxy.rs | Refactors service call building into reusable function and makes structs public |
| crates/agentgateway/src/proxy/gateway_test.rs | Adds basic TCP proxy test case |
| crates/agentgateway/src/proxy/gateway.rs | Moves TCP metrics tracking to gateway level |
| crates/agentgateway/src/http/backendtls.rs | Adds ALPN protocol configuration support |
| crates/agentgateway/src/client/mod.rs | Adds TCP call support with bidirectional connection copying |
| crates/agentgateway/src/client/hyperrustls/mod.rs | Renames HttpsConnector to TLSConnector for broader use |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| let service = match &selected_backend.backend { | ||
| SimpleBackend::Service(svc, _) => Some(strng::format!("{}/{}", svc.namespace, svc.hostname)), | ||
| _ => None, | ||
| }; |
Copilot
AI
Oct 2, 2025
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.
[nitpick] Consider extracting this service name formatting logic into a helper function since it may be reused elsewhere in the codebase.
| return Err(ProxyError::NoHealthyEndpoints); | ||
| }; | ||
| let dest = SocketAddr::from((*ip, target_port)); | ||
| log.add(move |l| l.request_handle = Some(handle)); |
Copilot
AI
Oct 2, 2025
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.
The log parameter is &mut Option<&mut RequestLog> but this code assumes it's always Some. This will panic if log is None.
| log.add(move |l| l.request_handle = Some(handle)); | |
| if let Some(log) = log { | |
| log.add(move |l| l.request_handle = Some(handle)); | |
| } |
| use http_body_util::BodyExt; | ||
| use hyper_util_fork::rt::TokioIo; | ||
| use rustls_pki_types::{DnsName, ServerName}; | ||
| use tonic::codegen::Service; |
Copilot
AI
Oct 2, 2025
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.
This import appears to be unused in the context of the changes shown. Consider removing if not needed.
| use tonic::codegen::Service; |
Followup to agentgateway/agentgateway#496 Signed-off-by: Art Berger <art.berger@solo.io>
This was intentionally disabled as we did some major refactoring. Add it back now that things have stablized.