DarkPeakLabs.PublicSuffix
1.0.4
dotnet add package DarkPeakLabs.PublicSuffix --version 1.0.4
NuGet\Install-Package DarkPeakLabs.PublicSuffix -Version 1.0.4
<PackageReference Include="DarkPeakLabs.PublicSuffix" Version="1.0.4" />
paket add DarkPeakLabs.PublicSuffix --version 1.0.4
#r "nuget: DarkPeakLabs.PublicSuffix, 1.0.4"
// Install DarkPeakLabs.PublicSuffix as a Cake Addin #addin nuget:?package=DarkPeakLabs.PublicSuffix&version=1.0.4 // Install DarkPeakLabs.PublicSuffix as a Cake Tool #tool nuget:?package=DarkPeakLabs.PublicSuffix&version=1.0.4
PublicSuffix
A simple tread-safe library providing programmatic access to the public suffix list published at https://publicsuffix.org/.
Usage
The PublicSuffixList class implements IReadOnlyList<string> interface.
Example: list all rules
PublicSuffixList list = new();
foreach(var rule in list)
{
Console.WriteLine(rule);
}
Example: get apex domain
PublicSuffixList list = new();
var apexDomain = list.GetApexDomain("store.example.co.uk");
// will output 'example.co.uk'
Console.WriteLine(apexDomain);
By default the class will download the list from https://publicsuffix.org/list/public_suffix_list.dat and cache it in PublicSuffix/public_suffix_list.dat under the common application folder. Exclusive access to file is used for inter-process synchronization to guarantee only one instance of the class is creating or updating the cached data. By default the file is updated every 24 hours. Both the download URL and the data refresh time can be configured.
Optionally, an instance of the ILoggerFactory can be passed to the constructor to have inner log messages emitted.
Example: Update data every 12 hours
var options = new PublicSuffixListOptions()
{
UpdateAfter = TimeSpan.FromHours(12),
};
PublicSuffixList list = new(options, _loggerFactory);
Options
Option | Default Value | Description |
---|---|---|
DownloadUrl | https://publicsuffix.org/list/public_suffix_list.dat | If auto update is enabled, the list data will be downloaded from this URL |
AutoUpdate | true | When set to true, the list will be automatically updated with with interval specified by UpdateInterval |
UpdateInterval | 24 hours | The auto-update interval. When AutoUpdate is false, this setting is ignored |
FilePath | PublicSuffix/public_suffix_list.dat under the common application folder | The file location where the list data is cached |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
-
net6.0
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.