diff --git a/src/Renci.SshNet/ConnectionInfo.cs b/src/Renci.SshNet/ConnectionInfo.cs
index 18ca1eeb8..374708964 100644
--- a/src/Renci.SshNet/ConnectionInfo.cs
+++ b/src/Renci.SshNet/ConnectionInfo.cs
@@ -1,4 +1,5 @@
-using System;
+#nullable enable
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
@@ -79,7 +80,7 @@ public class ConnectionInfo : IConnectionInfoInternal
///
/// Gets supported compression algorithms for this connection.
///
- public IOrderedDictionary> CompressionAlgorithms { get; }
+ public IOrderedDictionary?> CompressionAlgorithms { get; }
///
/// Gets the supported channel requests for this connection.
@@ -129,7 +130,7 @@ public class ConnectionInfo : IConnectionInfoInternal
///
/// Gets proxy connection host.
///
- public string ProxyHost { get; }
+ public string? ProxyHost { get; }
///
/// Gets proxy connection port.
@@ -139,12 +140,12 @@ public class ConnectionInfo : IConnectionInfoInternal
///
/// Gets proxy connection username.
///
- public string ProxyUsername { get; }
+ public string? ProxyUsername { get; }
///
/// Gets proxy connection password.
///
- public string ProxyPassword { get; }
+ public string? ProxyPassword { get; }
///
/// Gets or sets connection timeout.
@@ -219,57 +220,63 @@ public TimeSpan ChannelCloseTimeout
///
/// Occurs when authentication banner is sent by the server.
///
- public event EventHandler AuthenticationBanner;
+ public event EventHandler? AuthenticationBanner;
///
/// Gets the current key exchange algorithm.
///
- public string CurrentKeyExchangeAlgorithm { get; internal set; }
+ public string? CurrentKeyExchangeAlgorithm { get; internal set; }
///
/// Gets the current server encryption.
///
- public string CurrentServerEncryption { get; internal set; }
+ public string? CurrentServerEncryption { get; internal set; }
///
/// Gets the current client encryption.
///
- public string CurrentClientEncryption { get; internal set; }
+ public string? CurrentClientEncryption { get; internal set; }
///
/// Gets the current server hash algorithm.
///
- public string CurrentServerHmacAlgorithm { get; internal set; }
+ public string? CurrentServerHmacAlgorithm { get; internal set; }
///
/// Gets the current client hash algorithm.
///
- public string CurrentClientHmacAlgorithm { get; internal set; }
+ public string? CurrentClientHmacAlgorithm { get; internal set; }
///
/// Gets the current host key algorithm.
///
- public string CurrentHostKeyAlgorithm { get; internal set; }
+ public string? CurrentHostKeyAlgorithm { get; internal set; }
///
/// Gets the current server compression algorithm.
///
- public string CurrentServerCompressionAlgorithm { get; internal set; }
+ public string? CurrentServerCompressionAlgorithm { get; internal set; }
///
- /// Gets the server version.
+ /// Gets the current client compression algorithm.
///
- public string ServerVersion { get; internal set; }
+ public string? CurrentClientCompressionAlgorithm { get; internal set; }
///
- /// Gets the client version.
+ /// Gets the server version.
///
- public string ClientVersion { get; internal set; }
+ public string? ServerVersion { get; internal set; }
///
- /// Gets the current client compression algorithm.
+ /// Gets the client version.
///
- public string CurrentClientCompressionAlgorithm { get; internal set; }
+ public string ClientVersion
+ {
+ get
+ {
+ return Session.ClientVersionString;
+ }
+ }
///
/// Initializes a new instance of the class.
@@ -323,7 +330,7 @@ public ConnectionInfo(string host, int port, string username, params Authenticat
/// is not and is not within and .
/// is .
/// No specified.
- public ConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params AuthenticationMethod[] authenticationMethods)
+ public ConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword, params AuthenticationMethod[] authenticationMethods)
{
ThrowHelper.ThrowIfNull(host);
port.ValidatePort();
@@ -413,7 +420,7 @@ public ConnectionInfo(string host, int port, string username, ProxyTypes proxyTy
#pragma warning restore SA1107 // Code should not contain multiple statements on one line
HostKeyAlgorithms = hostAlgs;
- CompressionAlgorithms = new OrderedDictionary>
+ CompressionAlgorithms = new OrderedDictionary?>
{
{ "none", null },
{ "zlib@openssh.com", () => new ZlibOpenSsh() },
@@ -472,7 +479,7 @@ internal void Authenticate(ISession session, IServiceFactory serviceFactory)
///
/// The session in which the banner message was received.
/// The banner message.
- void IConnectionInfoInternal.UserAuthenticationBannerReceived(object sender, MessageEventArgs e)
+ void IConnectionInfoInternal.UserAuthenticationBannerReceived(object? sender, MessageEventArgs e)
{
AuthenticationBanner?.Invoke(this, new AuthenticationBannerEventArgs(Username, e.Message.Message, e.Message.Language));
}
@@ -507,6 +514,6 @@ IList IConnectionInfoInternal.AuthenticationMethods
///
/// The logger factory for this connection. If then is used.
///
- public ILoggerFactory LoggerFactory { get; set; }
+ public ILoggerFactory? LoggerFactory { get; set; }
}
}
diff --git a/src/Renci.SshNet/IConnectionInfo.cs b/src/Renci.SshNet/IConnectionInfo.cs
index 868292b5b..db3b7b6e9 100644
--- a/src/Renci.SshNet/IConnectionInfo.cs
+++ b/src/Renci.SshNet/IConnectionInfo.cs
@@ -1,4 +1,5 @@
-using System;
+#nullable enable
+using System;
using System.Collections.Generic;
using System.Text;
@@ -20,7 +21,7 @@ internal interface IConnectionInfo
///
/// The logger factory for this connection. If then is used.
///
- public ILoggerFactory LoggerFactory { get; }
+ public ILoggerFactory? LoggerFactory { get; }
///
/// Gets the timeout to used when waiting for a server to acknowledge closing a channel.
@@ -77,7 +78,7 @@ internal interface IConnectionInfo
///
/// Gets proxy connection host.
///
- string ProxyHost { get; }
+ string? ProxyHost { get; }
///
/// Gets proxy connection port.
@@ -87,12 +88,12 @@ internal interface IConnectionInfo
///
/// Gets proxy connection username.
///
- string ProxyUsername { get; }
+ string? ProxyUsername { get; }
///
/// Gets proxy connection password.
///
- string ProxyPassword { get; }
+ string? ProxyPassword { get; }
///
/// Gets the number of retry attempts when session channel creation failed.
@@ -113,6 +114,6 @@ internal interface IConnectionInfo
///
/// Occurs when authentication banner is sent by the server.
///
- event EventHandler AuthenticationBanner;
+ event EventHandler? AuthenticationBanner;
}
}
diff --git a/src/Renci.SshNet/IConnectionInfoInternal.cs b/src/Renci.SshNet/IConnectionInfoInternal.cs
index 053e36dda..59343ceb4 100644
--- a/src/Renci.SshNet/IConnectionInfoInternal.cs
+++ b/src/Renci.SshNet/IConnectionInfoInternal.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+#nullable enable
+using System.Collections.Generic;
using Renci.SshNet.Messages.Authentication;
@@ -14,7 +15,7 @@ internal interface IConnectionInfoInternal : IConnectionInfo
///
/// The session in which the banner message was received.
/// The banner message.
- void UserAuthenticationBannerReceived(object sender, MessageEventArgs e);
+ void UserAuthenticationBannerReceived(object? sender, MessageEventArgs e);
///
/// Gets the supported authentication methods for this connection.
diff --git a/src/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs b/src/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs
index 41d1dc430..fd88d224f 100644
--- a/src/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs
+++ b/src/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs
@@ -1,4 +1,5 @@
-using System;
+#nullable enable
+using System;
using Renci.SshNet.Common;
@@ -14,7 +15,7 @@ public class KeyboardInteractiveConnectionInfo : ConnectionInfo, IDisposable
///
/// Occurs when server prompts for more authentication information.
///
- public event EventHandler AuthenticationPrompt;
+ public event EventHandler? AuthenticationPrompt;
///
/// Initializes a new instance of the class.
@@ -46,7 +47,7 @@ public KeyboardInteractiveConnectionInfo(string host, int port, string username)
/// Type of the proxy.
/// The proxy host.
/// The proxy port.
- public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort)
+ public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort)
: this(host, port, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
{
}
@@ -61,7 +62,7 @@ public KeyboardInteractiveConnectionInfo(string host, int port, string username,
/// The proxy host.
/// The proxy port.
/// The proxy username.
- public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
+ public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername)
: this(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
{
}
@@ -74,7 +75,7 @@ public KeyboardInteractiveConnectionInfo(string host, int port, string username,
/// Type of the proxy.
/// The proxy host.
/// The proxy port.
- public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort)
+ public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort)
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
{
}
@@ -88,7 +89,7 @@ public KeyboardInteractiveConnectionInfo(string host, string username, ProxyType
/// The proxy host.
/// The proxy port.
/// The proxy username.
- public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
+ public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername)
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
{
}
@@ -103,7 +104,7 @@ public KeyboardInteractiveConnectionInfo(string host, string username, ProxyType
/// The proxy port.
/// The proxy username.
/// The proxy password.
- public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
+ public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword)
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
{
}
@@ -119,7 +120,7 @@ public KeyboardInteractiveConnectionInfo(string host, string username, ProxyType
/// The proxy port.
/// The proxy username.
/// The proxy password.
- public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
+ public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword)
: base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new KeyboardInteractiveAuthenticationMethod(username))
{
foreach (var authenticationMethod in AuthenticationMethods)
@@ -131,7 +132,7 @@ public KeyboardInteractiveConnectionInfo(string host, int port, string username,
}
}
- private void AuthenticationMethod_AuthenticationPrompt(object sender, AuthenticationPromptEventArgs e)
+ private void AuthenticationMethod_AuthenticationPrompt(object? sender, AuthenticationPromptEventArgs e)
{
#pragma warning disable MA0091 // Sender should be 'this' for instance events
AuthenticationPrompt?.Invoke(sender, e);
diff --git a/src/Renci.SshNet/PasswordConnectionInfo.cs b/src/Renci.SshNet/PasswordConnectionInfo.cs
index 96608400a..2911f0bf6 100644
--- a/src/Renci.SshNet/PasswordConnectionInfo.cs
+++ b/src/Renci.SshNet/PasswordConnectionInfo.cs
@@ -1,4 +1,5 @@
-using System;
+#nullable enable
+using System;
using System.Net;
using System.Text;
@@ -16,7 +17,7 @@ public class PasswordConnectionInfo : ConnectionInfo, IDisposable
///
/// Occurs when user's password has expired and needs to be changed.
///
- public event EventHandler PasswordExpired;
+ public event EventHandler? PasswordExpired;
///
/// Initializes a new instance of the class.
@@ -56,7 +57,7 @@ public PasswordConnectionInfo(string host, int port, string username, string pas
/// Type of the proxy.
/// The proxy host.
/// The proxy port.
- public PasswordConnectionInfo(string host, int port, string username, string password, ProxyTypes proxyType, string proxyHost, int proxyPort)
+ public PasswordConnectionInfo(string host, int port, string username, string password, ProxyTypes proxyType, string? proxyHost, int proxyPort)
: this(host, port, username, Encoding.UTF8.GetBytes(password), proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
{
}
@@ -72,7 +73,7 @@ public PasswordConnectionInfo(string host, int port, string username, string pas
/// The proxy host.
/// The proxy port.
/// The proxy username.
- public PasswordConnectionInfo(string host, int port, string username, string password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
+ public PasswordConnectionInfo(string host, int port, string username, string password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername)
: this(host, port, username, Encoding.UTF8.GetBytes(password), proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
{
}
@@ -86,7 +87,7 @@ public PasswordConnectionInfo(string host, int port, string username, string pas
/// Type of the proxy.
/// The proxy host.
/// The proxy port.
- public PasswordConnectionInfo(string host, string username, string password, ProxyTypes proxyType, string proxyHost, int proxyPort)
+ public PasswordConnectionInfo(string host, string username, string password, ProxyTypes proxyType, string? proxyHost, int proxyPort)
: this(host, DefaultPort, username, Encoding.UTF8.GetBytes(password), proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
{
}
@@ -101,7 +102,7 @@ public PasswordConnectionInfo(string host, string username, string password, Pro
/// The proxy host.
/// The proxy port.
/// The proxy username.
- public PasswordConnectionInfo(string host, string username, string password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
+ public PasswordConnectionInfo(string host, string username, string password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername)
: this(host, DefaultPort, username, Encoding.UTF8.GetBytes(password), proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
{
}
@@ -117,7 +118,7 @@ public PasswordConnectionInfo(string host, string username, string password, Pro
/// The proxy port.
/// The proxy username.
/// The proxy password.
- public PasswordConnectionInfo(string host, string username, string password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
+ public PasswordConnectionInfo(string host, string username, string password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword)
: this(host, DefaultPort, username, Encoding.UTF8.GetBytes(password), proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
{
}
@@ -158,7 +159,7 @@ public PasswordConnectionInfo(string host, int port, string username, byte[] pas
/// Type of the proxy.
/// The proxy host.
/// The proxy port.
- public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort)
+ public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string? proxyHost, int proxyPort)
: this(host, port, username, password, proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
{
}
@@ -174,7 +175,7 @@ public PasswordConnectionInfo(string host, int port, string username, byte[] pas
/// The proxy host.
/// The proxy port.
/// The proxy username.
- public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
+ public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername)
: this(host, port, username, password, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
{
}
@@ -188,7 +189,7 @@ public PasswordConnectionInfo(string host, int port, string username, byte[] pas
/// Type of the proxy.
/// The proxy host.
/// The proxy port.
- public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort)
+ public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string? proxyHost, int proxyPort)
: this(host, DefaultPort, username, password, proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
{
}
@@ -203,7 +204,7 @@ public PasswordConnectionInfo(string host, string username, byte[] password, Pro
/// The proxy host.
/// The proxy port.
/// The proxy username.
- public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
+ public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername)
: this(host, DefaultPort, username, password, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
{
}
@@ -219,7 +220,7 @@ public PasswordConnectionInfo(string host, string username, byte[] password, Pro
/// The proxy port.
/// The proxy username.
/// The proxy password.
- public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
+ public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword)
: this(host, DefaultPort, username, password, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
{
}
@@ -236,7 +237,7 @@ public PasswordConnectionInfo(string host, string username, byte[] password, Pro
/// The proxy port.
/// The proxy username.
/// The proxy password.
- public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
+ public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword)
: base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new PasswordAuthenticationMethod(username, password))
{
foreach (var authenticationMethod in AuthenticationMethods)
@@ -248,7 +249,7 @@ public PasswordConnectionInfo(string host, int port, string username, byte[] pas
}
}
- private void AuthenticationMethod_PasswordExpired(object sender, AuthenticationPasswordChangeEventArgs e)
+ private void AuthenticationMethod_PasswordExpired(object? sender, AuthenticationPasswordChangeEventArgs e)
{
#pragma warning disable MA0091 // Sender should be 'this' for instance events
PasswordExpired?.Invoke(sender, e);
diff --git a/src/Renci.SshNet/PrivateKeyConnectionInfo.cs b/src/Renci.SshNet/PrivateKeyConnectionInfo.cs
index a76a81a7b..c93bba940 100644
--- a/src/Renci.SshNet/PrivateKeyConnectionInfo.cs
+++ b/src/Renci.SshNet/PrivateKeyConnectionInfo.cs
@@ -1,4 +1,5 @@
-using System;
+#nullable enable
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -49,7 +50,7 @@ public PrivateKeyConnectionInfo(string host, int port, string username, params I
/// The proxy host.
/// The proxy port.
/// The key files.
- public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, params IPrivateKeySource[] keyFiles)
+ public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, params IPrivateKeySource[] keyFiles)
: this(host, port, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty, keyFiles)
{
}
@@ -65,7 +66,7 @@ public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTyp
/// The proxy port.
/// The proxy username.
/// The key files.
- public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, params IPrivateKeySource[] keyFiles)
+ public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, params IPrivateKeySource[] keyFiles)
: this(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty, keyFiles)
{
}
@@ -79,7 +80,7 @@ public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTyp
/// The proxy host.
/// The proxy port.
/// The key files.
- public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, params IPrivateKeySource[] keyFiles)
+ public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, params IPrivateKeySource[] keyFiles)
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty, keyFiles)
{
}
@@ -94,7 +95,7 @@ public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyTy
/// The proxy port.
/// The proxy username.
/// The key files.
- public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, params IPrivateKeySource[] keyFiles)
+ public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, params IPrivateKeySource[] keyFiles)
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty, keyFiles)
{
}
@@ -110,7 +111,7 @@ public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyTy
/// The proxy username.
/// The proxy password.
/// The key files.
- public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params IPrivateKeySource[] keyFiles)
+ public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword, params IPrivateKeySource[] keyFiles)
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, keyFiles)
{
}
@@ -127,7 +128,7 @@ public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyTy
/// The proxy username.
/// The proxy password.
/// The key files.
- public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params IPrivateKeySource[] keyFiles)
+ public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword, params IPrivateKeySource[] keyFiles)
: base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new PrivateKeyAuthenticationMethod(username, keyFiles))
{
KeyFiles = new Collection(keyFiles);
diff --git a/src/Renci.SshNet/Session.cs b/src/Renci.SshNet/Session.cs
index 77fe9d4c2..9bacd348e 100644
--- a/src/Renci.SshNet/Session.cs
+++ b/src/Renci.SshNet/Session.cs
@@ -35,9 +35,6 @@ public sealed class Session : ISession
internal const byte CarriageReturn = 0x0d;
internal const byte LineFeed = 0x0a;
- private static readonly string ClientVersionString =
- "SSH-2.0-Renci.SshNet.SshClient." + ThisAssembly.NuGetPackageVersion.Replace('-', '_');
-
///
/// Specifies maximum packet size defined by the protocol.
///
@@ -74,6 +71,9 @@ public sealed class Session : ISession
///
private const int LocalChannelDataPacketSize = 1024 * 64;
+ internal static readonly string ClientVersionString =
+ "SSH-2.0-Renci.SshNet.SshClient." + ThisAssembly.NuGetPackageVersion.Replace('-', '_');
+
///
/// Holds the factory to use for creating new services.
///
@@ -594,7 +594,6 @@ public void Connect()
// Set connection versions
ServerVersion = ConnectionInfo.ServerVersion = serverIdentification.ToString();
- ConnectionInfo.ClientVersion = ClientVersion;
_logger.LogInformation("Server version '{ServerIdentification}'.", serverIdentification);
@@ -720,7 +719,6 @@ public async Task ConnectAsync(CancellationToken cancellationToken)
// Set connection versions
ServerVersion = ConnectionInfo.ServerVersion = serverIdentification.ToString();
- ConnectionInfo.ClientVersion = ClientVersion;
_logger.LogInformation("Server version '{ServerIdentification}'.", serverIdentification);