sshnet / SSH.NET

SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.
http://sshnet.github.io/SSH.NET/
MIT License
4k stars 931 forks source link

SftpClient, ability to set ClientIpAddress #132

Open itssimple opened 7 years ago

itssimple commented 7 years ago

If you use the SftpClient on for example a webserver with multiple IP addresses, we need to be able to set which IP-address to connect from.

var ftp = new SftpClient(new ConnectionInfo(and, so, on, and_on));
ftp.ClientIpAddress = "external_ip_address_here";
ftp.Connect();

This would help us connect to SFTP-servers with limited IP-access.

olegkap commented 7 years ago

I added new ConnectionInfo constractor where you can specify client IP to be used in case of multiple IP address.

You can use it like this: new ConnectionInfo(host, username, password, clientIP)

where clientIP is IPAddress type.

Please get latest version and see if it works for you.

Thanks, Oleg

drieseng commented 7 years ago

I had to revert this change as it introduced regressions, and I'm pretty sure it did not provide the requested behavior.

@itssimple Can you test and provide feedback once I commit a proposal?

Metze2000 commented 2 months ago

Is there a solution in sight? The change of Dec 2016 seems to be solving the problem, only using host[0].