<commit_before>var _ = require('icebreaker')
var network = require('icebreaker-network')
var listen = network.listen
var combine = network.combine
var map = network.map
var utils = require('icebreaker-network/lib/util')
var Connector = require('./connector')
var url = require('url')

function defaultUrl(addr, params) {
  var p = url.parse(addr)
  if ((p.pathname == null || p.pathname.length ===1) && params.appKey!=null) p.pathname = '/' + params.appKey
  params.encoding = params.encoding||'base64'
  var auth
  if (p.auth == null && params.keys.publicKey!=null) auth = utils.encode(params.keys.publicKey,params.encoding)
  else if (p.auth == null && params.keys.id!=null) auth = utils.encode(params.keys.id,params.encoding)
  if(auth)return p.format().replace(p.protocol+"//",p.protocol+"//"+encodeURIComponent(auth)+"@");
  if(p.auth)return p.format().replace(p.protocol+"//",p.protocol+"//"+encodeURIComponent(p.auth)+"@");
 
  return url.format(p)
}

var Peer = module.exports = function Peer(params) {
  var connector = Connector(params)<commit_msg>fix for shs+protocol+unix<commit_after>var _ = require('icebreaker')
var network = require('icebreaker-network')
var listen = network.listen
var combine = network.combine
var map = network.map
var utils = require('icebreaker-network/lib/util')
var Connector = require('./connector')
var url = require('url')
var path = require("path")

function defaultUrl(addr, params) {
  var p = url.parse(addr);
  if(p.protocol.indexOf("+unix") !==-1 && params.appKey!=null && p.pathname !=null){
    if(p.pathname.indexOf(params.appKey )=== -1)
     p.pathname = path.join(p.pathname , params.appKey)
  }

  if ((p.pathname == null || p.pathname.length ===1 ) && params.appKey!=null) p.pathname = '/' + params.appKey
  params.encoding = params.encoding||'base64'
  var auth
  if (p.auth == null && params.keys.publicKey!=null) auth = utils.encode(params.keys.publicKey,params.encoding)
  else if (p.auth == null && params.keys.id!=null) auth = utils.encode(params.keys.id,params.encoding)
  if(auth)return p.format().replace(p.protocol+"//",p.protocol+"//"+encodeURIComponent(auth)+"@");
  if(p.auth)return p.format().replace(p.protocol+"//",p.protocol+"//"+encodeURIComponent(p.auth)+"@");
 
  return url.format(p)
}

var Peer = module.exports = function Peer(params) {
  var connector = Connector(params)
{'fraction_non_alphanumeric': 0.18537414965986396, 'fraction_numerical': 0.003401360544217687, 'mean_word_length': 4.926952141057934, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6218232', 'n_tokens_mistral': 792, 'n_tokens_neox': 785, 'n_words': 150}