This commit is contained in:
Elias Stepanik 2023-09-27 23:36:08 +02:00
parent 7438b4ae27
commit b44040ae8d
110 changed files with 4381 additions and 0 deletions

View File

@ -0,0 +1,42 @@
name: Docker Image CI
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
jobs:
build_n_push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
id: extract_branch
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Docker Build and Tag Prod
run: docker build --load -t saile2204/ionos_ddns_updater:latest-${{ steps.extract_branch.outputs.branch }} -t saile2204/ionos_ddns_updater:${{ steps.extract_branch.outputs.branch }}-$GITHUB_SHA .
- name: Docker Build and Tagd
run: docker build --load -t saile2204/ionos_ddns_updater:$(date +%s) .
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERUSERNAME }}
password: ${{ secrets.DOCKERPASSWORD }}
- name: Push to Dockerhub
run: |
docker push saile2204/ionos_ddns_updater:latest-${{ steps.extract_branch.outputs.branch }}
docker push saile2204/ionos_ddns_updater:${{ steps.extract_branch.outputs.branch }}-$GITHUB_SHA

View File

@ -0,0 +1,42 @@
name: Docker Image CI
on:
push:
branches: [ "master"]
pull_request:
branches: [ "master"]
jobs:
build_n_push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
id: extract_branch
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Docker Build and Tag Prod
run: docker build --load -t saile2204/ionos_ddns_updater:latest-${{ steps.extract_branch.outputs.branch }} -t saile2204/ionos_ddns_updater:${{ steps.extract_branch.outputs.branch }}-$GITHUB_SHA .
- name: Docker Build and Tagd
run: docker build --load -t saile2204/ionos_ddns_updater:$(date +%s) .
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERUSERNAME }}
password: ${{ secrets.DOCKERPASSWORD }}
- name: Push to Dockerhub
run: |
docker push saile2204/ionos_ddns_updater:latest-${{ steps.extract_branch.outputs.branch }}
docker push saile2204/ionos_ddns_updater:${{ steps.extract_branch.outputs.branch }}-$GITHUB_SHA

View File

@ -0,0 +1,28 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal

