From 3df4f47f50305a6084f5963760b1e305058361b5 Mon Sep 17 00:00:00 2001 From: Fabian Date: Sun, 16 Jul 2023 19:23:18 +0200 Subject: [PATCH] Also print when a server is successfully validated. --- src/Launcher.cs | 9 ++++++++- src/Misc/Helpers.cs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Launcher.cs b/src/Launcher.cs index a0a827c..bc669e6 100644 --- a/src/Launcher.cs +++ b/src/Launcher.cs @@ -124,7 +124,14 @@ static class Launcher (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) => { if (sslPolicyErrors == SslPolicyErrors.None) + { + Console.ForegroundColor = ConsoleColor.Green; + Console.WriteLine($"Certificate for server '{portal.HostName}' successfully validated."); + Console.WriteLine(); + Console.ResetColor(); + return true; + } // Redirect to the trusted cert warning. throw new AuthenticationException(); @@ -132,7 +139,7 @@ static class Launcher null ); - sslStream.AuthenticateAsClient("portal.HostName"); + sslStream.AuthenticateAsClient(portal.HostName); } catch (SocketException) { diff --git a/src/Misc/Helpers.cs b/src/Misc/Helpers.cs index 8804bf8..4dd5de2 100644 --- a/src/Misc/Helpers.cs +++ b/src/Misc/Helpers.cs @@ -68,7 +68,7 @@ static class Helpers var portalSpan = config.AsSpan(startQuoteIndex + 1, portalLength); var colonIndex = portalSpan.IndexOf(':'); var ipSpan = colonIndex != -1 ? portalSpan[..colonIndex] : portalSpan; - var port = colonIndex != -1 ? int.Parse(portalSpan[colonIndex..]) : 1119; + var port = colonIndex != -1 ? int.Parse(portalSpan[(colonIndex + 1)..]) : 1119; var portalString = ipSpan.ToString().Trim(); try