public virtual void AddReRoutes(string name, string upstreamPathTemplate, string upstreamHost, string downstreamScheme, string downstreamPathTemplate, List <string> upstreamHttpMethods = null, Dictionary <string, int> downstreamHostAndPorts = null) { var reRoute = new OcelotReRoute( Id, name, upstreamPathTemplate, upstreamHost, downstreamScheme, downstreamPathTemplate ); if (upstreamHttpMethods != null) { foreach (var item in upstreamHttpMethods) { reRoute.AddUpstreamHttpMethod(item); } } if (downstreamHostAndPorts != null) { foreach (var item in downstreamHostAndPorts) { reRoute.AddDownstreamHostAndPort(item.Key, item.Value); } } ReRoutes.Add(reRoute); }
public List <ReRouteDownstreamHostAndPort> Resolve(OcelotReRouteDto source, OcelotReRoute destination, List <ReRouteDownstreamHostAndPort> destMember, ResolutionContext context) { if (source == null || source.DownstreamHostAndPorts == null) { return(null); } foreach (var item in source.DownstreamHostAndPorts) { destination.AddDownstreamHostAndPort(item.Host, item.Port.Value); } return(destination.DownstreamHostAndPorts); }