Package io.grpc.xds
Class RoutingUtils
- java.lang.Object
-
- io.grpc.xds.RoutingUtils
-
final class RoutingUtils extends java.lang.ObjectUtilities for performing virtual host domain name matching and route matching.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateRoutingUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static VirtualHostfindVirtualHostForHostName(java.util.List<VirtualHost> virtualHosts, java.lang.String hostName)Returns theVirtualHostwith the best match domain for the given hostname.private static java.lang.StringgetHeaderValue(io.grpc.Metadata headers, java.lang.String headerName)private static booleanmatchHostName(java.lang.String hostName, java.lang.String pattern)ReturnstrueiffhostNamematches the domain namepatternwith case-insensitive.private static booleanmatchPath(VirtualHost.Route.RouteMatch.PathMatcher pathMatcher, java.lang.String fullMethodName)(package private) static booleanmatchRoute(VirtualHost.Route.RouteMatch routeMatch, java.lang.String fullMethodName, io.grpc.Metadata headers, ThreadSafeRandom random)Returnstrueiff the givenVirtualHost.Route.RouteMatchmatches the RPC's full method name and headers.
-
-
-
Method Detail
-
findVirtualHostForHostName
@Nullable static VirtualHost findVirtualHostForHostName(java.util.List<VirtualHost> virtualHosts, java.lang.String hostName)
Returns theVirtualHostwith the best match domain for the given hostname.
-
matchHostName
private static boolean matchHostName(java.lang.String hostName, java.lang.String pattern)ReturnstrueiffhostNamematches the domain namepatternwith 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, java.lang.String fullMethodName, io.grpc.Metadata headers, ThreadSafeRandom random)
Returnstrueiff the givenVirtualHost.Route.RouteMatchmatches the RPC's full method name and headers.
-
matchPath
private static boolean matchPath(VirtualHost.Route.RouteMatch.PathMatcher pathMatcher, java.lang.String fullMethodName)
-
getHeaderValue
@Nullable private static java.lang.String getHeaderValue(io.grpc.Metadata headers, java.lang.String headerName)
-
-