skx / overseer

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Our implementation could be improved

skx opened this issue · comments

Right now every protocol handler has three methods:

  • RunTest( string target )
  • SetInput
  • SetOptions

Setting the objects is clearly pointless if we could pass them into the RunTest method. Similarly the input-line should be part of the test.

I'd suggest we rework the API such that the protocol-testing methods would have the single method:

  • RunTest(tst parser.Test, target string, opts TestOptions ) error

i.e. We pass the test-Object into the method, and the test-options too.

Similarly each method calls ParseArguments to parse ports, passwords, etc. That should be a job done by the parser - half the reason for unifying the options was so that we'd only need to parse them once.

So our updated parser.Test object would look like this:

   type Test struct {
   	Target string
   	Type   string
   	Input  string
   	Arguments map[string]string
   }

i.e. We'd add input rather than using SetInput, and we'd add the map of arguments.

Lots of churn, but should be a simple change and one that benefits us.