From 055e7b04876007ba57b6ac5f412dbcfb6cb4a269 Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 31 Jul 2023 14:49:04 +0100 Subject: [PATCH] Revert public host config --- NostrStreamer/Config.cs | 1 + NostrStreamer/Controllers/SRSController.cs | 3 ++- NostrStreamer/Services/Dvr/S3DvrStore.cs | 8 +++++++- NostrStreamer/Services/StreamManager/StreamInfo.cs | 2 ++ NostrStreamer/appsettings.json | 3 ++- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/NostrStreamer/Config.cs b/NostrStreamer/Config.cs index 95f4634..fdf7152 100644 --- a/NostrStreamer/Config.cs +++ b/NostrStreamer/Config.cs @@ -58,4 +58,5 @@ public sealed class S3BlobConfig public string? Region { get; init; } public string BucketName { get; init; } = "zap-stream-dvr"; public bool DisablePayloadSigning { get; init; } + public Uri PublicHost { get; init; } = null!; } diff --git a/NostrStreamer/Controllers/SRSController.cs b/NostrStreamer/Controllers/SRSController.cs index 035a7be..e46e665 100644 --- a/NostrStreamer/Controllers/SRSController.cs +++ b/NostrStreamer/Controllers/SRSController.cs @@ -39,7 +39,8 @@ public class SrsController : Controller Variant = appSplit.Length > 1 ? appSplit[1] : "", ClientId = req.ClientId!, StreamId = req.StreamId ?? req.ClientId!, - StreamKey = req.Stream + StreamKey = req.Stream, + EdgeIp = req.Ip! }); if (req.Action == "on_forward") diff --git a/NostrStreamer/Services/Dvr/S3DvrStore.cs b/NostrStreamer/Services/Dvr/S3DvrStore.cs index e94f859..b3cdf87 100644 --- a/NostrStreamer/Services/Dvr/S3DvrStore.cs +++ b/NostrStreamer/Services/Dvr/S3DvrStore.cs @@ -74,11 +74,17 @@ public class S3DvrStore : IDvrStore Expires = new DateTime(3000, 1, 1) }); + var ub = new UriBuilder(url) + { + Scheme = _config.PublicHost.Scheme, + Host = _config.PublicHost.Host + }; + var tsUpload = sw.Elapsed; _logger.LogInformation("download={tc:#,##0}ms, probe={pc:#,##0}ms, upload={uc:#,##0}ms", tsDownload.TotalMilliseconds, tsProbe.TotalMilliseconds, tsUpload.TotalMilliseconds); - return new(new Uri(url), probe.Duration.TotalSeconds); + return new(ub.Uri, probe.Duration.TotalSeconds); } } diff --git a/NostrStreamer/Services/StreamManager/StreamInfo.cs b/NostrStreamer/Services/StreamManager/StreamInfo.cs index e977b0d..83bd260 100644 --- a/NostrStreamer/Services/StreamManager/StreamInfo.cs +++ b/NostrStreamer/Services/StreamManager/StreamInfo.cs @@ -11,4 +11,6 @@ public class StreamInfo public string ClientId { get; init; } = null!; public string StreamId { get; init; } = null!; + + public string EdgeIp { get; init; } = null!; } diff --git a/NostrStreamer/appsettings.json b/NostrStreamer/appsettings.json index 3dce34f..3533666 100644 --- a/NostrStreamer/appsettings.json +++ b/NostrStreamer/appsettings.json @@ -28,7 +28,8 @@ "DvrStore": { "ServiceUrl": "http://localhost:9010", "AccessKey": "TQcxug1ZAXfnZ5bvc9n5", - "SecretKey": "p7EK4qew6DBkBPqrpRPuJgTOc6ChUlfIcEdAwE7K" + "SecretKey": "p7EK4qew6DBkBPqrpRPuJgTOc6ChUlfIcEdAwE7K", + "PublicHost": "http://localhost:9010" } } }