{"action":"created","comment":{"url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls/comments/74221562","id":74221562,"diff_hunk":"@@ -1,198 +1,49 @@\n 'use strict'\n \n-const debug = require('debug')\n-const log = debug('libp2p:tcp')\n-const tcp = require('net')\n-const multiaddr = require('multiaddr')\n-const Address6 = require('ip-address').Address6\n+const net = require('net')\n+const toPull = require('stream-to-pull-stream')\n const mafmt = require('mafmt')\n-// const parallel = require('run-parallel')\n const contains = require('lodash.contains')\n-const os = require('os')\n+const isFunction = require('lodash.isfunction')\n+const noop = require('lodash.noop')\n const Connection = require('interface-connection').Connection\n+const debug = require('debug')\n+const log = debug('libp2p:tcp')\n \n-exports = module.exports = TCP\n-\n-const IPFS_CODE = 421\n-const CLOSE_TIMEOUT = 2000\n-\n-function TCP () {\n-  if (!(this instanceof TCP)) {\n-    return new TCP()\n-  }\n+const createListener = require('./listener')\n \n-  this.dial = function (ma, options, callback) {\n-    if (typeof options === 'function') {\n+module.exports = class TCP {\n+  dial (ma, options, callback) {\n+    if (isFunction(options)) {\n       callback = options\n       options = {}\n     }\n \n     if (!callback) {\n-      callback = function noop () {}\n+      callback = noop","path":"src/index.js","position":42,"original_position":42,"commit_id":"2f183f5144685fcf9d51754f2387c39544096f28","original_commit_id":"2f183f5144685fcf9d51754f2387c39544096f28","user":{"login":"dignifiedquire","id":790842,"avatar_url":"https://avatars.githubusercontent.com/u/790842?v=3","gravatar_id":"","url":"https://api.github.com/users/dignifiedquire","html_url":"https://github.com/dignifiedquire","followers_url":"https://api.github.com/users/dignifiedquire/followers","following_url":"https://api.github.com/users/dignifiedquire/following{/other_user}","gists_url":"https://api.github.com/users/dignifiedquire/gists{/gist_id}","starred_url":"https://api.github.com/users/dignifiedquire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dignifiedquire/subscriptions","organizations_url":"https://api.github.com/users/dignifiedquire/orgs","repos_url":"https://api.github.com/users/dignifiedquire/repos","events_url":"https://api.github.com/users/dignifiedquire/events{/privacy}","received_events_url":"https://api.github.com/users/dignifiedquire/received_events","type":"User","site_admin":false},"body":"I like code deduplication :P","created_at":"2016-08-10T10:37:00Z","updated_at":"2016-08-10T10:37:00Z","html_url":"https://github.com/libp2p/js-libp2p-tcp/pull/20#discussion_r74221562","pull_request_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls/comments/74221562"},"html":{"href":"https://github.com/libp2p/js-libp2p-tcp/pull/20#discussion_r74221562"},"pull_request":{"href":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls/20","id":80236180,"html_url":"https://github.com/libp2p/js-libp2p-tcp/pull/20","diff_url":"https://github.com/libp2p/js-libp2p-tcp/pull/20.diff","patch_url":"https://github.com/libp2p/js-libp2p-tcp/pull/20.patch","issue_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/issues/20","number":20,"state":"open","locked":false,"title":"Migrate to pull-streams","user":{"login":"dignifiedquire","id":790842,"avatar_url":"https://avatars.githubusercontent.com/u/790842?v=3","gravatar_id":"","url":"https://api.github.com/users/dignifiedquire","html_url":"https://github.com/dignifiedquire","followers_url":"https://api.github.com/users/dignifiedquire/followers","following_url":"https://api.github.com/users/dignifiedquire/following{/other_user}","gists_url":"https://api.github.com/users/dignifiedquire/gists{/gist_id}","starred_url":"https://api.github.com/users/dignifiedquire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dignifiedquire/subscriptions","organizations_url":"https://api.github.com/users/dignifiedquire/orgs","repos_url":"https://api.github.com/users/dignifiedquire/repos","events_url":"https://api.github.com/users/dignifiedquire/events{/privacy}","received_events_url":"https://api.github.com/users/dignifiedquire/received_events","type":"User","site_admin":false},"body":"- Uses `net` from node core for now\r\n- Todo for later, polish `pull-net` and use that\r\n- Two failing tests, one is related to unfinished `interface-connection`, the other needs some investigation.\r\n","created_at":"2016-08-05T12:35:29Z","updated_at":"2016-08-10T10:37:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a95b3fddad8a9e6a42b59f45cb8401cd888c1b51","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls/20/commits","review_comments_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls/20/comments","review_comment_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/issues/20/comments","statuses_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/statuses/2f183f5144685fcf9d51754f2387c39544096f28","head":{"label":"libp2p:pull","ref":"pull","sha":"2f183f5144685fcf9d51754f2387c39544096f28","user":{"login":"libp2p","id":14838238,"avatar_url":"https://avatars.githubusercontent.com/u/14838238?v=3","gravatar_id":"","url":"https://api.github.com/users/libp2p","html_url":"https://github.com/libp2p","followers_url":"https://api.github.com/users/libp2p/followers","following_url":"https://api.github.com/users/libp2p/following{/other_user}","gists_url":"https://api.github.com/users/libp2p/gists{/gist_id}","starred_url":"https://api.github.com/users/libp2p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libp2p/subscriptions","organizations_url":"https://api.github.com/users/libp2p/orgs","repos_url":"https://api.github.com/users/libp2p/repos","events_url":"https://api.github.com/users/libp2p/events{/privacy}","received_events_url":"https://api.github.com/users/libp2p/received_events","type":"Organization","site_admin":false},"repo":{"id":42521859,"name":"js-libp2p-tcp","full_name":"libp2p/js-libp2p-tcp","owner":{"login":"libp2p","id":14838238,"avatar_url":"https://avatars.githubusercontent.com/u/14838238?v=3","gravatar_id":"","url":"https://api.github.com/users/libp2p","html_url":"https://github.com/libp2p","followers_url":"https://api.github.com/users/libp2p/followers","following_url":"https://api.github.com/users/libp2p/following{/other_user}","gists_url":"https://api.github.com/users/libp2p/gists{/gist_id}","starred_url":"https://api.github.com/users/libp2p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libp2p/subscriptions","organizations_url":"https://api.github.com/users/libp2p/orgs","repos_url":"https://api.github.com/users/libp2p/repos","events_url":"https://api.github.com/users/libp2p/events{/privacy}","received_events_url":"https://api.github.com/users/libp2p/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libp2p/js-libp2p-tcp","description":"JavaScript implementation of the TCP module that libp2p uses that implements the abstract-transport interface","fork":false,"url":"https://api.github.com/repos/libp2p/js-libp2p-tcp","forks_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/forks","keys_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/teams","hooks_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/hooks","issue_events_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/issues/events{/number}","events_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/events","assignees_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/assignees{/user}","branches_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/branches{/branch}","tags_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/tags","blobs_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/statuses/{sha}","languages_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/languages","stargazers_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/stargazers","contributors_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/contributors","subscribers_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/subscribers","subscription_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/subscription","commits_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/issues/comments{/number}","contents_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/contents/{+path}","compare_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/merges","archive_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/downloads","issues_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/issues{/number}","pulls_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls{/number}","milestones_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/milestones{/number}","notifications_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/labels{/name}","releases_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/releases{/id}","deployments_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/deployments","created_at":"2015-09-15T13:42:08Z","updated_at":"2016-06-18T16:15:54Z","pushed_at":"2016-08-10T08:18:34Z","git_url":"git://github.com/libp2p/js-libp2p-tcp.git","ssh_url":"git@github.com:libp2p/js-libp2p-tcp.git","clone_url":"https://github.com/libp2p/js-libp2p-tcp.git","svn_url":"https://github.com/libp2p/js-libp2p-tcp","homepage":"","size":64,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":2,"forks":6,"open_issues":2,"watchers":3,"default_branch":"master"}},"base":{"label":"libp2p:master","ref":"master","sha":"e01046eb032f4a6d046031af46ed634cf05d54d4","user":{"login":"libp2p","id":14838238,"avatar_url":"https://avatars.githubusercontent.com/u/14838238?v=3","gravatar_id":"","url":"https://api.github.com/users/libp2p","html_url":"https://github.com/libp2p","followers_url":"https://api.github.com/users/libp2p/followers","following_url":"https://api.github.com/users/libp2p/following{/other_user}","gists_url":"https://api.github.com/users/libp2p/gists{/gist_id}","starred_url":"https://api.github.com/users/libp2p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libp2p/subscriptions","organizations_url":"https://api.github.com/users/libp2p/orgs","repos_url":"https://api.github.com/users/libp2p/repos","events_url":"https://api.github.com/users/libp2p/events{/privacy}","received_events_url":"https://api.github.com/users/libp2p/received_events","type":"Organization","site_admin":false},"repo":{"id":42521859,"name":"js-libp2p-tcp","full_name":"libp2p/js-libp2p-tcp","owner":{"login":"libp2p","id":14838238,"avatar_url":"https://avatars.githubusercontent.com/u/14838238?v=3","gravatar_id":"","url":"https://api.github.com/users/libp2p","html_url":"https://github.com/libp2p","followers_url":"https://api.github.com/users/libp2p/followers","following_url":"https://api.github.com/users/libp2p/following{/other_user}","gists_url":"https://api.github.com/users/libp2p/gists{/gist_id}","starred_url":"https://api.github.com/users/libp2p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libp2p/subscriptions","organizations_url":"https://api.github.com/users/libp2p/orgs","repos_url":"https://api.github.com/users/libp2p/repos","events_url":"https://api.github.com/users/libp2p/events{/privacy}","received_events_url":"https://api.github.com/users/libp2p/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libp2p/js-libp2p-tcp","description":"JavaScript implementation of the TCP module that libp2p uses that implements the abstract-transport interface","fork":false,"url":"https://api.github.com/repos/libp2p/js-libp2p-tcp","forks_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/forks","keys_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/teams","hooks_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/hooks","issue_events_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/issues/events{/number}","events_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/events","assignees_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/assignees{/user}","branches_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/branches{/branch}","tags_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/tags","blobs_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/statuses/{sha}","languages_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/languages","stargazers_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/stargazers","contributors_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/contributors","subscribers_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/subscribers","subscription_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/subscription","commits_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/issues/comments{/number}","contents_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/contents/{+path}","compare_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/merges","archive_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/downloads","issues_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/issues{/number}","pulls_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls{/number}","milestones_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/milestones{/number}","notifications_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/labels{/name}","releases_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/releases{/id}","deployments_url":"https://api.github.com/repos/libp2p/js-libp2p-tcp/deployments","created_at":"2015-09-15T13:42:08Z","updated_at":"2016-06-18T16:15:54Z","pushed_at":"2016-08-10T08:18:34Z","git_url":"git://github.com/libp2p/js-libp2p-tcp.git","ssh_url":"git@github.com:libp2p/js-libp2p-tcp.git","clone_url":"https://github.com/libp2p/js-libp2p-tcp.git","svn_url":"https://github.com/libp2p/js-libp2p-tcp","homepage":"","size":64,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":2,"forks":6,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls/20"},"html":{"href":"https://github.com/libp2p/js-libp2p-tcp/pull/20"},"issue":{"href":"https://api.github.com/repos/libp2p/js-libp2p-tcp/issues/20"},"comments":{"href":"https://api.github.com/repos/libp2p/js-libp2p-tcp/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/libp2p/js-libp2p-tcp/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/libp2p/js-libp2p-tcp/statuses/2f183f5144685fcf9d51754f2387c39544096f28"}}}}
{"actor":{"display_login":"dignifiedquire"}}