Exercises
Powerful Command-Line Applications in Go — by Ricardo Gerardi (82 / 127)
👈 Generating Command Completion an d Documentation | TOC | Wrapping Up 👉
Before you move on, you should build on the skills and techniques you explored in this chapter. Here are some suggestions:
- Allow the user to provide port ranges, such as 1–1024, in addition to specific ports for scan.
- Validate the provided port numbers are within the proper range for TCP ports from 1 to 65535.
- Allow the user to execute UDP port scans in addition to TCP. Update the scan package and the command-line tool accordingly.
- Add a new flag to the scan subcommand allowing the user to specify a filter to show only open or closed ports.
- Add a new flag to the scan subcommand allowing the user to specify a custom timeout for the scan.
👈 Generating Command Completion an d Documentation | TOC | Wrapping Up 👉
Powerful Command-Line Applications in Go by Ricardo Gerardi can be purchased in other book formats directly from the Pragmatic Programmers. If you notice a code error or formatting mistake, please let us know here so that we can fix it.