1 instantiation of DevTunnelPortResource
Aspire.Hosting.DevTunnels (1)
DevTunnelResourceBuilderExtensions.cs (1)
610var portResource = new DevTunnelPortResource(
74 references to DevTunnelPortResource
Aspire.Hosting.DevTunnels (37)
DevTunnelMonitor.cs (12)
41private readonly Dictionary<DevTunnelPortResource, Task> _endpointEvents = []; 42private readonly HashSet<DevTunnelPortResource> _allocatedEndpoints = []; 43private readonly Dictionary<DevTunnelPortResource, Exception> _endpointErrors = []; 69var ports = new Dictionary<DevTunnelPortResource, int>(); 70foreach (var port in _resource.Ports) 82foreach (var port in ports.Keys) 105foreach (var port in _resource.Ports) 323private async Task RefreshAccessAsync(Run run, DevTunnelPortResource? port, int? portNumber) 628private async Task PublishEndpointEventAsync(DevTunnelPortResource port) 678private Task DeactivatePortUrlsAsync(DevTunnelPortResource port) 772private sealed class Run(string tunnelId, Dictionary<DevTunnelPortResource, int> expectedPorts, string friendlyTunnelId, DateTimeOffset startedAt, CancellationToken stoppingToken) 775public Dictionary<DevTunnelPortResource, int> ExpectedPorts { get; } = expectedPorts;
DevTunnelResource.cs (2)
37internal List<DevTunnelPortResource> Ports { get; } = []; 61/// Initializes a new instance of the <see cref="DevTunnelPortResource"/> class, representing a single forwarded endpoint/port on a dev tunnel.
DevTunnelResourceBuilderExtensions.cs (23)
158foreach (var portResource in tunnelResource.Ports) 192async Task StartPortAsync(DevTunnelPortResource portResource) 440var portResource = tunnelBuilder.Resource.Ports 463var portResource = tunnelBuilder.Resource.Ports 522foreach (var port in tunnelResource.Resource.Ports.Where(p => p.TargetEndpoint.Resource == targetResource.Resource)) 610var portResource = new DevTunnelPortResource( 635DevTunnelPortResource.ShowTunnelUrlsCommandName, 666if (urls.FirstOrDefault(u => string.Equals(u.Endpoint?.EndpointName, DevTunnelPortResource.TunnelEndpointName, StringComparisons.EndpointAnnotationName) 674if (urls.FirstOrDefault(u => string.Equals(u.Endpoint?.EndpointName, DevTunnelPortResource.TunnelEndpointName, StringComparisons.EndpointAnnotationName) 687var portResource = (DevTunnelPortResource)context.Resource; 717internal static async Task UpdatePortAsync(DevTunnelPortResource portResource, bool available, ResourceNotificationService notifications, ResourceLoggerService logs, CancellationToken cancellationToken) 781if (string.Equals(endpointName, DevTunnelPortResource.TunnelEndpointName, StringComparisons.EndpointAnnotationName) 806internal static async Task UpdatePortAccessAsync(DevTunnelPortResource portResource, ResourceNotificationService notifications, ResourceLoggerService logs, DateTimeOffset now) 827internal static async Task StopPortAsync(DevTunnelPortResource portResource, IServiceProvider services, CancellationToken cancellationToken) 853private static async Task<ExecuteCommandResult> ShowTunnelUrlsAsync(DevTunnelPortResource portResource, ExecuteCommandContext context) 888private static List<ResourcePropertySnapshot> GetUrlProperties(DevTunnelPortResource portResource) 897new(DevTunnelPortResource.TunnelUrlPropertyName, NormalizeUrl(portUri)) 906properties.Add(new(DevTunnelPortResource.InspectUrlPropertyName, inspectUrl) 915properties.Add(new(DevTunnelPortResource.LocalEndpointUrlPropertyName, localUrl) 937name is DevTunnelPortResource.TunnelUrlPropertyName 938or DevTunnelPortResource.InspectUrlPropertyName 939or DevTunnelPortResource.LocalEndpointUrlPropertyName;
Aspire.Hosting.DevTunnels.Tests (33)
DevTunnelMonitorTests.cs (3)
256var endpoint = test.Port.GetEndpoint(DevTunnelPortResource.TunnelEndpointName); 263var tunnelUrl = Assert.Single(context.Urls, url => url.Endpoint?.EndpointName == DevTunnelPortResource.TunnelEndpointName); 622var otherPort = Assert.Single(test.Tunnel.Ports, p => p.TargetEndpoint.EndpointName == "other");
DevTunnelResourceBuilderExtensionsTests.cs (29)
34var tunnelPort = tunnel.Resource.Ports.FirstOrDefault(); 102var port = tunnel.Resource.Ports.First(); 118var tunnelPort = Assert.Single(tunnel.Resource.Ports); 133var tunnelPort = Assert.Single(tunnel.Resource.Ports); 154var tunnelPort = Assert.Single(tunnel.Resource.Ports); 176var tunnelPort = Assert.Single(tunnel.Resource.Ports); 229var tunnelPort = Assert.Single(tunnel.Resource.Ports); 271var tunnelPort = Assert.Single(tunnel.Resource.Ports); 314var port = Assert.Single(tunnel.Resource.Ports); 378var port = Assert.Single(tunnel.Resource.Ports); 414Assert.Equal(DevTunnelPortResource.TunnelEndpointName, tunnelEndpoint.EndpointName); 433Assert.Equal(DevTunnelPortResource.TunnelEndpointName, tunnelEndpoint.EndpointName); 453Assert.Equal(DevTunnelPortResource.TunnelEndpointName, tunnelEndpoint.EndpointName); 541Assert.Equal(DevTunnelPortResource.TunnelEndpointName, httpTunnelEndpoint.EndpointName); 542Assert.Equal(DevTunnelPortResource.TunnelEndpointName, httpsTunnelEndpoint.EndpointName); 561var port = Assert.Single(tunnel.Resource.Ports); 569var command = Assert.Single(port.Annotations.OfType<ResourceCommandAnnotation>(), a => a.Name == DevTunnelPortResource.ShowTunnelUrlsCommandName); 653var port = Assert.Single(tunnel.Resource.Ports); 659var command = Assert.Single(port.Annotations.OfType<ResourceCommandAnnotation>(), a => a.Name == DevTunnelPortResource.ShowTunnelUrlsCommandName); 703var port = Assert.Single(tunnel.Resource.Ports); 709var command = Assert.Single(port.Annotations.OfType<ResourceCommandAnnotation>(), a => a.Name == DevTunnelPortResource.ShowTunnelUrlsCommandName); 772var tunnelPort = Assert.Single(tunnel.Resource.Ports); 881var port = Assert.Single(tunnel.Resource.Ports); 895DevTunnelPortResource.TunnelUrlPropertyName or 896DevTunnelPortResource.InspectUrlPropertyName or 897DevTunnelPortResource.LocalEndpointUrlPropertyName), 900Assert.Equal(DevTunnelPortResource.TunnelUrlPropertyName, property.Name); 907Assert.Equal(DevTunnelPortResource.InspectUrlPropertyName, property.Name); 914Assert.Equal(DevTunnelPortResource.LocalEndpointUrlPropertyName, property.Name);
TestDevTunnelMonitor.cs (1)
56public DevTunnelPortResource Port { get; }
Aspire.Hosting.Maui.Tests (2)
MauiPlatformExtensionsTests.cs (2)
840Assert.Equal("http", Assert.Single(appBuilder.Resources.OfType<DevTunnelPortResource>()).Options.Protocol); 1038Assert.Equal("http", Assert.Single(appBuilder.Resources.OfType<DevTunnelPortResource>()).Options.Protocol);
Aspire.Hosting.Tests (2)
Dcp\DcpExecutorTests.cs (2)
1526var tunnelPort = Assert.Single(distributedAppModel.Resources.OfType<DevTunnelPortResource>());