public async Task <DnsResponse> ResolveName(IAdapter creator, AdapterRef handler, DnsRequest request) { var cxn = InConnectionDns.Create(creator, request); await HandleInConnection(cxn, handler); var result = cxn.ConnectResult; if (result?.Ok == false) { if (result.FailedReason != null) { throw new Exception(result.FailedReason); } throw new Exception("name resolving failed."); } return(result as DnsResponse ?? DnsResponse.Empty(this)); }
public static InConnectionDns Create(IAdapter creator, DnsRequest request) => new InConnectionDns(creator) { Dest = new AddrPort(request.Name, 0), DnsRequest = request };