Socket
Socket
Sign inDemoInstall

concordant

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

concordant - npm Package Compare versions

Comparing version 1.0.4 to 2.0.0

aResolver.js

12

index.js

@@ -17,7 +17,9 @@ /*

var dnsResolver = require('./dnsResolver')
var srvResolver = require('./srvResolver')
var aResolver = require('./aResolver')
module.exports = function () {
module.exports = function (globalOpts) {
var opts = {}
var resolver = srvResolver

@@ -35,7 +37,11 @@

if (process.env.DNS_MODE === 'A' || (globalOpts && globalOpts.dnsMode === 'A')) {
resolver = aResolver
}
return {
dns: dnsResolver(opts.dns)
dns: resolver(opts.dns)
}
}
{
"name": "concordant",
"version": "1.0.4",
"version": "2.0.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "resolver utility module",

@@ -31,4 +31,5 @@ # Concordant

* otherwise use the system DNS configuration to perform lookups
* For each lookup first perform an SRV query to obtain a port number and CNAME record
* To complete the lookup perform an A query against the CNAME record to determine an IP address
* depending on the value of the environment variable DNS_MODE concordant will lookup SRV and or A records
* if DNS_MODE is 'SRV' then for each lookup first perform an SRV query to obtain a port number and CNAME record to complete the lookup perform an A query against the CNAME record to determine an IP address
* Otherwise if DNS_MODE is 'A' just perform and A query in order to resolve the hostname

@@ -67,3 +68,3 @@ ## Kubernetes DNS and Fuge

Example:
### Example SRV lookup

@@ -82,2 +83,16 @@ ```javascript

### Example A lookup
```javascript
var concordant = require('concordant')()
concordant.dns.resolve('full.service.domain.name', function (err, results) {
if (err) { return cb(err) }
// connect to results[0].host and do stuff, in this case no port value is returned...
})
})
```
## Environment Variables

@@ -88,2 +103,3 @@ Concordant uses the following environment variables:

* DNS_PORT - the DNS port to use. Defaults to 50353 if DNS_HOST is set, otherwise uses the system supplied DNS configuration
* DNS_MODE - the lookup mode to use, if set to 'A' then perform host only lookup up. If set to 'SRV' perform SRV and A queries to resolve both host and port number. Defaults to 'SRV'

@@ -90,0 +106,0 @@

@@ -101,18 +101,19 @@ /*

function query (q, port, host, cb) {
var resp = { id: 14978,
type: 'response',
flags: 0,
questions:
[ { name: '_tcp._tcp.service2.testns.svc.cluster.local',
type: 'SRV',
class: 1 } ],
answers:
[ { name: '_tcp._tcp.service2.testns.svc.cluster.local',
type: 'SRV',
class: 1,
ttl: 5,
flush: false,
data: [Object] } ],
authorities: [],
additionals: [] }
var resp = {
id: 14978,
type: 'response',
flags: 0,
questions:
[{name: '_tcp._tcp.service2.testns.svc.cluster.local',
type: 'SRV',
class: 1}],
answers:
[{name: '_tcp._tcp.service2.testns.svc.cluster.local',
type: 'SRV',
class: 1,
ttl: 5,
flush: false,
data: [Object]}],
authorities: [],
additionals: []}

@@ -119,0 +120,0 @@ if (q.questions[0].type === 'SRV') {

@@ -20,3 +20,3 @@ /*

var dnsMock = require('./dns-mock')()
proxyquire('../dnsResolver', {dns: dnsMock.systemStub, 'dns-socket': dnsMock.dnsErrorSocketStub})
proxyquire('../srvResolver', {dns: dnsMock.systemStub, 'dns-socket': dnsMock.dnsErrorSocketStub})
var concordant = require('../index')

@@ -51,3 +51,3 @@

test('test error lookup with system dns', function (t) {
test('test error lookup with direct dns', function (t) {
t.plan(2)

@@ -71,3 +71,3 @@

test('test error lookup with system dns', function (t) {
test('test error lookup with direct dns', function (t) {
t.plan(2)

@@ -74,0 +74,0 @@

@@ -20,3 +20,3 @@ /*

var dnsMock = require('./dns-mock')()
proxyquire('../dnsResolver', {dns: dnsMock.systemStub})
proxyquire('../srvResolver', {dns: dnsMock.systemStub})
var concordant = require('../index')

@@ -23,0 +23,0 @@ var nodeDns = require('dns')

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc