skx / overseer

A golang-based remote protocol tester for testing sites & service availability

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Further improve argument parsing

skx opened this issue · comments

We've now updated each protocol-test with a list of arguments that it can support. This improves our parser because it means this is an error that is discovered at parse-time:

  ftp.example.com must run ftp with username moi

(Because the FTP-probe only supports the single, optional, argument: port:

   ftp.example.com must run ftp with port 2121

We can improve things further by restricting the arguments to match patterns. ie. To differentiate between these two case:

  • ftp.example.com must run ftp with port ftp
  • ftp.example.com must run ftp with port 21

In this case we'd change from port being a valid argument to port must match \d+.

In short our API would return a map of names/regexps, not just an array of names.