Skip to content

Commit

Permalink
Codacy improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
markSmurphy committed Nov 3, 2020
1 parent 38b3df1 commit 292baa8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
30 changes: 15 additions & 15 deletions ToDo.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@
- [ ] Look to add [fuzzy search](https://www.npmjs.com/package/fuzzy) for unknown (mistyped) CLI options.
- [ ] Add `--certs` switch which instructs `distributed-dig.js` to extract an x.505 certificate from each unique IP address, and add the details to the `lookupResult` response object using:

```javascript
const https = require('https');

https.get('https://92.122.153.27', {
headers : { host : 'www.asos.com' },
//servername : 'www.asos.com'
}, res => {
//console.log(res);
var cert = res.socket.getPeerCertificate();
console.log(cert);
console.log(cert.subject);
}).on('error', e => {
console.log('Error: ', e.message);
});
```
```javascript
const https = require('https');

https.get('https://92.122.153.27', {
headers : { host : 'www.asos.com' },
//servername : 'www.asos.com'
}, res => {
//console.log(res);
var cert = res.socket.getPeerCertificate();
console.log(cert);
console.log(cert.subject);
}).on('error', e => {
console.log('Error: ', e.message);
});
```

- [ ] Add option to make HTTPS request to endpoints (to each uniquely resolved IP address and insert `host` header) and list all or specified response headers.
- [ ] Allow for `--certs` *and* `--verbose` to display more x.509 properties.
Expand Down
10 changes: 5 additions & 5 deletions ddig-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ module.exports = {
}
} else if (options.getRecordType) {
// Get the Resource Record type (CNAME, A, AAA, etc)
var rrtype =module.exports.ResourceRecordType(answer[0].type);
var rrtype = module.exports.resourceRecordType(answer[0].type);
// Add record type to the response object
response = rrtype;
debug('Resource Record Type: %s', rrtype);
} else if (options.getTTL) {
// Get the record's time-to-live value
response = answer[0].ttl
response = answer[0].ttl;
debug('TTL: %s', answer[0].ttl);
}

Expand Down Expand Up @@ -263,10 +263,10 @@ module.exports = {
}
},

ResourceRecordType(value) { // Takes the integer value returned in a DNS "answer" and returns the corresponding record name
resourceRecordType(value) { // Takes the integer value returned in a DNS "answer" and returns the corresponding record name
const DNSResourceRecordsDatabase = configFilePath +'/' + 'DNSResourceRecords.json';
try {
debug('ResourceRecordType() called with value: %s', value);
debug('resourceRecordType() called with value: %s', value);
// Read in Resource Record database
const fs = require('fs');
debug('Reading in DNS Resource Records data from [%s]', DNSResourceRecordsDatabase);
Expand All @@ -282,7 +282,7 @@ module.exports = {
// Set new return value of the record type found
returnValue = DNSRecords.RecordTypes[i].type;
// Stop processing the rest of the loop by skipping the array index forward to the end
i = DNSRecords.RecordTypes.length
i = DNSRecords.RecordTypes.length;
}
}

Expand Down

0 comments on commit 292baa8

Please sign in to comment.