Browse Source

Add ServerVersion and ClientVersion to the ConnectionInfo

olegkap_cp 13 năm trước cách đây
mục cha
commit
8ac242d197

+ 10 - 0
Renci.SshClient/Renci.SshNet/ConnectionInfo.cs

@@ -170,6 +170,16 @@ namespace Renci.SshNet
         /// </summary>
         public string CurrentServerCompressionAlgorithm { get; internal set; }
 
+        /// <summary>
+        /// Gets the server version.
+        /// </summary>
+        public string ServerVersion { get; internal set; }
+
+        /// <summary>
+        /// Get the client version.
+        /// </summary>
+        public string ClientVersion { get; internal set; }
+
         /// <summary>
         /// Gets the current client compression algorithm.
         /// </summary>

+ 4 - 0
Renci.SshClient/Renci.SshNet/Session.cs

@@ -481,6 +481,10 @@ namespace Renci.SshNet
                         }
                     }
 
+                    //  Set connection versions
+                    this.ConnectionInfo.ServerVersion = this.ServerVersion;
+                    this.ConnectionInfo.ClientVersion = this.ClientVersion;
+
                     //  Get server SSH version
                     var version = versionMatch.Result("${protoversion}");