View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/.idea.DDNSUpdater.iml
/contentModel.xml
/projectSettingsUpdater.xml
/modules.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1 @@
DDNSUpdater

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DDNSUpdater", "DDNSUpdater\DDNSUpdater.csproj", "{EDEDF642-4CFC-4EEB-A8F2-3872DBEC63E3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EDEDF642-4CFC-4EEB-A8F2-3872DBEC63E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EDEDF642-4CFC-4EEB-A8F2-3872DBEC63E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EDEDF642-4CFC-4EEB-A8F2-3872DBEC63E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EDEDF642-4CFC-4EEB-A8F2-3872DBEC63E3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Docker.DotNet" Version="3.125.15" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.10" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="RestSharp" Version="108.0.3" />
<PackageReference Include="Spectre.Console" Version="0.46.0" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,15 @@
using DDNSUpdater.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
namespace DDNSUpdater;
public class DataContext : DbContext
{
public DataContext(DbContextOptions<DataContext> options)
: base(options) { }
public DbSet<Domain> Domains { get; set; }
}

View File

@ -0,0 +1,8 @@
namespace DDNSUpdater.Interfaces;
public interface IDDNSService
{
public Task Init();
public Task Update(bool changed);
public Task SetUpdateURL();
}

View File

@ -0,0 +1,6 @@
namespace DDNSUpdater.Interfaces;
public interface ITimerService
{
Task Start();
}

View File

@ -0,0 +1,75 @@
using System;
using DDNSUpdater.Interfaces;
using Microsoft.Extensions.Logging;
using Spectre.Console;
using Console = Spectre.Console.AnsiConsole;
namespace DDNSUpdater.Logging;
public sealed class SpecterConsoleLogger : ILogger
{
private readonly string _name;
private readonly Func<SpecterConsoleLoggerConfiguration> _getCurrentConfig;
public SpecterConsoleLogger(
string name, Func<SpecterConsoleLoggerConfiguration> getCurrentConfig) =>
(_name, _getCurrentConfig) = (name, getCurrentConfig);
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
{
if (!IsEnabled(logLevel))
{
return;
}
Table table = null;
try
{
table = state as Table;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
throw;
}
try
{
SpecterConsoleLoggerConfiguration config = _getCurrentConfig();
if (table is not null)
{
Console.Write(table);
}
else if (config.EventId == 0 || config.EventId == eventId.Id)
{
var originalColor = new Style(foreground: System.Console.ForegroundColor);
Console.Foreground = config.LogLevelToColorMap[logLevel];
Console.Write($"[{eventId.Id,2}:{logLevel,-12}]");
Console.Foreground = originalColor.Foreground;
Console.Write($" {_name} - ");
Console.Foreground = config.LogLevelToColorMap[logLevel];
Console.Write($"{formatter(state, exception)}");
Console.Foreground = originalColor.Foreground;
Console.WriteLine();
}
}
catch
{
}
}
public bool IsEnabled(LogLevel logLevel) =>
_getCurrentConfig().LogLevelToColorMap.ContainsKey(logLevel);
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => default!;
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
namespace DDNSUpdater.Logging;
public sealed class SpecterConsoleLoggerConfiguration
{
public int EventId { get; set; }
public Dictionary<LogLevel, ConsoleColor> LogLevelToColorMap { get; set; } = new()
{
[LogLevel.Information] = ConsoleColor.DarkGreen
};
}

View File

@ -0,0 +1,42 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Configuration;
using Spectre.Console;
namespace DDNSUpdater.Logging;
public static class SpecterConsoleLoggerExtensions
{
public static ILoggingBuilder AddSpecterConsoleLogger(
this ILoggingBuilder builder)
{
builder.AddConfiguration();
builder.Services.TryAddEnumerable(
ServiceDescriptor.Singleton<ILoggerProvider, SpecterConsoleLoggerProvider>());
LoggerProviderOptions.RegisterProviderOptions
<SpecterConsoleLoggerConfiguration, SpecterConsoleLoggerProvider>(builder.Services);
return builder;
}
public static ILoggingBuilder AddSpecterConsoleLogger(
this ILoggingBuilder builder,
Action<SpecterConsoleLoggerConfiguration> configure)
{
builder.AddSpecterConsoleLogger();
builder.Services.Configure(configure);
return builder;
}
public static void LogTable(this ILogger logger, LogLevel logLevel, EventId eventId, Exception? exception, Table? table)
{
logger.Log(logLevel, eventId, table, exception, null);
}
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Concurrent;
using System.Runtime.Versioning;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
using Microsoft.Extensions.Options;
namespace DDNSUpdater.Logging;
[UnsupportedOSPlatform("browser")]
[ProviderAlias("SpecterConsole")]
public sealed class SpecterConsoleLoggerProvider : ILoggerProvider
{
private readonly IDisposable? _onChangeToken;
private SpecterConsoleLoggerConfiguration _currentConfig;
private readonly ConcurrentDictionary<string, SpecterConsoleLogger> _loggers =
new(StringComparer.OrdinalIgnoreCase);
public SpecterConsoleLoggerProvider(
IOptionsMonitor<SpecterConsoleLoggerConfiguration> config)
{
_currentConfig = config.CurrentValue;
_onChangeToken = config.OnChange(updatedConfig => _currentConfig = updatedConfig);
}
public ILogger CreateLogger(string categoryName) =>
_loggers.GetOrAdd(categoryName, name => new SpecterConsoleLogger(name, GetCurrentConfig));
private SpecterConsoleLoggerConfiguration GetCurrentConfig() => _currentConfig;
public void Dispose()
{
_loggers.Clear();
_onChangeToken?.Dispose();
}
}

View File

@ -0,0 +1,40 @@
using DDNSUpdater.Models;
namespace DDNSUpdater.Logic;
public class DomainComparer
{
public static List<Domain> GetObjectsNotInList(List<Domain> list1, List<Domain> list2)
{
List<Domain> result = new List<Domain>();
foreach (var item1 in list1)
{
bool found = false;
foreach (var item2 in list2)
{
if (AreEqual(item1, item2))
{
found = true;
break;
}
}
if (!found)
{
result.Add(item1);
}
}
return result;
}
private static bool AreEqual(Domain domain1, Domain domain2)
{
// Compare each property for equality
return domain1.Id == domain2.Id &&
string.Equals(domain1.DomainString, domain2.DomainString, StringComparison.OrdinalIgnoreCase) &&
string.Equals(domain1.Key, domain2.Key, StringComparison.OrdinalIgnoreCase);
}
}

View File

@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace DDNSUpdater.Models;
public class Domain
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string DomainString { get; set; }
public string Key { get; set; }
}

View File

@ -0,0 +1,13 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace DDNSUpdater.Models.Requests;
public class DynamicDns
{
[JsonProperty("domains")]
public List<string> Domains { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
}

View File

@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace DDNSUpdater.Models.Requests;
public class DynamicDnsResponse
{
public string BulkId { get; set; }
public string UpdateUrl { get; set; }
public List<string> Domains { get; set; }
public string Description { get; set; }
}

View File

@ -0,0 +1,53 @@
using System;
using DDNSUpdater;
using DDNSUpdater.Interfaces;
using DDNSUpdater.Logging;
using DDNSUpdater.Services;
using Docker.DotNet;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using RestSharp;
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: false);
DockerClient dockerClient = new DockerClientConfiguration()
.CreateClient();
var configuration = builder.Build();
/*var logConfig = new OptionsMonitor<SpecterConsoleLoggerConfiguration>();
logConfig.CurrentValue.LogLevelToColorMap[LogLevel.Warning] = ConsoleColor.DarkCyan;
logConfig.CurrentValue.LogLevelToColorMap[LogLevel.Error] = ConsoleColor.DarkRed;*/
var serviceProvider = new ServiceCollection()
.AddSingleton<IConfiguration>(configuration)
.AddLogging(logging => logging.AddSpecterConsoleLogger(configuration =>
{
// Replace warning value from appsettings.json of "Cyan"
configuration.LogLevelToColorMap[LogLevel.Warning] = ConsoleColor.DarkCyan;
// Replace warning value from appsettings.json of "Red"
configuration.LogLevelToColorMap[LogLevel.Error] = ConsoleColor.DarkRed;
}))
.AddSingleton<ITimerService, TimerService>()
.AddSingleton<DDNSService>()
.AddSingleton(dockerClient)
.AddSingleton<DockerService>()
.AddDbContext<DataContext>(options => options.UseInMemoryDatabase(databaseName: "DataContext"))
.BuildServiceProvider();
var dockerService = serviceProvider.GetService<DockerService>();
dockerService?.UpdateDomainList();
var dataAccess = serviceProvider.GetService<DDNSService>();
dataAccess?.Init();
var timerService = serviceProvider.GetService<ITimerService>();
timerService?.Start();
Console.ReadKey();

View File

@ -0,0 +1,164 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using DDNSUpdater.Interfaces;
using DDNSUpdater.Logging;
using DDNSUpdater.Models;
using DDNSUpdater.Models.Requests;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Serializers;
using Spectre.Console;
using Console = Spectre.Console.AnsiConsole;
namespace DDNSUpdater.Services;
public class DDNSService : IDDNSService
{
private List<string>? UpdateURLs { get; set; }
private readonly ILogger<DDNSService> _logger;
private readonly DataContext _dataContext;
public DDNSService(ILogger<DDNSService> logger, DataContext dataContext)
{
_logger = logger;
_dataContext = dataContext;
}
public async Task Init()
{
int count = 0;
_logger.LogInformation("Fetching UpdateURLs");
var domains = await _dataContext.Domains.ToListAsync();
if (domains.Count == 0)
{
return;
}
UpdateURLs = await GetUpdateURLs();
while (UpdateURLs == null || UpdateURLs.Count == 0 || count > 50)
{
_logger.LogInformation($"Fetching UpdateURLs again.");
UpdateURLs = await GetUpdateURLs();
count++;
}
_logger.LogInformation($"Fetched {UpdateURLs.Count} UpdateURLs");
}
public async Task Update(bool changed)
{
if (changed)
{
Init();
}
if(UpdateURLs.Count == 0) return;
foreach (var UpdateURL in UpdateURLs)
{
var client = new RestClient(UpdateURL);
var request = new RestRequest("",Method.Get);
request.AddHeader("Cookie", "0b04270753322c986927738ac2b6c0d8=ea099cbd8a6109c688f9831d6bbfa7a1; 5b66c83e4535f5f6bef8295496cfe559=e85228fccae97f107478bf9ef664e4eb; DPX=v1:ghOJrOzFTj:htgOaKFW:63d3bf8f:de");
var body = @"";
request.AddParameter("text/plain", body, ParameterType.RequestBody);
try
{
var response = await client.ExecuteAsync(request);
while (response.StatusCode == HttpStatusCode.TooManyRequests)
{
Thread.Sleep(1000);
response = await client.ExecuteAsync(request);
}
_logger.LogInformation("Requesting Update on Ionos.");
}
catch (Exception e)
{
_logger.LogError(e.Message);
throw;
}
}
}
public async Task SetUpdateURL()
{
UpdateURLs = await GetUpdateURLs();
}
private async Task<List<string>> GetUpdateURLs()
{
List<string> updateURLs = new List<string>();
Dictionary<string, List<string>> domainDict = new Dictionary<string, List<string>>();
Dictionary<string,Table> tables = new Dictionary<string,Table>();
foreach (var domain in await _dataContext.Domains.ToListAsync())
{
if (!domainDict.ContainsKey(domain.Key))
{
domainDict.Add(domain.Key, new List<string>());
var t = new Table();
t.AddColumn("Key");
t.AddColumn("Domain");
tables.Add(domain.Key,t);
}
domainDict[domain.Key].Add(domain.DomainString);
tables[domain.Key].AddRow(domain.Key, domain.DomainString);
}
foreach (var keyValuePair in tables)
{
Console.Write(tables[keyValuePair.Key]);
}
foreach (var domainList in domainDict)
{
var dyndns = new DynamicDns()
{
Domains = domainList.Value,
Description = "My DynamicDns"
};
var content = JsonConvert.SerializeObject(dyndns);
var client = new RestClient("https://api.hosting.ionos.com/dns/v1");
var request = new RestRequest("/dyndns", Method.Post);
request.AddHeader("X-API-Key", domainList.Key.Replace("ionos ", ""));
request.AddStringBody(content, ContentType.Json);
try
{
var response = client.ExecutePost<DynamicDnsResponse>(request);
while (response.StatusCode == HttpStatusCode.TooManyRequests)
{
Thread.Sleep(1000);
response = client.ExecutePost<DynamicDnsResponse>(request);
}
updateURLs.Add(response.Data.UpdateUrl);
}
catch (Exception error)
{
_logger.LogError(error.Message);
return null;
}
}
return updateURLs;
}
}

View File

@ -0,0 +1,157 @@
using DDNSUpdater.Models;
using Docker.DotNet;
using Docker.DotNet.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace DDNSUpdater.Services;
public class DockerService
{
private Timer timer;
private readonly ILogger<TimerService> _logger;
private readonly IServiceScopeFactory _factory;
private readonly DockerClient _dockerClient;
private readonly DataContext _context;
private readonly int intervalMinutes;
public DockerService(ILogger<TimerService> logger,IServiceScopeFactory factory, DockerClient dockerClient, DataContext context)
{
_logger = logger;
_factory = factory;
_dockerClient = dockerClient;
_context = context;
}
public async Task<bool> UpdateDomainList()
{
var changed = false;
var containers = await _dockerClient.Containers.ListContainersAsync(new ContainersListParameters());
var domains = await _context.Domains.ToListAsync();
foreach (var container in containers)
{
foreach (var (key, value) in container.Labels)
{
if (key.Contains("caddy"))
{
domains = await _context.Domains.ToListAsync();
//var domainsFound = container.Labels["caddy"].Split(" ");
//var apiKey = container.Labels["caddy.tls.dns"].Replace("ionos ", "");
var domainsFound = await GetDomains(container);
foreach (var domain in domainsFound)
{
//Domain? find = domains.Find(d => d.DomainString.Equals(domain.DomainString));
var exists = false;
foreach (var d in domains)
{
if (d.DomainString.Equals(domain.DomainString))
{
exists = true;
}
}
if (!exists)
{
_logger.LogInformation("Adding Domain: " + domain.DomainString);
changed = true;
await _context.Domains.AddAsync(domain);
await _context.SaveChangesAsync();
}
}
await _context.SaveChangesAsync();
}
}
}
domains = await _context.Domains.ToListAsync();
foreach (var domain in domains)
{
var found = false;
foreach (var containerListResponse in containers)
{
var domainsInLabels = await GetDomains(containerListResponse);
foreach (var domainInContainer in domainsInLabels)
{
if (domainInContainer.DomainString.Equals(domain.DomainString))
{
found = true;
}
}
/*if (!containerListResponse.Labels.Contains(
new KeyValuePair<string, string>("caddy", domain.DomainString)))
{
found = true;
}*/
}
if (!found)
{
_context.Domains.Remove(domain);
}
}
await _context.SaveChangesAsync();
return changed;
}
private List<string> GetDnsRange(IDictionary<string,string> labels)
{
var dnsRange = new List<string>();
foreach (var keyValuePair in labels)
{
if (keyValuePair.Key.Contains("caddy"))
{
if (!keyValuePair.Key.Contains("reverse_proxy") && !keyValuePair.Key.Contains("tls.dns"))
{
if (labels.ContainsKey($"{keyValuePair.Key}.tls.dns"))
{
dnsRange.Add(keyValuePair.Key);
}
}
}
}
return dnsRange;
}
private async Task<List<Domain>> GetDomains(ContainerListResponse container)
{
var domains = new List<Domain>();
var labels = container.Labels;
var dnsRange = GetDnsRange(labels);
foreach (var range in dnsRange)
{
foreach (var domainLabel in labels[range].Split(" "))
{
var domain = new Domain();
domain.DomainString = domainLabel;
domain.Key = labels[range + ".tls.dns"];
domains.Add(domain);
}
}
return domains;
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Threading;
using DDNSUpdater.Interfaces;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace DDNSUpdater.Services;
public class TimerService : ITimerService
{
private PeriodicTimer _timer;
private readonly ILogger<TimerService> _logger;
private readonly IServiceScopeFactory _factory;
private readonly int intervalSeconds;
public TimerService(ILogger<TimerService> logger,IServiceScopeFactory factory, IConfiguration configuration)
{
_logger = logger;
_factory = factory;
_timer = new PeriodicTimer(TimeSpan.FromSeconds(configuration.GetValue<int>("TimerIntervalSeconds")));
}
private async Task Timer()
{
_logger.LogInformation("Timer callback executed at " + DateTime.Now);
using var asyncScope = _factory.CreateAsyncScope();
var ddnsService = asyncScope.ServiceProvider.GetRequiredService<DDNSService>();
var dockerService = asyncScope.ServiceProvider.GetRequiredService<DockerService>();
bool changed = await dockerService.UpdateDomainList();
await ddnsService.Update(changed);
}
public async Task Start()
{
_logger.LogInformation("Timer service started.");
while (await _timer.WaitForNextTickAsync())
{
await Timer();
}
}
}

View File

@ -0,0 +1,16 @@
{
"Logging": {
"ColorConsole": {
"LogLevelToColorMap": {
"Information": "DarkGreen",
"Warning": "Cyan",
"Error": "Red"
}
}
},
"TimerIntervalSeconds": 30,
"APIKey": "",
"Domains": [
"*.Test.de"
]
}

View File

@ -0,0 +1,575 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v7.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v7.0": {
"DDNSUpdater/1.0.0": {
"dependencies": {
"Docker.DotNet": "3.125.15",
"Microsoft.EntityFrameworkCore.InMemory": "7.0.10",
"Microsoft.Extensions.Configuration": "7.0.0",
"Microsoft.Extensions.Configuration.Json": "7.0.0",
"Microsoft.Extensions.DependencyInjection": "7.0.0",
"Microsoft.Extensions.Logging": "7.0.0",
"Microsoft.Extensions.Logging.Console": "7.0.0",
"Newtonsoft.Json": "13.0.2",
"RestSharp": "108.0.3",
"Spectre.Console": "0.46.0"
},
"runtime": {
"DDNSUpdater.dll": {}
}
},
"Docker.DotNet/3.125.15": {
"dependencies": {
"Newtonsoft.Json": "13.0.2",
"System.Buffers": "4.5.1",
"System.Threading.Tasks.Extensions": "4.5.4"
},
"runtime": {
"lib/netstandard2.1/Docker.DotNet.dll": {
"assemblyVersion": "3.125.0.0",
"fileVersion": "3.125.15.1"
}
}
},
"Microsoft.EntityFrameworkCore/7.0.10": {
"dependencies": {
"Microsoft.EntityFrameworkCore.Abstractions": "7.0.10",
"Microsoft.EntityFrameworkCore.Analyzers": "7.0.10",
"Microsoft.Extensions.Caching.Memory": "7.0.0",
"Microsoft.Extensions.DependencyInjection": "7.0.0",
"Microsoft.Extensions.Logging": "7.0.0"
},
"runtime": {
"lib/net6.0/Microsoft.EntityFrameworkCore.dll": {
"assemblyVersion": "7.0.10.0",
"fileVersion": "7.0.1023.36204"
}
}
},
"Microsoft.EntityFrameworkCore.Abstractions/7.0.10": {
"runtime": {
"lib/net6.0/Microsoft.EntityFrameworkCore.Abstractions.dll": {
"assemblyVersion": "7.0.10.0",
"fileVersion": "7.0.1023.36204"
}
}
},
"Microsoft.EntityFrameworkCore.Analyzers/7.0.10": {},
"Microsoft.EntityFrameworkCore.InMemory/7.0.10": {
"dependencies": {
"Microsoft.EntityFrameworkCore": "7.0.10"
},
"runtime": {
"lib/net6.0/Microsoft.EntityFrameworkCore.InMemory.dll": {
"assemblyVersion": "7.0.10.0",
"fileVersion": "7.0.1023.36204"
}
}
},
"Microsoft.Extensions.Caching.Abstractions/7.0.0": {
"dependencies": {
"Microsoft.Extensions.Primitives": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.Caching.Abstractions.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Caching.Memory/7.0.0": {
"dependencies": {
"Microsoft.Extensions.Caching.Abstractions": "7.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0",
"Microsoft.Extensions.Logging.Abstractions": "7.0.0",
"Microsoft.Extensions.Options": "7.0.0",
"Microsoft.Extensions.Primitives": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.Caching.Memory.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Configuration/7.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "7.0.0",
"Microsoft.Extensions.Primitives": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.Configuration.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Configuration.Abstractions/7.0.0": {
"dependencies": {
"Microsoft.Extensions.Primitives": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.Configuration.Abstractions.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Configuration.Binder/7.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.Configuration.Binder.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Configuration.FileExtensions/7.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "7.0.0",
"Microsoft.Extensions.Configuration.Abstractions": "7.0.0",
"Microsoft.Extensions.FileProviders.Abstractions": "7.0.0",
"Microsoft.Extensions.FileProviders.Physical": "7.0.0",
"Microsoft.Extensions.Primitives": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.Configuration.FileExtensions.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Configuration.Json/7.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "7.0.0",
"Microsoft.Extensions.Configuration.Abstractions": "7.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "7.0.0",
"Microsoft.Extensions.FileProviders.Abstractions": "7.0.0",
"System.Text.Json": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.Configuration.Json.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.DependencyInjection/7.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.DependencyInjection.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions/7.0.0": {
"runtime": {
"lib/net7.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.FileProviders.Abstractions/7.0.0": {
"dependencies": {
"Microsoft.Extensions.Primitives": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.FileProviders.Abstractions.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.FileProviders.Physical/7.0.0": {
"dependencies": {
"Microsoft.Extensions.FileProviders.Abstractions": "7.0.0",
"Microsoft.Extensions.FileSystemGlobbing": "7.0.0",
"Microsoft.Extensions.Primitives": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.FileProviders.Physical.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.FileSystemGlobbing/7.0.0": {
"runtime": {
"lib/net7.0/Microsoft.Extensions.FileSystemGlobbing.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Logging/7.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "7.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0",
"Microsoft.Extensions.Logging.Abstractions": "7.0.0",
"Microsoft.Extensions.Options": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.Logging.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Logging.Abstractions/7.0.0": {
"runtime": {
"lib/net7.0/Microsoft.Extensions.Logging.Abstractions.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Logging.Configuration/7.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "7.0.0",
"Microsoft.Extensions.Configuration.Abstractions": "7.0.0",
"Microsoft.Extensions.Configuration.Binder": "7.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0",
"Microsoft.Extensions.Logging": "7.0.0",
"Microsoft.Extensions.Logging.Abstractions": "7.0.0",
"Microsoft.Extensions.Options": "7.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.Logging.Configuration.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Logging.Console/7.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0",
"Microsoft.Extensions.Logging": "7.0.0",
"Microsoft.Extensions.Logging.Abstractions": "7.0.0",
"Microsoft.Extensions.Logging.Configuration": "7.0.0",
"Microsoft.Extensions.Options": "7.0.0",
"System.Text.Json": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.Logging.Console.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Options/7.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0",
"Microsoft.Extensions.Primitives": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.Options.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Options.ConfigurationExtensions/7.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "7.0.0",
"Microsoft.Extensions.Configuration.Binder": "7.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0",
"Microsoft.Extensions.Options": "7.0.0",
"Microsoft.Extensions.Primitives": "7.0.0"
},
"runtime": {
"lib/net7.0/Microsoft.Extensions.Options.ConfigurationExtensions.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Microsoft.Extensions.Primitives/7.0.0": {
"runtime": {
"lib/net7.0/Microsoft.Extensions.Primitives.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"Newtonsoft.Json/13.0.2": {
"runtime": {
"lib/net6.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.2.27524"
}
}
},
"RestSharp/108.0.3": {
"runtime": {
"lib/net6.0/RestSharp.dll": {
"assemblyVersion": "108.0.3.0",
"fileVersion": "108.0.3.0"
}
}
},
"Spectre.Console/0.46.0": {
"dependencies": {
"System.Memory": "4.5.5"
},
"runtime": {
"lib/net7.0/Spectre.Console.dll": {
"assemblyVersion": "0.0.0.0",
"fileVersion": "0.46.0.0"
}
}
},
"System.Buffers/4.5.1": {},
"System.Memory/4.5.5": {},
"System.Text.Encodings.Web/7.0.0": {},
"System.Text.Json/7.0.0": {
"dependencies": {
"System.Text.Encodings.Web": "7.0.0"
}
},
"System.Threading.Tasks.Extensions/4.5.4": {}
}
},
"libraries": {
"DDNSUpdater/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Docker.DotNet/3.125.15": {
"type": "package",
"serviceable": true,
"sha512": "sha512-XN8FKxVv8Mjmwu104/Hl9lM61pLY675s70gzwSj8KR5pwblo8HfWLcCuinh9kYsqujBkMH4HVRCEcRuU6al4BQ==",
"path": "docker.dotnet/3.125.15",
"hashPath": "docker.dotnet.3.125.15.nupkg.sha512"
},
"Microsoft.EntityFrameworkCore/7.0.10": {
"type": "package",
"serviceable": true,
"sha512": "sha512-24NbXJqJ/x8u88/agqeb1pLdAF9+9StDLA36+P/3g5xsJPOaB2GxXn7epR8dWpZTgHsNZ7cvBMxBgfFmF+xZlg==",
"path": "microsoft.entityframeworkcore/7.0.10",
"hashPath": "microsoft.entityframeworkcore.7.0.10.nupkg.sha512"
},
"Microsoft.EntityFrameworkCore.Abstractions/7.0.10": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Z/lDWmGLiT9uNQrp6UXTKZxofSmAKQCiKOz98FDscTbfAGgBXE3DTTqRsPMc8HFIVVSNANSiFRz3JyLg07HN9Q==",
"path": "microsoft.entityframeworkcore.abstractions/7.0.10",
"hashPath": "microsoft.entityframeworkcore.abstractions.7.0.10.nupkg.sha512"
},
"Microsoft.EntityFrameworkCore.Analyzers/7.0.10": {
"type": "package",
"serviceable": true,
"sha512": "sha512-+8NVNpyJTzW6nNh/7RGfldf+mbeboVcn+X1tD8kMBCEJswuy3RqM/qecEEfOfTcWLliZExPMaHwOwtHO6RMpdA==",
"path": "microsoft.entityframeworkcore.analyzers/7.0.10",
"hashPath": "microsoft.entityframeworkcore.analyzers.7.0.10.nupkg.sha512"
},
"Microsoft.EntityFrameworkCore.InMemory/7.0.10": {
"type": "package",
"serviceable": true,
"sha512": "sha512-WeUjWx80ZVQVXkHuEIO4kOCKUHo6C4RdB1bJZLSngLWqwrQrMTCZE90IGBz0330GXmXKbL4LyJO/rXO/w7cRNA==",
"path": "microsoft.entityframeworkcore.inmemory/7.0.10",
"hashPath": "microsoft.entityframeworkcore.inmemory.7.0.10.nupkg.sha512"
},
"Microsoft.Extensions.Caching.Abstractions/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-IeimUd0TNbhB4ded3AbgBLQv2SnsiVugDyGV1MvspQFVlA07nDC7Zul7kcwH5jWN3JiTcp/ySE83AIJo8yfKjg==",
"path": "microsoft.extensions.caching.abstractions/7.0.0",
"hashPath": "microsoft.extensions.caching.abstractions.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Caching.Memory/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-xpidBs2KCE2gw1JrD0quHE72kvCaI3xFql5/Peb2GRtUuZX+dYPoK/NTdVMiM67Svym0M0Df9A3xyU0FbMQhHw==",
"path": "microsoft.extensions.caching.memory/7.0.0",
"hashPath": "microsoft.extensions.caching.memory.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-tldQUBWt/xeH2K7/hMPPo5g8zuLc3Ro9I5d4o/XrxvxOCA2EZBtW7bCHHTc49fcBtvB8tLAb/Qsmfrq+2SJ4vA==",
"path": "microsoft.extensions.configuration/7.0.0",
"hashPath": "microsoft.extensions.configuration.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Abstractions/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-f34u2eaqIjNO9YLHBz8rozVZ+TcFiFs0F3r7nUJd7FRkVSxk8u4OpoK226mi49MwexHOR2ibP9MFvRUaLilcQQ==",
"path": "microsoft.extensions.configuration.abstractions/7.0.0",
"hashPath": "microsoft.extensions.configuration.abstractions.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Binder/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-tgU4u7bZsoS9MKVRiotVMAwHtbREHr5/5zSEV+JPhg46+ox47Au84E3D2IacAaB0bk5ePNaNieTlPrfjbbRJkg==",
"path": "microsoft.extensions.configuration.binder/7.0.0",
"hashPath": "microsoft.extensions.configuration.binder.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.FileExtensions/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-xk2lRJ1RDuqe57BmgvRPyCt6zyePKUmvT6iuXqiHR+/OIIgWVR8Ff5k2p6DwmqY8a17hx/OnrekEhziEIeQP6Q==",
"path": "microsoft.extensions.configuration.fileextensions/7.0.0",
"hashPath": "microsoft.extensions.configuration.fileextensions.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Json/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-LDNYe3uw76W35Jci+be4LDf2lkQZe0A7EEYQVChFbc509CpZ4Iupod8li4PUXPBhEUOFI/rlQNf5xkzJRQGvtA==",
"path": "microsoft.extensions.configuration.json/7.0.0",
"hashPath": "microsoft.extensions.configuration.json.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.DependencyInjection/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-elNeOmkeX3eDVG6pYVeV82p29hr+UKDaBhrZyWvWLw/EVZSYEkZlQdkp0V39k/Xehs2Qa0mvoCvkVj3eQxNQ1Q==",
"path": "microsoft.extensions.dependencyinjection/7.0.0",
"hashPath": "microsoft.extensions.dependencyinjection.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.DependencyInjection.Abstractions/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-h3j/QfmFN4S0w4C2A6X7arXij/M/OVw3uQHSOFxnND4DyAzO1F9eMX7Eti7lU/OkSthEE0WzRsfT/Dmx86jzCw==",
"path": "microsoft.extensions.dependencyinjection.abstractions/7.0.0",
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.FileProviders.Abstractions/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-NyawiW9ZT/liQb34k9YqBSNPLuuPkrjMgQZ24Y/xXX1RoiBkLUdPMaQTmxhZ5TYu8ZKZ9qayzil75JX95vGQUg==",
"path": "microsoft.extensions.fileproviders.abstractions/7.0.0",
"hashPath": "microsoft.extensions.fileproviders.abstractions.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.FileProviders.Physical/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-K8D2MTR+EtzkbZ8z80LrG7Ur64R7ZZdRLt1J5cgpc/pUWl0C6IkAUapPuK28oionHueCPELUqq0oYEvZfalNdg==",
"path": "microsoft.extensions.fileproviders.physical/7.0.0",
"hashPath": "microsoft.extensions.fileproviders.physical.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.FileSystemGlobbing/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-2jONjKHiF+E92ynz2ZFcr9OvxIw+rTGMPEH+UZGeHTEComVav93jQUWGkso8yWwVBcEJGcNcZAaqY01FFJcj7w==",
"path": "microsoft.extensions.filesystemglobbing/7.0.0",
"hashPath": "microsoft.extensions.filesystemglobbing.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Logging/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Nw2muoNrOG5U5qa2ZekXwudUn2BJcD41e65zwmDHb1fQegTX66UokLWZkJRpqSSHXDOWZ5V0iqhbxOEky91atA==",
"path": "microsoft.extensions.logging/7.0.0",
"hashPath": "microsoft.extensions.logging.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Logging.Abstractions/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-kmn78+LPVMOWeITUjIlfxUPDsI0R6G0RkeAMBmQxAJ7vBJn4q2dTva7pWi65ceN5vPGjJ9q/Uae2WKgvfktJAw==",
"path": "microsoft.extensions.logging.abstractions/7.0.0",
"hashPath": "microsoft.extensions.logging.abstractions.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Logging.Configuration/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-FLDA0HcffKA8ycoDQLJuCNGIE42cLWPxgdQGRBaSzZrYTkMBjnf9zrr8pGT06psLq9Q+RKWmmZczQ9bCrXEBcA==",
"path": "microsoft.extensions.logging.configuration/7.0.0",
"hashPath": "microsoft.extensions.logging.configuration.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Logging.Console/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-qt5n8bHLZPUfuRnFxJKW5q9ZwOTncdh96rtWzWpX3Y/064MlxzCSw2ELF5Jlwdo+Y4wK3I47NmUTFsV7Sg8rqg==",
"path": "microsoft.extensions.logging.console/7.0.0",
"hashPath": "microsoft.extensions.logging.console.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Options/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-lP1yBnTTU42cKpMozuafbvNtQ7QcBjr/CcK3bYOGEMH55Fjt+iecXjT6chR7vbgCMqy3PG3aNQSZgo/EuY/9qQ==",
"path": "microsoft.extensions.options/7.0.0",
"hashPath": "microsoft.extensions.options.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Options.ConfigurationExtensions/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-95UnxZkkFdXxF6vSrtJsMHCzkDeSMuUWGs2hDT54cX+U5eVajrCJ3qLyQRW+CtpTt5OJ8bmTvpQVHu1DLhH+cA==",
"path": "microsoft.extensions.options.configurationextensions/7.0.0",
"hashPath": "microsoft.extensions.options.configurationextensions.7.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Primitives/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-um1KU5kxcRp3CNuI8o/GrZtD4AIOXDk+RLsytjZ9QPok3ttLUelLKpilVPuaFT3TFjOhSibUAso0odbOaCDj3Q==",
"path": "microsoft.extensions.primitives/7.0.0",
"hashPath": "microsoft.extensions.primitives.7.0.0.nupkg.sha512"
},
"Newtonsoft.Json/13.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-R2pZ3B0UjeyHShm9vG+Tu0EBb2lC8b0dFzV9gVn50ofHXh9Smjk6kTn7A/FdAsC8B5cKib1OnGYOXxRBz5XQDg==",
"path": "newtonsoft.json/13.0.2",
"hashPath": "newtonsoft.json.13.0.2.nupkg.sha512"
},
"RestSharp/108.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-phq1AkVhqVXHZxvWDV4fJEJKCR5OHNFUGx2Ix8o5EFShS6654oZhth4X2RWvaU/W7UexIswW0T+lTirxfLU2Ow==",
"path": "restsharp/108.0.3",
"hashPath": "restsharp.108.0.3.nupkg.sha512"
},
"Spectre.Console/0.46.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-qd2OMEGxfQW1KLuQj56KKHkIK6eB/IUF/AET5CRl/efROHGsvBehx9shfkL0HgJEHLCwRiR7foWi4/LkdPk18g==",
"path": "spectre.console/0.46.0",
"hashPath": "spectre.console.0.46.0.nupkg.sha512"
},
"System.Buffers/4.5.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==",
"path": "system.buffers/4.5.1",
"hashPath": "system.buffers.4.5.1.nupkg.sha512"
},
"System.Memory/4.5.5": {
"type": "package",
"serviceable": true,
"sha512": "sha512-XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
"path": "system.memory/4.5.5",
"hashPath": "system.memory.4.5.5.nupkg.sha512"
},
"System.Text.Encodings.Web/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==",
"path": "system.text.encodings.web/7.0.0",
"hashPath": "system.text.encodings.web.7.0.0.nupkg.sha512"
},
"System.Text.Json/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-DaGSsVqKsn/ia6RG8frjwmJonfos0srquhw09TlT8KRw5I43E+4gs+/bZj4K0vShJ5H9imCuXupb4RmS+dBy3w==",
"path": "system.text.json/7.0.0",
"hashPath": "system.text.json.7.0.0.nupkg.sha512"
},
"System.Threading.Tasks.Extensions/4.5.4": {
"type": "package",
"serviceable": true,
"sha512": "sha512-zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==",
"path": "system.threading.tasks.extensions/4.5.4",
"hashPath": "system.threading.tasks.extensions.4.5.4.nupkg.sha512"
}
}
}

View File

@ -0,0 +1,12 @@
{
"runtimeOptions": {
"tfm": "net7.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "7.0.0"
},
"configProperties": {
"System.Reflection.NullabilityInfoContext.IsSupported": true
}
}
}

View File

@ -0,0 +1,16 @@
{
"Logging": {
"ColorConsole": {
"LogLevelToColorMap": {
"Information": "DarkGreen",
"Warning": "Cyan",
"Error": "Red"
}
}
},
"TimerIntervalSeconds": 30,
"APIKey": "",
"Domains": [
"*.Test.de"
]
}

View File

@ -0,0 +1,103 @@
{
"format": 1,
"restore": {
"/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/DDNSUpdater.csproj": {}
},
"projects": {
"/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/DDNSUpdater.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/DDNSUpdater.csproj",
"projectName": "DDNSUpdater",
"projectPath": "/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/DDNSUpdater.csproj",
"packagesPath": "/root/.nuget/packages/",
"outputPath": "/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/root/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net7.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net7.0": {
"targetAlias": "net7.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net7.0": {
"targetAlias": "net7.0",
"dependencies": {
"Docker.DotNet": {
"target": "Package",
"version": "[3.125.15, )"
},
"Microsoft.EntityFrameworkCore.InMemory": {
"target": "Package",
"version": "[7.0.10, )"
},
"Microsoft.Extensions.Configuration": {
"target": "Package",
"version": "[7.0.0, )"
},
"Microsoft.Extensions.Configuration.Json": {
"target": "Package",
"version": "[7.0.0, )"
},
"Microsoft.Extensions.DependencyInjection": {
"target": "Package",
"version": "[7.0.0, )"
},
"Microsoft.Extensions.Logging": {
"target": "Package",
"version": "[7.0.0, )"
},
"Microsoft.Extensions.Logging.Console": {
"target": "Package",
"version": "[7.0.0, )"
},
"Newtonsoft.Json": {
"target": "Package",
"version": "[13.0.2, )"
},
"RestSharp": {
"target": "Package",
"version": "[108.0.3, )"
},
"Spectre.Console": {
"target": "Package",
"version": "[0.46.0, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/7.0.110/RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/root/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/root/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.6.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/root/.nuget/packages/" />
</ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.entityframeworkcore/7.0.10/buildTransitive/net6.0/Microsoft.EntityFrameworkCore.props" Condition="Exists('$(NuGetPackageRoot)microsoft.entityframeworkcore/7.0.10/buildTransitive/net6.0/Microsoft.EntityFrameworkCore.props')" />
</ImportGroup>
</Project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)system.text.json/7.0.0/buildTransitive/net6.0/System.Text.Json.targets" Condition="Exists('$(NuGetPackageRoot)system.text.json/7.0.0/buildTransitive/net6.0/System.Text.Json.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions/7.0.0/buildTransitive/net6.0/Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions/7.0.0/buildTransitive/net6.0/Microsoft.Extensions.Logging.Abstractions.targets')" />
</ImportGroup>
</Project>

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]

View File

@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("DDNSUpdater")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("DDNSUpdater")]
[assembly: System.Reflection.AssemblyTitleAttribute("DDNSUpdater")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -0,0 +1 @@
3cc15af2642228b149b1d39ba430dc87e6f1bfda

View File

@ -0,0 +1,11 @@
is_global = true
build_property.TargetFramework = net7.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = DDNSUpdater
build_property.ProjectDir = /root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/

View File

@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@ -0,0 +1 @@
8d2927d76c460de3b794a5ecc0c5bc2aeeac0a39

View File

@ -0,0 +1,43 @@
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/appsettings.json
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/DDNSUpdater
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/DDNSUpdater.deps.json
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/DDNSUpdater.runtimeconfig.json
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/DDNSUpdater.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/DDNSUpdater.pdb
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.EntityFrameworkCore.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.EntityFrameworkCore.Abstractions.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.EntityFrameworkCore.InMemory.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Caching.Abstractions.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Caching.Memory.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Configuration.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Configuration.Abstractions.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Configuration.Binder.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Configuration.FileExtensions.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Configuration.Json.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.DependencyInjection.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.FileProviders.Abstractions.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.FileProviders.Physical.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.FileSystemGlobbing.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Logging.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Logging.Abstractions.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Logging.Configuration.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Logging.Console.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Options.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Options.ConfigurationExtensions.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Microsoft.Extensions.Primitives.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Newtonsoft.Json.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/RestSharp.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Spectre.Console.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/Debug/net7.0/DDNSUpdater.csproj.AssemblyReference.cache
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/Debug/net7.0/DDNSUpdater.GeneratedMSBuildEditorConfig.editorconfig
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/Debug/net7.0/DDNSUpdater.AssemblyInfoInputs.cache
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/Debug/net7.0/DDNSUpdater.AssemblyInfo.cs
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/Debug/net7.0/DDNSUpdater.csproj.CoreCompileInputs.cache
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/Debug/net7.0/DDNSUpdater.csproj.CopyComplete
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/Debug/net7.0/DDNSUpdater.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/Debug/net7.0/refint/DDNSUpdater.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/Debug/net7.0/DDNSUpdater.pdb
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/Debug/net7.0/DDNSUpdater.genruntimeconfig.cache
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/Debug/net7.0/ref/DDNSUpdater.dll
/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/bin/Debug/net7.0/Docker.DotNet.dll

View File

@ -0,0 +1 @@
94e88e2f8a0c3767cba8b5f46557283ad8d505bc

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
{
"version": 2,
"dgSpecHash": "SH2F2M42Mv3jK46b9cRQI5FXFWexrz8g8mvikuoZ1AXXZ99cxuSx+llnCt5ZleCIn5+UFYnyRbh6ndjz6Uwe3Q==",
"success": true,
"projectFilePath": "/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/DDNSUpdater.csproj",
"expectedPackageFiles": [
"/root/.nuget/packages/docker.dotnet/3.125.15/docker.dotnet.3.125.15.nupkg.sha512",
"/root/.nuget/packages/microsoft.entityframeworkcore/7.0.10/microsoft.entityframeworkcore.7.0.10.nupkg.sha512",
"/root/.nuget/packages/microsoft.entityframeworkcore.abstractions/7.0.10/microsoft.entityframeworkcore.abstractions.7.0.10.nupkg.sha512",
"/root/.nuget/packages/microsoft.entityframeworkcore.analyzers/7.0.10/microsoft.entityframeworkcore.analyzers.7.0.10.nupkg.sha512",
"/root/.nuget/packages/microsoft.entityframeworkcore.inmemory/7.0.10/microsoft.entityframeworkcore.inmemory.7.0.10.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.caching.abstractions/7.0.0/microsoft.extensions.caching.abstractions.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.caching.memory/7.0.0/microsoft.extensions.caching.memory.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.configuration/7.0.0/microsoft.extensions.configuration.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.configuration.abstractions/7.0.0/microsoft.extensions.configuration.abstractions.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.configuration.binder/7.0.0/microsoft.extensions.configuration.binder.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.configuration.fileextensions/7.0.0/microsoft.extensions.configuration.fileextensions.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.configuration.json/7.0.0/microsoft.extensions.configuration.json.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.dependencyinjection/7.0.0/microsoft.extensions.dependencyinjection.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.dependencyinjection.abstractions/7.0.0/microsoft.extensions.dependencyinjection.abstractions.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.fileproviders.abstractions/7.0.0/microsoft.extensions.fileproviders.abstractions.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.fileproviders.physical/7.0.0/microsoft.extensions.fileproviders.physical.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.filesystemglobbing/7.0.0/microsoft.extensions.filesystemglobbing.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.logging/7.0.0/microsoft.extensions.logging.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.logging.abstractions/7.0.0/microsoft.extensions.logging.abstractions.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.logging.configuration/7.0.0/microsoft.extensions.logging.configuration.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.logging.console/7.0.0/microsoft.extensions.logging.console.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.options/7.0.0/microsoft.extensions.options.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.options.configurationextensions/7.0.0/microsoft.extensions.options.configurationextensions.7.0.0.nupkg.sha512",
"/root/.nuget/packages/microsoft.extensions.primitives/7.0.0/microsoft.extensions.primitives.7.0.0.nupkg.sha512",
"/root/.nuget/packages/newtonsoft.json/13.0.2/newtonsoft.json.13.0.2.nupkg.sha512",
"/root/.nuget/packages/restsharp/108.0.3/restsharp.108.0.3.nupkg.sha512",
"/root/.nuget/packages/spectre.console/0.46.0/spectre.console.0.46.0.nupkg.sha512",
"/root/.nuget/packages/system.buffers/4.5.1/system.buffers.4.5.1.nupkg.sha512",
"/root/.nuget/packages/system.memory/4.5.5/system.memory.4.5.5.nupkg.sha512",
"/root/.nuget/packages/system.text.encodings.web/7.0.0/system.text.encodings.web.7.0.0.nupkg.sha512",
"/root/.nuget/packages/system.text.json/7.0.0/system.text.json.7.0.0.nupkg.sha512",
"/root/.nuget/packages/system.threading.tasks.extensions/4.5.4/system.threading.tasks.extensions.4.5.4.nupkg.sha512"
],
"logs": []
}

View File

@ -0,0 +1 @@
"restore":{"projectUniqueName":"/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/DDNSUpdater.csproj","projectName":"DDNSUpdater","projectPath":"/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/DDNSUpdater.csproj","outputPath":"/root/Proxy/ddns/IonosDynamicDNSUpdater/DDNSUpdater/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net7.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net7.0":{"targetAlias":"net7.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net7.0":{"targetAlias":"net7.0","dependencies":{"Docker.DotNet":{"target":"Package","version":"[3.125.15, )"},"Microsoft.EntityFrameworkCore.InMemory":{"target":"Package","version":"[7.0.10, )"},"Microsoft.Extensions.Configuration":{"target":"Package","version":"[7.0.0, )"},"Microsoft.Extensions.Configuration.Json":{"target":"Package","version":"[7.0.0, )"},"Microsoft.Extensions.DependencyInjection":{"target":"Package","version":"[7.0.0, )"},"Microsoft.Extensions.Logging":{"target":"Package","version":"[7.0.0, )"},"Microsoft.Extensions.Logging.Console":{"target":"Package","version":"[7.0.0, )"},"Newtonsoft.Json":{"target":"Package","version":"[13.0.2, )"},"RestSharp":{"target":"Package","version":"[108.0.3, )"},"Spectre.Console":{"target":"Package","version":"[0.46.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/usr/lib/dotnet/sdk/7.0.110/RuntimeIdentifierGraph.json"}}

View File

@ -0,0 +1 @@
16937582976898301

View File

@ -0,0 +1 @@
16937582976898301

View File

@ -0,0 +1,18 @@
FROM mcr.microsoft.com/dotnet/runtime:7.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["DDNSUpdater/DDNSUpdater.csproj", "DDNSUpdater/"]
RUN dotnet restore "DDNSUpdater/DDNSUpdater.csproj"
COPY . .
WORKDIR "/src/DDNSUpdater"
RUN dotnet build "DDNSUpdater.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "DDNSUpdater.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "DDNSUpdater.dll"]

View File

@ -0,0 +1,58 @@
# IonosDynamicDNSUpdater
This is an automatic Dynamic DNS updater for Ionos written in C#. It uses the Ionos API to request an UpdateURL and updates the DNS record with the current IP address. It also supports running in a Docker container and using Docker Compose.
## Prerequisites
To use IonosDynamicDNSUpdater, you need to have the following installed on your system:
- [.NET Core](https://dotnet.microsoft.com/download) (if running outside of a Docker container)
- [Docker](https://www.docker.com/get-started) (if running in a Docker container)
- [Docker Compose](https://docs.docker.com/compose/install) (if using Docker Compose)
## Installation
To install the IonosDynamicDNSUpdater, follow these steps:
1. Clone the repository to your local machine using `git clone https://github.com/eliasstepanik/IonosDynamicDNSUpdater.git`.
2. Navigate to the project directory using `cd IonosDynamicDNSUpdater`.
## Usage
To use the IonosDynamicDNSUpdater, follow these steps:
### Running outside of a Docker container
1. Create an API token in Ionos.
2. Replace the placeholder values in `appsettings.json` with your Ionos API token and the hostname for the DNS record you want to update.
3. Run the application using `dotnet run`.
### Running in a Docker container
1. Build the Docker image using `docker build -t ionosdynamicdnsupdater .`.
2. Run the Docker container using `docker run -d -e API_KEY=<your_api_key> -e DOMAINS=<comma_separated_list_of_domains> ionosdynamicdnsupdater`.
### Using Docker Compose
1. Create an API token in Ionos.
2. Replace the placeholder values in `docker-compose.yml` with your Ionos API token and the hostname for the DNS record you want to update.
3. Start the services using `docker-compose up -d`.
## Contributing
To contribute to the IonosDynamicDNSUpdater project, follow these steps:
1. Fork the repository.
2. Create a new branch for your changes.
3. Make your changes and commit them to your branch.
4. Submit a pull request to the main repository.
Please make sure to follow the coding style and add appropriate documentation for your changes.
## License
This project is licensed under the [MIT License](LICENSE).
## Contact
For any questions or feedback, please contact the maintainer at [eliasstepanik@web.de](mailto:eliasstepanik@web.de).

View File

@ -0,0 +1,11 @@
version: "3.7"
services:
ionos_ddns_updater:
build: .
restart: unless-stopped
tty: true
stdin_open: true
environment:
API_Key: ""
DOMAINS: "subdomain.domain.de,domain.de"

View File

@ -0,0 +1,25 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

5
ports/PortUpdate/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/

View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/projectSettingsUpdater.xml
/modules.xml
/contentModel.xml
/.idea.PortUpdate.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JsBuildToolPackageJson" sorting="DEFINITION_ORDER" />
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,18 @@
FROM mcr.microsoft.com/dotnet/runtime:7.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["PortUpdate/PortUpdate.csproj", "PortUpdate/"]
RUN dotnet restore "PortUpdate/PortUpdate.csproj"
COPY . .
WORKDIR "/src/PortUpdate"
RUN dotnet build "PortUpdate.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "PortUpdate.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "PortUpdate.dll"]

View File

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortUpdate", "PortUpdate\PortUpdate.csproj", "{99FB6B58-FACE-43B9-B2EE-17384580E90A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{99FB6B58-FACE-43B9-B2EE-17384580E90A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99FB6B58-FACE-43B9-B2EE-17384580E90A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99FB6B58-FACE-43B9-B2EE-17384580E90A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99FB6B58-FACE-43B9-B2EE-17384580E90A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,7 @@
namespace PortUpdate.Interfaces;
public interface IPortService
{
public void Init();
public void Update();
}

View File

@ -0,0 +1,6 @@
namespace PortUpdate.Interfaces;
public interface ITimerService
{
void Start();
}

View File

@ -0,0 +1,69 @@
using System;
using PortUpdate.Interfaces;
using Microsoft.Extensions.Logging;
using Spectre.Console;
using Console = Spectre.Console.AnsiConsole;
namespace PortUpdate.Logging;
public sealed class SpecterConsoleLogger : ILogger
{
private readonly string _name;
private readonly Func<SpecterConsoleLoggerConfiguration> _getCurrentConfig;
public SpecterConsoleLogger(
string name, Func<SpecterConsoleLoggerConfiguration> getCurrentConfig) =>
(_name, _getCurrentConfig) = (name, getCurrentConfig);
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
{
if (!IsEnabled(logLevel))
{
return;
}
Table table = null;
try
{
table = state as Table;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
throw;
}
SpecterConsoleLoggerConfiguration config = _getCurrentConfig();
if (table is not null)
{
Console.Write(table);
}
else if (config.EventId == 0 || config.EventId == eventId.Id)
{
var originalColor = new Style(foreground: System.Console.ForegroundColor);
Console.Foreground = config.LogLevelToColorMap[logLevel];
Console.Write($"[{eventId.Id,2}:{logLevel,-12}]");
Console.Foreground = originalColor.Foreground;
Console.Write($" {_name} - ");
Console.Foreground = config.LogLevelToColorMap[logLevel];
Console.Write($"{formatter(state, exception)}");
Console.Foreground = originalColor.Foreground;
Console.WriteLine();
}
}
public bool IsEnabled(LogLevel logLevel) =>
_getCurrentConfig().LogLevelToColorMap.ContainsKey(logLevel);
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => default!;
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
namespace PortUpdate.Logging;
public sealed class SpecterConsoleLoggerConfiguration
{
public int EventId { get; set; }
public Dictionary<LogLevel, ConsoleColor> LogLevelToColorMap { get; set; } = new()
{
[LogLevel.Information] = ConsoleColor.DarkGreen
};
}

View File

@ -0,0 +1,42 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Configuration;
using Spectre.Console;
namespace PortUpdate.Logging;
public static class SpecterConsoleLoggerExtensions
{
public static ILoggingBuilder AddSpecterConsoleLogger(
this ILoggingBuilder builder)
{
builder.AddConfiguration();
builder.Services.TryAddEnumerable(
ServiceDescriptor.Singleton<ILoggerProvider, SpecterConsoleLoggerProvider>());
LoggerProviderOptions.RegisterProviderOptions
<SpecterConsoleLoggerConfiguration, SpecterConsoleLoggerProvider>(builder.Services);
return builder;
}
public static ILoggingBuilder AddSpecterConsoleLogger(
this ILoggingBuilder builder,
Action<SpecterConsoleLoggerConfiguration> configure)
{
builder.AddSpecterConsoleLogger();
builder.Services.Configure(configure);
return builder;
}
public static void LogTable(this ILogger logger, LogLevel logLevel, EventId eventId, Exception? exception, Table? table)
{
logger.Log(logLevel, eventId, table, exception, null);
}
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Concurrent;
using System.Runtime.Versioning;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
using Microsoft.Extensions.Options;
namespace PortUpdate.Logging;
[UnsupportedOSPlatform("browser")]
[ProviderAlias("SpecterConsole")]
public sealed class SpecterConsoleLoggerProvider : ILoggerProvider
{
private readonly IDisposable? _onChangeToken;
private SpecterConsoleLoggerConfiguration _currentConfig;
private readonly ConcurrentDictionary<string, SpecterConsoleLogger> _loggers =
new(StringComparer.OrdinalIgnoreCase);
public SpecterConsoleLoggerProvider(
IOptionsMonitor<SpecterConsoleLoggerConfiguration> config)
{
_currentConfig = config.CurrentValue;
_onChangeToken = config.OnChange(updatedConfig => _currentConfig = updatedConfig);
}
public ILogger CreateLogger(string categoryName) =>
_loggers.GetOrAdd(categoryName, name => new SpecterConsoleLogger(name, GetCurrentConfig));
private SpecterConsoleLoggerConfiguration GetCurrentConfig() => _currentConfig;
public void Dispose()
{
_loggers.Clear();
_onChangeToken?.Dispose();
}
}

Some files were not shown because too many files have changed in this diff Show More