I'm sure this is an issue on my end that I'm fundamentally misunderstanding. I am using sshkit
to connect to and upload some files to a server with IPv6 addressing.
I can SSH into a server with an address like so:
2001:aaa:bbb:cc:dddd:eeee:ffff:gggg
There is no issues until I try to leverage sshkit
to do the same. The below example illustrates how the same IPv6 string is represented in an array (which has many addresses) within the script I am running:
on ["[2001:aaa:bbb:cc:dddd:eeee:ffff:gggg]"], in: :parallel do |host|
#some stuff
end
What I end up seeing is:
Exception on host 2001:aaa:bbb:cc:dddd:eeee:ffff caught: getaddrinfo: nodename nor servname provided, or not known
Note the trailing byte seems to be truncated off? Is there a different way I should be formatting that IPv6 address string?
There is a bug with SSHKit at the moment which I am planning to submit a PR for. Essentially the trailing bytes are swallowed as the port number unless specifically denoted.
### Without port number, it parses incorrectly
SSHKit::Host.new '[2001:db8:85a3:8d3:1319:8a2e:370:7348]'
# => #<SSHKit::Host:0x007fc12318d7d8 @keys=[], @local=false, @user=nil, @hostname="2001:db8:85a3:8d3:1319:8a2e:370", @port=7348>
The work around is to specify the port
### With port number it works
SSHKit::Host.new '[2001:db8:85a3:8d3:1319:8a2e:370:7348]:22'
# => #<SSHKit::Host:0x007fc1231e46c8 @keys=[], @local=false, @user=nil, @hostname="2001:db8:85a3:8d3:1319:8a2e:370:7348", @port=22>