Browse Source

Revert "Add ClientIP to client info to allow select client IP that should be used for connection (#132)"

This reverts commit 78679a3c30e689aeb2ad8990aa4db6d71b48db99.
Gert Driesen 8 years ago
parent
commit
9747d9caef
2 changed files with 1 additions and 71 deletions
  1. 0 70
      src/Renci.SshNet/ConnectionInfo.cs
  2. 1 1
      src/Renci.SshNet/Session.cs

+ 0 - 70
src/Renci.SshNet/ConnectionInfo.cs

@@ -9,7 +9,6 @@ using Renci.SshNet.Common;
 using Renci.SshNet.Messages.Authentication;
 using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
 using Renci.SshNet.Security.Cryptography.Ciphers;
-using System.Net;
 
 namespace Renci.SshNet
 {
@@ -206,14 +205,6 @@ namespace Renci.SshNet
         /// </summary>
         public string ClientVersion { get; internal set; }
 
-        /// <summary>
-        /// Gets the client ip to use for connection when client has multiple IP addresses availble.
-        /// </summary>
-        /// <value>
-        /// The client ip to use for connection.
-        /// </value>
-        public IPAddress ClientIP { get; internal set; }
-
         /// <summary>
         /// Gets the current client compression algorithm.
         /// </summary>
@@ -272,66 +263,6 @@ namespace Renci.SshNet
         /// <exception cref="ArgumentNullException"><paramref name="authenticationMethods"/> is <c>null</c>.</exception>
         /// <exception cref="ArgumentException">No <paramref name="authenticationMethods"/> specified.</exception>
         public ConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params AuthenticationMethod[] authenticationMethods)
-            : this(host, DefaultPort, username, null, ProxyTypes.None, null, 0, null, null, authenticationMethods)
-        {
-        }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="ConnectionInfo" /> class.
-        /// </summary>
-        /// <param name="host">The host.</param>
-        /// <param name="username">The username.</param>
-        /// <param name="clientIP">The client IP to be used.</param>
-        /// <param name="authenticationMethods">The authentication methods.</param>
-        /// <exception cref="ArgumentNullException"><paramref name="host" /> is <c>null</c>.</exception>
-        /// <exception cref="ArgumentException"><paramref name="host" /> is a zero-length string.</exception>
-        /// <exception cref="ArgumentException"><paramref name="host" /> is a zero-length string.</exception>
-        /// <exception cref="ArgumentNullException"><paramref name="host" /> is <c>null</c>.</exception>
-        /// <exception cref="ArgumentException"><paramref name="host" /> is a zero-length string.</exception>
-        public ConnectionInfo(string host, string username, IPAddress clientIP, params AuthenticationMethod[] authenticationMethods)
-            : this(host, DefaultPort, username, clientIP, ProxyTypes.None, null, 0, null, null, authenticationMethods)
-        {
-        }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="ConnectionInfo" /> class.
-        /// </summary>
-        /// <param name="host">The host.</param>
-        /// <param name="port">The port.</param>
-        /// <param name="username">The username.</param>
-        /// <param name="clientIP">The client IP to be used.</param>
-        /// <param name="authenticationMethods">The authentication methods.</param>
-        /// <exception cref="ArgumentNullException"><paramref name="host" /> is <c>null</c>.</exception>
-        /// <exception cref="ArgumentException"><paramref name="username" /> is <c>null</c>, a zero-length string or contains only whitespace characters.</exception>
-        /// <exception cref="ArgumentOutOfRangeException"><paramref name="port" /> is not within <see cref="F:System.Net.IPEndPoint.MinPort" /> and <see cref="F:System.Net.IPEndPoint.MaxPort" />.</exception>
-        /// <exception cref="ArgumentNullException"><paramref name="host" /> is <c>null</c>.</exception>
-        /// <exception cref="ArgumentException"><paramref name="username" /> is <c>null</c>, a zero-length string or contains only whitespace characters.</exception>
-        public ConnectionInfo(string host, int port, string username, IPAddress clientIP, params AuthenticationMethod[] authenticationMethods)
-            : this(host, port, username, clientIP, ProxyTypes.None, null, 0, null, null, authenticationMethods)
-        {
-        }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="ConnectionInfo" /> class.
-        /// </summary>
-        /// <param name="host">Connection host.</param>
-        /// <param name="port">Connection port.</param>
-        /// <param name="username">Connection username.</param>
-        /// <param name="clientIP">The client IP to be used.</param>
-        /// <param name="proxyType">Type of the proxy.</param>
-        /// <param name="proxyHost">The proxy host.</param>
-        /// <param name="proxyPort">The proxy port.</param>
-        /// <param name="proxyUsername">The proxy username.</param>
-        /// <param name="proxyPassword">The proxy password.</param>
-        /// <param name="authenticationMethods">The authentication methods.</param>
-        /// <exception cref="ArgumentNullException"><paramref name="host"/> is <c>null</c>.</exception>
-        /// <exception cref="ArgumentException"><paramref name="username" /> is <c>null</c>, a zero-length string or contains only whitespace characters.</exception>
-        /// <exception cref="ArgumentOutOfRangeException"><paramref name="port" /> is not within <see cref="F:System.Net.IPEndPoint.MinPort" /> and <see cref="F:System.Net.IPEndPoint.MaxPort" />.</exception>
-        /// <exception cref="ArgumentNullException"><paramref name="proxyType"/> is not <see cref="ProxyTypes.None"/> and <paramref name="proxyHost" /> is <c>null</c>.</exception>
-        /// <exception cref="ArgumentOutOfRangeException"><paramref name="proxyType"/> is not <see cref="ProxyTypes.None"/> and <paramref name="proxyPort" /> is not within <see cref="F:System.Net.IPEndPoint.MinPort" /> and <see cref="F:System.Net.IPEndPoint.MaxPort" />.</exception>
-        /// <exception cref="ArgumentNullException"><paramref name="authenticationMethods"/> is <c>null</c>.</exception>
-        /// <exception cref="ArgumentException">No <paramref name="authenticationMethods"/> specified.</exception>
-        public ConnectionInfo(string host, int port, string username, IPAddress clientIP, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params AuthenticationMethod[] authenticationMethods)
         {
             if (host == null)
                 throw new ArgumentNullException("host");
@@ -455,7 +386,6 @@ namespace Renci.SshNet
             Host = host;
             Port = port;
             Username = username;
-            ClientIP = clientIP;
 
             ProxyType = proxyType;
             ProxyHost = proxyHost;

+ 1 - 1
src/Renci.SshNet/Session.cs

@@ -1600,7 +1600,7 @@ namespace Renci.SshNet
         /// <exception cref="SocketException">An error occurred trying to establish the connection.</exception>
         private void SocketConnect(string host, int port)
         {
-            var ipAddress = ConnectionInfo.ClientIP ?? DnsAbstraction.GetHostAddresses(host)[0];
+            var ipAddress = DnsAbstraction.GetHostAddresses(host)[0];
             var ep = new IPEndPoint(ipAddress, port);
 
             DiagnosticAbstraction.Log(string.Format("Initiating connection to '{0}:{1}'.", host, port));