How to use the address.ipv6 function in address

To help you get started, we’ve selected a few address examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github teambition / koa-opentracing / src / span.js View on Github external
const cluster = require('cluster')
const opentracing = require('opentracing')
const address = require('address')
const SpanContext = require('./span_context')

const WORKER_ID = cluster.worker ? cluster.worker.id : 0
const IPV4 = address.ip()
const IPV6 = address.ipv6()

class Span extends opentracing.Span {
  constructor (tracer, spanOptions = {}) {
    super()

    this.TRACER = tracer
    this._startTime = spanOptions.startTime || Date.now()
    this._finishTime = null
    this._tags = spanOptions.tags || {}
    this._references = spanOptions.references || []
    this._parentSpanContext = null

    // for test
    this.CONTEXT = spanOptions.context

    if (!this.CONTEXT && this._references.length > 0) {
github facebook / create-react-app / packages / react-dev-utils / prepareProxy.js View on Github external
function resolveLoopback(proxy) {
  const o = url.parse(proxy);
  o.host = undefined;
  if (o.hostname !== 'localhost') {
    return proxy;
  }
  try {
    o.hostname = address.ipv6() ? '::1' : '127.0.0.1';
  } catch (_ignored) {
    o.hostname = '127.0.0.1';
  }
  return url.format(o);
}