microsoft / reverse-proxy

A toolkit for developing high-performance HTTP reverse proxy applications.
https://microsoft.github.io/reverse-proxy
MIT License
8.59k stars 842 forks source link

Add parameters to IDestinationResolver ResolveDestinationsAsync method #2663

Open ayrloong opened 2 days ago

ayrloong commented 2 days ago

I think adding a ServiceName parameter to IDestinationResolver ResolveDestinationsAsync can facilitate third-party service discovery queries

Here https://github.com/dotnet/aspire/blob/main/src/Microsoft.Extensions.ServiceDiscovery.Yarp/ServiceDiscoveryDestinationResolver.cs#L60 If we have a ServiceName parameter, we can use the Microsoft.Extensions.ServiceDiscovery package to implement a service discovery very well.

Also, I think IReadOnlyDictionary<string, DestinationConfig> destinations may not be necessary because we can find DestinationConfig in Microsoft.Extensions.ServiceDiscovery ServiceEndpointResolver

ayrloong commented 2 days ago

After careful consideration, we can add a method to achieve this. I may have a misunderstanding of the ResolveDestinationsAsync method.