using Google.Protobuf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace Tango.Transport.Discovery
{
///
/// Represents a discovery client
///
///
public class DiscoveredService : EventArgs where DiscoveryMessage : IMessage
{
private Func _validateDiscoveryAction;
///
/// Gets or sets the discovery message.
///
public DiscoveryMessage Message { get; set; }
///
/// Gets or sets the service IP address.
///
public String Address { get; set; }
///
/// Gets or sets the name of the host.
///
public String HostName { get; set; }
///
/// Initializes a new instance of the class.
///
/// The address.
/// The message.
/// The host name.
public DiscoveredService(String address, String hostName, DiscoveryMessage message, Func validateDiscoveryAction)
{
HostName = hostName;
Address = address;
Message = message;
_validateDiscoveryAction = validateDiscoveryAction;
}
///
/// Validates the service existence using a TCP request.
///
///
public bool ValidateServiceExistence()
{
return _validateDiscoveryAction();
}
}
}