mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2024-11-10 09:18:15 +11:00
Merge branch 'hip02remote'
This commit is contained in:
commit
df8c675588
@ -127,7 +127,7 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Wait until the Node is connected
|
// Wait until the Node is connected before closing the splash
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
string status = await APIGet("",false);
|
string status = await APIGet("",false);
|
||||||
@ -141,11 +141,8 @@ namespace FireWallet
|
|||||||
{
|
{
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
}
|
}
|
||||||
AddLog("Loaded");
|
AddLog("Loaded");
|
||||||
@ -155,11 +152,11 @@ namespace FireWallet
|
|||||||
this.WindowState = FormWindowState.Minimized;
|
this.WindowState = FormWindowState.Minimized;
|
||||||
this.Show();
|
this.Show();
|
||||||
this.WindowState = FormWindowState.Normal;
|
this.WindowState = FormWindowState.Normal;
|
||||||
|
|
||||||
textBoxaccountpassword.Focus();
|
textBoxaccountpassword.Focus();
|
||||||
}
|
}
|
||||||
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
|
// Close HSD before closing FireWallet
|
||||||
AddLog("Closing");
|
AddLog("Closing");
|
||||||
if (HSDProcess != null)
|
if (HSDProcess != null)
|
||||||
{
|
{
|
||||||
@ -167,7 +164,6 @@ namespace FireWallet
|
|||||||
HSDProcess.Kill();
|
HSDProcess.Kill();
|
||||||
AddLog("HSD Closed");
|
AddLog("HSD Closed");
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HSDProcess.Dispose();
|
HSDProcess.Dispose();
|
||||||
@ -179,10 +175,6 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Settings
|
#region Settings
|
||||||
private async Task<bool> LoadNode()
|
private async Task<bool> LoadNode()
|
||||||
{
|
{
|
||||||
@ -1353,7 +1345,19 @@ namespace FireWallet
|
|||||||
|
|
||||||
|
|
||||||
// Create an instance of LookupClient using the custom options
|
// Create an instance of LookupClient using the custom options
|
||||||
NameServer nameServer = new NameServer(IPAddress.Parse("127.0.0.1"), 5350);
|
string ip = "127.0.0.1";
|
||||||
|
int port = 5350;
|
||||||
|
|
||||||
|
if (UserSettings.ContainsKey("hip-02-ip"))
|
||||||
|
{
|
||||||
|
ip = UserSettings["hip-02-ip"];
|
||||||
|
}
|
||||||
|
if (UserSettings.ContainsKey("hip-02-port"))
|
||||||
|
{
|
||||||
|
port = int.Parse(UserSettings["hip-02-port"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
NameServer nameServer = new NameServer(IPAddress.Parse(ip), port);
|
||||||
var options = new LookupClientOptions(nameServer);
|
var options = new LookupClientOptions(nameServer);
|
||||||
options.EnableAuditTrail = true;
|
options.EnableAuditTrail = true;
|
||||||
options.UseTcpOnly = true;
|
options.UseTcpOnly = true;
|
||||||
@ -1362,18 +1366,10 @@ namespace FireWallet
|
|||||||
options.RequestDnsSecRecords = true;
|
options.RequestDnsSecRecords = true;
|
||||||
options.Timeout = TimeSpan.FromSeconds(5);
|
options.Timeout = TimeSpan.FromSeconds(5);
|
||||||
|
|
||||||
|
|
||||||
var client = new LookupClient(options);
|
var client = new LookupClient(options);
|
||||||
|
|
||||||
|
|
||||||
// Perform the DNS lookup for the specified domain using DNSSec
|
// Perform the DNS lookup for the specified domain using DNSSec
|
||||||
|
|
||||||
var result = client.Query(domain, QueryType.A);
|
var result = client.Query(domain, QueryType.A);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Display the DNS lookup results
|
// Display the DNS lookup results
|
||||||
foreach (var record in result.Answers.OfType<ARecord>())
|
foreach (var record in result.Answers.OfType<ARecord>())
|
||||||
{
|
{
|
||||||
@ -1384,6 +1380,7 @@ namespace FireWallet
|
|||||||
{
|
{
|
||||||
labelSendingError.Show();
|
labelSendingError.Show();
|
||||||
labelSendingError.Text = "HIP-02 lookup failed";
|
labelSendingError.Text = "HIP-02 lookup failed";
|
||||||
|
AddLog("No IP found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1408,17 +1405,41 @@ namespace FireWallet
|
|||||||
// Send a GET request to the specified URL
|
// Send a GET request to the specified URL
|
||||||
HttpResponseMessage response = httpclient.GetAsync(url).Result;
|
HttpResponseMessage response = httpclient.GetAsync(url).Result;
|
||||||
|
|
||||||
|
if (response.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
labelSendingError.Show();
|
||||||
|
labelSendingError.Text = "HIP-02 lookup failed";
|
||||||
|
AddLog("HTTPS get failed");
|
||||||
|
AddLog(response.Content.ReadAsStringAsync().Result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Response
|
// Response
|
||||||
string address = response.Content.ReadAsStringAsync().Result;
|
string address = response.Content.ReadAsStringAsync().Result;
|
||||||
|
address = address.Trim();
|
||||||
|
|
||||||
|
|
||||||
|
if (await ValidAddress(address))
|
||||||
|
{
|
||||||
labelSendingHIPAddress.Text = address;
|
labelSendingHIPAddress.Text = address;
|
||||||
labelSendingHIPAddress.Show();
|
labelSendingHIPAddress.Show();
|
||||||
labelHIPArrow.Show();
|
labelHIPArrow.Show();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
labelSendingError.Show();
|
||||||
|
labelSendingError.Text = "Invalid Address";
|
||||||
|
AddLog("Invalid Address\n"+address);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
AddLog("HIP-02 lookup error");
|
||||||
AddLog(ex.Message);
|
AddLog(ex.Message);
|
||||||
labelSendingError.Show();
|
labelSendingError.Show();
|
||||||
labelSendingError.Text = "HIP-02 lookup failed";
|
labelSendingError.Text = "HIP-02 lookup failed";
|
||||||
|
Loading…
Reference in New Issue
Block a user