Class DnsIntentOriginalDestinationResolver

java.lang.Object
org.mockserver.netty.proxy.DnsIntentOriginalDestinationResolver
All Implemented Interfaces:
TransparentProxyHandler.OriginalDestinationResolver

public class DnsIntentOriginalDestinationResolver extends Object implements TransparentProxyHandler.OriginalDestinationResolver
Resolves the original destination of a transparently intercepted TCP connection by consulting the DnsIntentRegistry — a record of hostname-to-IP answers that MockServer's DNS server has handed out.

When this applies: DNS-steering mode. The client resolved a hostname via MockServer's DNS server, received an IP address (A/AAAA record) that routes to MockServer, and connected by IP. This resolver recovers the intended hostname so that expectation matching and forwarding work by name.

Chain position: this resolver runs after the conntrack resolver in the CompositeOriginalDestinationResolver chain. A real iptables-REDIRECT original destination (from conntrack or SO_ORIGINAL_DST) always wins; this resolver only fills the gap when conntrack returns null (e.g., no iptables rule, or the platform is not Linux).

Unresolved address: this resolver intentionally returns an unresolved (named) InetSocketAddress via InetSocketAddress.createUnresolved(java.lang.String, int). Downstream forwarding logic resolves the hostname itself, and MockServer's existing loop-prevention header guards against a DNS-to-self loop.

See Also:
  • Constructor Details

    • DnsIntentOriginalDestinationResolver

      public DnsIntentOriginalDestinationResolver()
  • Method Details