• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In
Build has been canceled!

Aldaviva / GandiDynamicDns / 13273724593

11 Feb 2025 10:22PM UTC coverage: 94.643% (-1.7%) from 96.33%
13273724593

push

github

Aldaviva
Updated dependencies

37 of 46 branches covered (80.43%)

106 of 112 relevant lines covered (94.64%)

11.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.94
/GandiDynamicDns/Program.cs
1
using GandiDynamicDns;
2
using GandiDynamicDns.Net.Dns;
3
using GandiDynamicDns.Util;
4
using Microsoft.Extensions.Options;
5
using System.Net.Security;
6
using System.Security.Authentication;
7
using Unfucked;
8
using Unfucked.DNS;
9
using Unfucked.STUN;
10

11
if (args.Intersect(["--version", "-v"], StringComparer.InvariantCulture).Any()) {
4!
12
    Console.WriteLine(typeof(Program).Assembly.GetName().Version!.ToString(3));
×
13
    return;
×
14
}
15

16
HostApplicationBuilder appConfig = Host.CreateApplicationBuilder(args);
4✔
17

18
appConfig.Logging.AddUnfuckedConsole();
4✔
19

20
appConfig.Configuration.AlsoSearchForJsonFilesInExecutableDirectory();
4✔
21

22
appConfig.Services
4✔
23
    .AddLogging()
4✔
24
    .AddSystemd()
4✔
25
    .AddWindowsService(WindowsService.configure)
4✔
26
    .Configure<Configuration>(appConfig.Configuration)
4✔
27
    .AddSingleton(_ => new HttpClient(new SocketsHttpHandler {
4✔
28
        AllowAutoRedirect        = true,
4✔
29
        ConnectTimeout           = TimeSpan.FromSeconds(10),
4✔
30
        PooledConnectionLifetime = TimeSpan.FromMinutes(15),
4✔
31
        MaxConnectionsPerServer  = 8,
4✔
32
        SslOptions = new SslClientAuthenticationOptions {
4✔
33
            EnabledSslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13
4✔
34
        }
4✔
35
    }) { Timeout = TimeSpan.FromSeconds(20) })
4✔
36
    .AddHostedService<DynamicDnsServiceImpl>()
4✔
37
    .SetExitCodeOnBackgroundServiceException()
4✔
38
    .AddSingleton<IGandiLiveDns>(provider => {
4✔
39
        string apiKey = provider.GetRequiredService<IOptions<Configuration>>().Value.gandiApiKey;
4✔
40
        if (string.IsNullOrWhiteSpace(apiKey) || apiKey == "<Generate an API key on https://account.gandi.net/en/users/_/security>") {
4✔
41
            throw new ArgumentException($"Missing configuration option {nameof(Configuration.gandiApiKey)} in appsettings.json");
2✔
42
        }
4✔
43
        return new GandiLiveDns { ApiKey = apiKey };
2✔
44
    })
4✔
45
    .AddSingleton<DnsManager, GandiDnsManager>()
4✔
46
    .AddStunClient(ctx => new StunOptions { serverHostnameBlacklist = ctx.GetRequiredService<IOptions<Configuration>>().Value.stunServerBlacklist });
4✔
47

48
using IHost app = appConfig.Build();
4✔
49

50
await app.RunAsync();
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc