internal static AzureRelayListener CreateServer(string baseUrl, string path) { var listener = new AzureRelayListener(new AzureRelayOptions() { TokenProvider = Microsoft.Azure.Relay.AspNetCore.Utilities.CreateTokenProvider() }, new LoggerFactory()); listener.Options.UrlPrefixes.Add(UrlPrefix.Create(new Uri(new Uri(baseUrl), path).AbsoluteUri)); listener.Start(); return(listener); }
internal static AzureRelayListener CreateDynamicHttpServer(string basePath, out string root, out string baseAddress, TokenProvider tp = null) { if (basePath.StartsWith("/")) { basePath = basePath.Substring(1); } var rootUri = new Uri(Microsoft.Azure.Relay.AspNetCore.Utilities.GetRelayUrl()); var prefix = UrlPrefix.Create(new Uri(rootUri, basePath).AbsoluteUri, tp != null ? tp : CreateTokenProvider()); root = rootUri.ToString(); baseAddress = prefix.FullPrefix; var listener = new AzureRelayListener(new AzureRelayOptions(), new LoggerFactory()); listener.Options.UrlPrefixes.Add(prefix); listener.Start(); return(listener); }