Define doLookupProtocol in a common place so that it can be used across modules
vishalmohanty opened this issue · 1 comments
vishalmohanty commented
Currently every module is having to define doLookupProtocol
in order to get IP addresses of either CNAME records, MX records, NS records, etc.
I was able to define DoLookupProtocol
in common.go
but faced issue in running unit tests like alookup_test.go
because the mocked DoMiekgLookup
was not being called. Instead the actual implementation in miekg.go
was being invoked.
There should be some way of injecting dependencies or mocking functions of other modules, which will help us abstract out doLookupProtocol
. Investigate that.
zakird commented
It probably makes sense to define the function here as part of the core library. https://github.com/zmap/zdns/blob/master/modules/miekg/miekg.go