internal State(IPProbeProviderOptions options) { foreach (var host in options.Hosts) { var hostResult = new Host(); hostResult.Name = host.Name; hostResult.AvailabilityMode = host.AvailabilityMode; foreach (var address in host.Ip) { var addressProbe = new Target { Address = IPAddress.Parse(address), ProbeFunction = Strategy.Get(host.Probe), TimeoutMilliseconds = host.Timeout, }; Target preExisting; if (this.Targets.TryGetValue(addressProbe, out preExisting)) { hostResult.AddressProbes.Add(preExisting); } else { this.Targets.Add(addressProbe); hostResult.AddressProbes.Add(addressProbe); } } this.Hosts.Add(hostResult); } }
/// <summary>Initialize ZoneProvider</summary> /// <param name="config">ZoneProvider Configuration Section</param> /// <param name="zoneName">Zone suffix</param> public override void Initialize(IConfiguration config, string zoneName) { this.options = config.Get <IPProbeProviderOptions>(); if (options == null) { throw new Exception("Error loading IPProbeProviderOptions"); } // load up initial state from options this.state = new State(options); this.Zone = zoneName; return; }