{"action":"created","comment":{"url":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/comments/26514254","id":26514254,"diff_hunk":"@@ -1,60 +1,79 @@\n 'use strict';\n \n-var Buffers = require('buffers');\n+var Buffers = require('./buffers');\n var EventEmitter = require('events').EventEmitter;\n var Net = require('net');\n var Socks5Client = require('socks5-client');\n-var util = require('util');\n-\n var bitcore = require('bitcore');\n-var $ = bitcore.util.preconditions;\n var Networks = bitcore.Networks;\n var Messages = require('./messages');\n-\n-var MAX_RECEIVE_BUFFER = 10000000;\n+var $ = bitcore.util.preconditions;\n+var util = require('util');\n \n /**\n- * A Peer instance represents a remote bitcoin node and allows to communicate\n- * with it using the standard messages of the bitcoin p2p protocol.\n+ * A constructor to create Peer instances to send and recieve messages\n+ * using the standard Bitcoin protocol.\n  *","path":"lib/peer.js","position":24,"original_position":24,"commit_id":"8f2d0089df225e29ca7d20d7062f6c68d56b1988","original_commit_id":"39d1ae9ac8d6b87f6de29ec4940fd10c800e612a","user":{"login":"carnesen","id":5756743,"avatar_url":"https://avatars.githubusercontent.com/u/5756743?v=3","gravatar_id":"","url":"https://api.github.com/users/carnesen","html_url":"https://github.com/carnesen","followers_url":"https://api.github.com/users/carnesen/followers","following_url":"https://api.github.com/users/carnesen/following{/other_user}","gists_url":"https://api.github.com/users/carnesen/gists{/gist_id}","starred_url":"https://api.github.com/users/carnesen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carnesen/subscriptions","organizations_url":"https://api.github.com/users/carnesen/orgs","repos_url":"https://api.github.com/users/carnesen/repos","events_url":"https://api.github.com/users/carnesen/events{/privacy}","received_events_url":"https://api.github.com/users/carnesen/received_events","type":"User","site_admin":false},"body":"How about: \"The Peer class implements the Bitcoin peer-to-peer (P2P) network protocol. A Peer instance represents one connection on the Bitcoin network. To create a new peer connection to a remote server, provide the host and port options in the class constructor and then invoke the connect method. Incoming peer connections are handled by the Pool class and its listen method.\"?","created_at":"2015-03-16T18:34:58Z","updated_at":"2015-03-16T18:34:58Z","html_url":"https://github.com/bitpay/bitcore-p2p/pull/48#discussion_r26514254","pull_request_url":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/comments/26514254"},"html":{"href":"https://github.com/bitpay/bitcore-p2p/pull/48#discussion_r26514254"},"pull_request":{"href":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/48","id":30987279,"html_url":"https://github.com/bitpay/bitcore-p2p/pull/48","diff_url":"https://github.com/bitpay/bitcore-p2p/pull/48.diff","patch_url":"https://github.com/bitpay/bitcore-p2p/pull/48.patch","issue_url":"https://api.github.com/repos/bitpay/bitcore-p2p/issues/48","number":48,"state":"open","locked":false,"title":"Extensible Messages","user":{"login":"braydonf","id":544777,"avatar_url":"https://avatars.githubusercontent.com/u/544777?v=3","gravatar_id":"","url":"https://api.github.com/users/braydonf","html_url":"https://github.com/braydonf","followers_url":"https://api.github.com/users/braydonf/followers","following_url":"https://api.github.com/users/braydonf/following{/other_user}","gists_url":"https://api.github.com/users/braydonf/gists{/gist_id}","starred_url":"https://api.github.com/users/braydonf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/braydonf/subscriptions","organizations_url":"https://api.github.com/users/braydonf/orgs","repos_url":"https://api.github.com/users/braydonf/repos","events_url":"https://api.github.com/users/braydonf/events{/privacy}","received_events_url":"https://api.github.com/users/braydonf/received_events","type":"User","site_admin":false},"body":"- Messages are now built with a factory that can be customized with an options argument to `Messages`, for example:\r\n ```javascript\r\nvar messages = new Messages({Block: Block, magicNumber: 0x0b120907});\r\nvar message = messages.GetData.forBlock(inv.hash);\r\npeer.sendMessage(message);\r\n```\r\nAdditionally, individual message constructors have been organized into separate files.\r\n\r\n- Peer and Pool now have options defined as an object to avoid needing to pass in \"null, null, true\" as arguments, for example:\r\n ```javascript\r\nvar pool = new Pool({relay: false, dnsSeed: false, network: Networks.testnet});\r\n```\r\n\r\n- Adds an Inventory constructor to be shared between several of the message types, separate from the Inventory message.\r\n\r\n- Changes to use BufferWriter instead of needing the  \"bufferput\" dependency.\r\n\r\n- Adds a `listen()` method to Pool to enable remote peers to be added to the pool upon incoming connections, enables bitcore to bitcore node connectivity.\r\n\r\n- Increases test coverage","created_at":"2015-03-11T21:30:42Z","updated_at":"2015-03-16T18:34:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12250332fe02cabfe84d09def4f1c9df5a77c32c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/48/commits","review_comments_url":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/48/comments","review_comment_url":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitpay/bitcore-p2p/issues/48/comments","statuses_url":"https://api.github.com/repos/bitpay/bitcore-p2p/statuses/8f2d0089df225e29ca7d20d7062f6c68d56b1988","head":{"label":"braydonf:feature/extensibility","ref":"feature/extensibility","sha":"8f2d0089df225e29ca7d20d7062f6c68d56b1988","user":{"login":"braydonf","id":544777,"avatar_url":"https://avatars.githubusercontent.com/u/544777?v=3","gravatar_id":"","url":"https://api.github.com/users/braydonf","html_url":"https://github.com/braydonf","followers_url":"https://api.github.com/users/braydonf/followers","following_url":"https://api.github.com/users/braydonf/following{/other_user}","gists_url":"https://api.github.com/users/braydonf/gists{/gist_id}","starred_url":"https://api.github.com/users/braydonf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/braydonf/subscriptions","organizations_url":"https://api.github.com/users/braydonf/orgs","repos_url":"https://api.github.com/users/braydonf/repos","events_url":"https://api.github.com/users/braydonf/events{/privacy}","received_events_url":"https://api.github.com/users/braydonf/received_events","type":"User","site_admin":false},"repo":{"id":29320250,"name":"bitcore-p2p","full_name":"braydonf/bitcore-p2p","owner":{"login":"braydonf","id":544777,"avatar_url":"https://avatars.githubusercontent.com/u/544777?v=3","gravatar_id":"","url":"https://api.github.com/users/braydonf","html_url":"https://github.com/braydonf","followers_url":"https://api.github.com/users/braydonf/followers","following_url":"https://api.github.com/users/braydonf/following{/other_user}","gists_url":"https://api.github.com/users/braydonf/gists{/gist_id}","starred_url":"https://api.github.com/users/braydonf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/braydonf/subscriptions","organizations_url":"https://api.github.com/users/braydonf/orgs","repos_url":"https://api.github.com/users/braydonf/repos","events_url":"https://api.github.com/users/braydonf/events{/privacy}","received_events_url":"https://api.github.com/users/braydonf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/braydonf/bitcore-p2p","description":"Interface to the bitcoin P2P network for bitcore","fork":true,"url":"https://api.github.com/repos/braydonf/bitcore-p2p","forks_url":"https://api.github.com/repos/braydonf/bitcore-p2p/forks","keys_url":"https://api.github.com/repos/braydonf/bitcore-p2p/keys{/key_id}","collaborators_url":"https://api.github.com/repos/braydonf/bitcore-p2p/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/braydonf/bitcore-p2p/teams","hooks_url":"https://api.github.com/repos/braydonf/bitcore-p2p/hooks","issue_events_url":"https://api.github.com/repos/braydonf/bitcore-p2p/issues/events{/number}","events_url":"https://api.github.com/repos/braydonf/bitcore-p2p/events","assignees_url":"https://api.github.com/repos/braydonf/bitcore-p2p/assignees{/user}","branches_url":"https://api.github.com/repos/braydonf/bitcore-p2p/branches{/branch}","tags_url":"https://api.github.com/repos/braydonf/bitcore-p2p/tags","blobs_url":"https://api.github.com/repos/braydonf/bitcore-p2p/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/braydonf/bitcore-p2p/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/braydonf/bitcore-p2p/git/refs{/sha}","trees_url":"https://api.github.com/repos/braydonf/bitcore-p2p/git/trees{/sha}","statuses_url":"https://api.github.com/repos/braydonf/bitcore-p2p/statuses/{sha}","languages_url":"https://api.github.com/repos/braydonf/bitcore-p2p/languages","stargazers_url":"https://api.github.com/repos/braydonf/bitcore-p2p/stargazers","contributors_url":"https://api.github.com/repos/braydonf/bitcore-p2p/contributors","subscribers_url":"https://api.github.com/repos/braydonf/bitcore-p2p/subscribers","subscription_url":"https://api.github.com/repos/braydonf/bitcore-p2p/subscription","commits_url":"https://api.github.com/repos/braydonf/bitcore-p2p/commits{/sha}","git_commits_url":"https://api.github.com/repos/braydonf/bitcore-p2p/git/commits{/sha}","comments_url":"https://api.github.com/repos/braydonf/bitcore-p2p/comments{/number}","issue_comment_url":"https://api.github.com/repos/braydonf/bitcore-p2p/issues/comments{/number}","contents_url":"https://api.github.com/repos/braydonf/bitcore-p2p/contents/{+path}","compare_url":"https://api.github.com/repos/braydonf/bitcore-p2p/compare/{base}...{head}","merges_url":"https://api.github.com/repos/braydonf/bitcore-p2p/merges","archive_url":"https://api.github.com/repos/braydonf/bitcore-p2p/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/braydonf/bitcore-p2p/downloads","issues_url":"https://api.github.com/repos/braydonf/bitcore-p2p/issues{/number}","pulls_url":"https://api.github.com/repos/braydonf/bitcore-p2p/pulls{/number}","milestones_url":"https://api.github.com/repos/braydonf/bitcore-p2p/milestones{/number}","notifications_url":"https://api.github.com/repos/braydonf/bitcore-p2p/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/braydonf/bitcore-p2p/labels{/name}","releases_url":"https://api.github.com/repos/braydonf/bitcore-p2p/releases{/id}","created_at":"2015-01-15T21:58:10Z","updated_at":"2015-02-03T00:52:10Z","pushed_at":"2015-03-16T17:52:26Z","git_url":"git://github.com/braydonf/bitcore-p2p.git","ssh_url":"git@github.com:braydonf/bitcore-p2p.git","clone_url":"https://github.com/braydonf/bitcore-p2p.git","svn_url":"https://github.com/braydonf/bitcore-p2p","homepage":null,"size":521,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bitpay:master","ref":"master","sha":"ae93c147b7d09e1de9e6530a07d197e43d06903c","user":{"login":"bitpay","id":2554930,"avatar_url":"https://avatars.githubusercontent.com/u/2554930?v=3","gravatar_id":"","url":"https://api.github.com/users/bitpay","html_url":"https://github.com/bitpay","followers_url":"https://api.github.com/users/bitpay/followers","following_url":"https://api.github.com/users/bitpay/following{/other_user}","gists_url":"https://api.github.com/users/bitpay/gists{/gist_id}","starred_url":"https://api.github.com/users/bitpay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitpay/subscriptions","organizations_url":"https://api.github.com/users/bitpay/orgs","repos_url":"https://api.github.com/users/bitpay/repos","events_url":"https://api.github.com/users/bitpay/events{/privacy}","received_events_url":"https://api.github.com/users/bitpay/received_events","type":"Organization","site_admin":false},"repo":{"id":28597370,"name":"bitcore-p2p","full_name":"bitpay/bitcore-p2p","owner":{"login":"bitpay","id":2554930,"avatar_url":"https://avatars.githubusercontent.com/u/2554930?v=3","gravatar_id":"","url":"https://api.github.com/users/bitpay","html_url":"https://github.com/bitpay","followers_url":"https://api.github.com/users/bitpay/followers","following_url":"https://api.github.com/users/bitpay/following{/other_user}","gists_url":"https://api.github.com/users/bitpay/gists{/gist_id}","starred_url":"https://api.github.com/users/bitpay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitpay/subscriptions","organizations_url":"https://api.github.com/users/bitpay/orgs","repos_url":"https://api.github.com/users/bitpay/repos","events_url":"https://api.github.com/users/bitpay/events{/privacy}","received_events_url":"https://api.github.com/users/bitpay/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bitpay/bitcore-p2p","description":"Interface to the bitcoin P2P network for bitcore","fork":false,"url":"https://api.github.com/repos/bitpay/bitcore-p2p","forks_url":"https://api.github.com/repos/bitpay/bitcore-p2p/forks","keys_url":"https://api.github.com/repos/bitpay/bitcore-p2p/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitpay/bitcore-p2p/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitpay/bitcore-p2p/teams","hooks_url":"https://api.github.com/repos/bitpay/bitcore-p2p/hooks","issue_events_url":"https://api.github.com/repos/bitpay/bitcore-p2p/issues/events{/number}","events_url":"https://api.github.com/repos/bitpay/bitcore-p2p/events","assignees_url":"https://api.github.com/repos/bitpay/bitcore-p2p/assignees{/user}","branches_url":"https://api.github.com/repos/bitpay/bitcore-p2p/branches{/branch}","tags_url":"https://api.github.com/repos/bitpay/bitcore-p2p/tags","blobs_url":"https://api.github.com/repos/bitpay/bitcore-p2p/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitpay/bitcore-p2p/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitpay/bitcore-p2p/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitpay/bitcore-p2p/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitpay/bitcore-p2p/statuses/{sha}","languages_url":"https://api.github.com/repos/bitpay/bitcore-p2p/languages","stargazers_url":"https://api.github.com/repos/bitpay/bitcore-p2p/stargazers","contributors_url":"https://api.github.com/repos/bitpay/bitcore-p2p/contributors","subscribers_url":"https://api.github.com/repos/bitpay/bitcore-p2p/subscribers","subscription_url":"https://api.github.com/repos/bitpay/bitcore-p2p/subscription","commits_url":"https://api.github.com/repos/bitpay/bitcore-p2p/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitpay/bitcore-p2p/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitpay/bitcore-p2p/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitpay/bitcore-p2p/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitpay/bitcore-p2p/contents/{+path}","compare_url":"https://api.github.com/repos/bitpay/bitcore-p2p/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitpay/bitcore-p2p/merges","archive_url":"https://api.github.com/repos/bitpay/bitcore-p2p/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitpay/bitcore-p2p/downloads","issues_url":"https://api.github.com/repos/bitpay/bitcore-p2p/issues{/number}","pulls_url":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls{/number}","milestones_url":"https://api.github.com/repos/bitpay/bitcore-p2p/milestones{/number}","notifications_url":"https://api.github.com/repos/bitpay/bitcore-p2p/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitpay/bitcore-p2p/labels{/name}","releases_url":"https://api.github.com/repos/bitpay/bitcore-p2p/releases{/id}","created_at":"2014-12-29T15:58:23Z","updated_at":"2015-03-13T16:19:16Z","pushed_at":"2015-03-13T16:19:16Z","git_url":"git://github.com/bitpay/bitcore-p2p.git","ssh_url":"git@github.com:bitpay/bitcore-p2p.git","clone_url":"https://github.com/bitpay/bitcore-p2p.git","svn_url":"https://github.com/bitpay/bitcore-p2p","homepage":null,"size":1164,"stargazers_count":9,"watchers_count":9,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":14,"forks":11,"open_issues":14,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/48"},"html":{"href":"https://github.com/bitpay/bitcore-p2p/pull/48"},"issue":{"href":"https://api.github.com/repos/bitpay/bitcore-p2p/issues/48"},"comments":{"href":"https://api.github.com/repos/bitpay/bitcore-p2p/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitpay/bitcore-p2p/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/bitpay/bitcore-p2p/statuses/8f2d0089df225e29ca7d20d7062f6c68d56b1988"}}}}