Add IP origin enrichment with DB-IP and world map
Build and deploy / build (push) Successful in 1m46s
Build and deploy / deploy (push) Successful in 22s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
TomandClaude Opus 5.5 committed 2026-11-14 15:44:33 +01:00
1 parent 536aee1f31
commit 3671019e60
47 files changed
+1389 -12

No files matched your search

@@ -0,0 +1,18 @@
using System.Net;
using Flypaper.Core.Abstractions;
using Flypaper.Core.Models;
namespace Flypaper.Core.Networking;
internal sealed class NullIpEnricher : IIpEnricher
{
public bool IsAvailable => false;
public event EventHandler? Updated
{
add { }
remove { }
}
public IpOrigin? Lookup(IPAddress address) => null;
}
@@ -0,0 +1,24 @@
using System.Net;
namespace Flypaper.Core.Networking;
public static class PrivateNetworks
{
private static readonly IPNetwork[] Networks =
[
IPNetwork.Parse("127.0.0.0/8"),
IPNetwork.Parse("10.0.0.0/8"),
IPNetwork.Parse("172.16.0.0/12"),
IPNetwork.Parse("192.168.0.0/16"),
IPNetwork.Parse("169.254.0.0/16"),
IPNetwork.Parse("::1/128"),
IPNetwork.Parse("fc00::/7"),
IPNetwork.Parse("fe80::/10")
];
public static bool Contains(IPAddress address)
{
var ip = address.IsIPv4MappedToIPv6 ? address.MapToIPv4() : address;
return Networks.Any(network => network.Contains(ip));
}
}