using DNS.Protocol;
using FastGithub.Configuration;
using System.Net;
namespace FastGithub.Dns
{
    /// 
    /// 带远程终节点的请求
    /// 
    sealed class RemoteEndPointRequest : Request
    {
        /// 
        /// 获取程终节点
        /// 
        public EndPoint RemoteEndPoint { get; }
        /// 
        /// 远程请求
        /// 
        /// 
        /// 
        public RemoteEndPointRequest(Request request, EndPoint remoteEndPoint)
            : base(request)
        {
            this.RemoteEndPoint = remoteEndPoint;
        }
        /// 
        /// 获取对应的本机地址
        ///  
        /// 
        public IPAddress? GetLocalAddress()
        {
            return LocalMachine.GetLocalAddress(this.RemoteEndPoint);
        }
    }
}