Enum Class Socks5ProxyScope

java.lang.Object
java.lang.Enum<Socks5ProxyScope>
org.apache.pulsar.client.api.Socks5ProxyScope
All Implemented Interfaces:
Serializable, Comparable<Socks5ProxyScope>, Constable

@Public @Stable public enum Socks5ProxyScope extends Enum<Socks5ProxyScope>
Selector that controls which kinds of connections should be routed through the configured SOCKS5 proxy when a proxy address is set on a Pulsar client or admin builder.

Historically, the SOCKS5 proxy configured on PulsarClient only affected the Pulsar binary protocol connections to brokers, and the HTTP lookup / failover clients inside PulsarClient silently ignored it. The scope selector makes this behavior explicit and also allows users to route HTTP traffic (HTTP lookups, failover HTTP clients, and PulsarAdmin REST calls) through the same SOCKS5 proxy.

For PulsarClient, the default is BINARY_ONLY so existing behavior is preserved. For PulsarAdmin, the default is HTTP_ONLY because admin traffic is HTTP by nature.

  • Enum Constant Details

    • BINARY_ONLY

      public static final Socks5ProxyScope BINARY_ONLY
      Apply the SOCKS5 proxy only to Pulsar binary protocol connections to brokers. HTTP lookups and HTTP-based failover connections ignore the proxy. This matches the pre-existing behavior of PulsarClient and is the default for client builders.
    • HTTP_ONLY

      public static final Socks5ProxyScope HTTP_ONLY
      Apply the SOCKS5 proxy only to HTTP traffic, i.e. HTTP/HTTPS lookups, failover HTTP clients, and REST calls issued by PulsarAdmin. Pulsar binary protocol connections to brokers do not use the proxy.
    • BOTH

      public static final Socks5ProxyScope BOTH
      Apply the SOCKS5 proxy to both Pulsar binary protocol connections and HTTP traffic.
  • Method Details

    • values

      public static Socks5ProxyScope[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Socks5ProxyScope valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • appliesToBinary

      public boolean appliesToBinary()
      Returns:
      true if this scope routes Pulsar binary protocol connections through SOCKS5.
    • appliesToHttp

      public boolean appliesToHttp()
      Returns:
      true if this scope routes HTTP/HTTPS traffic through SOCKS5.