pingora
pingora copied to clipboard
Add Methods to SocketDigest for Retrieving SO_ORIGINAL_DST Information
What is the problem your feature solves, or the need it fulfills?
In Kubernetes environments, especially when using sidecar proxies, it is common to redirect traffic using iptables with the REDIRECT target. This is often used to transparently proxy traffic to services like Envoy or Istio. However, once the traffic is redirected, it can be challenging to determine the original destination of the traffic. This information is crucial for various use cases, such as logging, monitoring, and applying specific routing logic based on the original destination.
Describe the solution you'd like
I propose adding methods to the SocketDigest
struct to retrieve information about SO_ORIGINAL_DST
. This socket option allows us to obtain the original destination address of a redirected packet. By exposing this information through SocketDigest
, users can easily access the original destination of the traffic, which is particularly useful in Kubernetes sidecar proxy scenarios.
Describe alternatives you've considered
There are no significant alternatives for obtaining SO_ORIGINAL_DST
information in a transparent proxy setup.
Additional context
- The absence of this feature limits the use of Pingora for implementing sidecar proxies in Kubernetes.
- Similar implementation in Linkerd2: Linkerd2 Proxy Original Destination