C# Class Blockcore.Features.Dns.DnsSeedMasterFile

This class defines a DNS masterfile used to cache the whitelisted peers discovered by the DNS Seed service that supports saving and loading from a stream. This is based on 3rd party library https://github.com/kapetan/dns.
Inheritance: IMasterFile
显示文件 Open project: x42protocol/x42-BlockCore Class Usage Examples

Protected Properties

Property Type Description
entries IList

Public Methods

Method Description
DnsSeedMasterFile ( ) : System

Initializes a new instance of a DnsSeedMasterFile class.

DnsSeedMasterFile ( IList resourceRecords ) : System
DnsSeedMasterFile ( TimeSpan ttl ) : System

Initializes a new instance of a DnsSeedMasterFile class.

Get ( Domain domain, RecordType type ) : IList

Gets a list of matching IResourceRecord objects.

Get ( Question question ) : IList

Gets a list of matching IResourceRecord objects.

Load ( Stream stream ) : void

Loads the saved masterfile from the specified stream.

Save ( Stream stream ) : void

Saves the cached masterfile to the specified stream.

Seed ( Blockcore.Features.Dns.DnsSettings dnsSettings ) : void

Private Methods

Method Description
CreateSerializer ( ) : JsonSerializer

Creates the serializer for loading and saving the master file contents.

Matches ( Domain domain, Domain entry ) : bool

Identifies if the domain matches the entry.

Method Details

DnsSeedMasterFile() public method

Initializes a new instance of a DnsSeedMasterFile class.
public DnsSeedMasterFile ( ) : System
return System

DnsSeedMasterFile() public method

public DnsSeedMasterFile ( IList resourceRecords ) : System
resourceRecords IList
return System

DnsSeedMasterFile() public method

Initializes a new instance of a DnsSeedMasterFile class.
public DnsSeedMasterFile ( TimeSpan ttl ) : System
ttl TimeSpan The time to live.
return System

Get() public method

Gets a list of matching IResourceRecord objects.
public Get ( Domain domain, RecordType type ) : IList
domain Domain The domain to match on.
type RecordType The type to match on.
return IList

Get() public method

Gets a list of matching IResourceRecord objects.
public Get ( Question question ) : IList
question Question The used to match on.
return IList

Load() public method

Loads the saved masterfile from the specified stream.
public Load ( Stream stream ) : void
stream Stream The stream containing the masterfile.
return void

Save() public method

Saves the cached masterfile to the specified stream.
public Save ( Stream stream ) : void
stream Stream The stream to write the masterfile to.
return void

Seed() public method

public Seed ( Blockcore.Features.Dns.DnsSettings dnsSettings ) : void
dnsSettings Blockcore.Features.Dns.DnsSettings
return void

Property Details

entries protected_oe property

The resource record entries in the master file.
protected IList entries
return IList