Fix localdev

This commit is contained in:
2024-02-21 21:51:10 +00:00
parent b2540e7bdf
commit 103963f81f
4 changed files with 42 additions and 29 deletions

View File

@ -12,9 +12,11 @@ namespace NostrStreamer.Services;
public class LndNode
{
private readonly Network _network;
private readonly ILogger<LndNode> _logger;
public LndNode(Config config)
public LndNode(Config config, ILogger<LndNode> logger)
{
_logger = logger;
_network = Network.GetNetwork(config.Network) ?? Network.RegTest;
var channelOptions = new GrpcChannelOptions();
ConfigureClient(channelOptions, config.Lnd);
@ -121,7 +123,7 @@ public class LndNode
throw new InvalidOperationException("CLTV delta too high");
}
var knownBits = new[] {8, 9, 14, 15, 16, 17};
var knownBits = new[] { 8, 9, 14, 15, 16, 17 };
for (var x = 0; x < 64; x++)
{
var n = 1L << x;
@ -152,7 +154,9 @@ public class LndNode
return await InvoicesClient.AddHoldInvoiceAsync(req);
}
private static void ConfigureClient(GrpcChannelOptions opt, LndConfig conf)
private void ConfigureClient(GrpcChannelOptions opt, LndConfig conf)
{
try
{
var macaroon = File.ReadAllBytes(Environment.ExpandEnvironmentVariables(conf.MacaroonPath));
var cert = File.ReadAllBytes(Environment.ExpandEnvironmentVariables(conf.CertPath));
@ -174,4 +178,9 @@ public class LndNode
opt.Credentials = ChannelCredentials.Create(ChannelCredentials.SecureSsl,
CallCredentials.FromInterceptor(asyncInterceptor));
}
catch (Exception ex)
{
_logger.LogError(ex, "Configure failed");
}
}
}

View File

@ -4,7 +4,7 @@ services:
srs-origin:
image: ossrs/srs:5
volumes:
- "./docker/srs-origin.conf:/usr/local/srs/conf/srs.conf"
- "./docker/srs-origin.conf:/usr/local/srs/conf/docker.conf"
ports:
- "9001:1935"
- "9002:1985"
@ -13,7 +13,7 @@ services:
srs-edge:
image: ossrs/srs:5
volumes:
- "./docker/srs-edge.conf:/usr/local/srs/conf/srs.conf"
- "./docker/srs-edge.conf:/usr/local/srs/conf/docker.conf"
ports:
- "9005:1935"
- "1985:1985"
@ -43,3 +43,7 @@ services:
- "9011:9001"
volumes:
- "minio-dvr:/data"
redis:
image: redis
ports:
- "6666:6379"

View File

@ -118,6 +118,6 @@ vhost full.in.zap.stream {
vhost __defaultVhost__ {
forward {
enabled on;
backend http://10.100.2.226:5295/api/srs;
backend http://host.docker.internal:5295/api/srs;
}
}

View File

@ -32,10 +32,10 @@ vhost hls.zap.stream {
http_hooks {
enabled on;
on_publish http://10.100.2.226:5295/api/srs;
on_unpublish http://10.100.2.226:5295/api/srs;
on_hls http://10.100.2.226:5295/api/srs;
on_dvr http://10.100.2.226:5295/api/srs;
on_publish http://host.docker.internal:5295/api/srs;
on_unpublish http://host.docker.internal:5295/api/srs;
on_hls http://host.docker.internal:5295/api/srs;
on_dvr http://host.docker.internal:5295/api/srs;
}
dvr {