Package io.grpc.xds
Class RoutingUtils
java.lang.Object
io.grpc.xds.RoutingUtils
Utilities for performing virtual host domain name matching and route matching.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static VirtualHost
findVirtualHostForHostName
(List<VirtualHost> virtualHosts, String hostName) Returns theVirtualHost
with the best match domain for the given hostname.private static String
getHeaderValue
(io.grpc.Metadata headers, String headerName) private static boolean
matchHostName
(String hostName, String pattern) Returnstrue
iffhostName
matches the domain namepattern
with case-insensitive.private static boolean
matchPath
(VirtualHost.Route.RouteMatch.PathMatcher pathMatcher, String fullMethodName) (package private) static boolean
matchRoute
(VirtualHost.Route.RouteMatch routeMatch, String fullMethodName, io.grpc.Metadata headers, ThreadSafeRandom random) Returnstrue
iff the givenVirtualHost.Route.RouteMatch
matches the RPC's full method name and headers.
-
Constructor Details
-
RoutingUtils
private RoutingUtils()
-
-
Method Details
-
findVirtualHostForHostName
@Nullable static VirtualHost findVirtualHostForHostName(List<VirtualHost> virtualHosts, String hostName) Returns theVirtualHost
with the best match domain for the given hostname. -
matchHostName
Returnstrue
iffhostName
matches the domain namepattern
with case-insensitive.Wildcard pattern rules:
- A single asterisk (*) matches any domain.
- Asterisk (*) is only permitted in the left-most or the right-most part of the pattern, but not both.
-
matchRoute
static boolean matchRoute(VirtualHost.Route.RouteMatch routeMatch, String fullMethodName, io.grpc.Metadata headers, ThreadSafeRandom random) Returnstrue
iff the givenVirtualHost.Route.RouteMatch
matches the RPC's full method name and headers. -
matchPath
private static boolean matchPath(VirtualHost.Route.RouteMatch.PathMatcher pathMatcher, String fullMethodName) -
getHeaderValue
-