Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipv6 abbreviated address support #539

Merged
merged 1 commit into from
Oct 13, 2022
Merged

ipv6 abbreviated address support #539

merged 1 commit into from
Oct 13, 2022

Conversation

jshort
Copy link
Collaborator

@jshort jshort commented Oct 13, 2022

This will support ipv6 addresses that are abbreviated with :: such as
::1 (for 0:0:0:0:0:0:0:1) with some caveats around specifying the port
in the host positional argument.

Help output:

$> ./et --help
Remote shell for the busy and impatient
Usage:
  et [OPTION...] [user@]host[:port]

  Note that 'host' can be a hostname or ipv4 address with or without a port
  or an ipv6 address. If the ipv6 address is abbreviated with :: then it must
  be specfied without a port (use -p,--port).

  -h, --help                 Print help
      --version              Print version
  -u, --username             Username
      --host arg             Remote host name
  ...

Tests:

$> ./et ::1 -p 8080 --macserver
$> ./et 0:0:0:0:0:0:0:1 -p 8080 --macserver
$> ./et 0:0:0:0:0:0:0:1:8080 --macserver
$> ./et ::1 -p 8080 --macserver # fails because defaults to port 2022

Fixes #537

This will support ipv6 addresses that are abbreviated with `::` such as
::1 (for 0:0:0:0:0:0:0:1) with some caveats around specifying the port
in the host positional argument.

Help output:

```
$> ./et --help
Remote shell for the busy and impatient
Usage:
  et [OPTION...] [user@]host[:port]

  Note that 'host' can be a hostname or ipv4 address with or without a port
  or an ipv6 address. If the ipv6 address is abbreviated with :: then it must
  be specfied without a port (use -p,--port).

  -h, --help                 Print help
      --version              Print version
  -u, --username             Username
      --host arg             Remote host name
  ...
```
Tests:

```
$> ./et ::1 -p 8080 --macserver
$> ./et 0:0:0:0:0:0:0:1 -p 8080 --macserver
$> ./et 0:0:0:0:0:0:0:1:8080 --macserver
$> ./et ::1 -p 8080 --macserver # fails because defaults to port 2022
```
Fixes MisterTea#537
("host", "Remote host name",
cxxopts::value<std::string>()) //
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed all these trailing // as I'm not sure why there are there. It looks like they are supposed to be \ like when you extend a shell command in a script but they are not necessary in this context.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are to avoid clang-format from putting multiple options per line

@MisterTea
Copy link
Owner

Thanks!

@MisterTea MisterTea merged commit 8d8db62 into MisterTea:master Oct 13, 2022
@jshort jshort deleted the ipv6 branch December 7, 2022 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]Support collapsed zeroes format for ipv6 host addresses (i.e. ::1 for 0:0:0:0:0:0:0:1)
2 participants