dgram: introduce `reuseAddr` option

Introduce new signature for both `dgram.createSocket` method and
`dgram.Socket` constructor:

    dgram.createSocket(options, [listener])

Options should contain `type` property and may contain `reuseAddr`
property. When `reuseAddr` is `true` - SO_REUSEADDR will be issued on
socket on bind.

fix #7415

Signed-off-by: Fedor Indutny <fedor@indutny.com>
test: add `reuseAddr` in dgram-multicast...

Add `reuseAddr` option in `test-dgram-multicast-multi-process.js`
test: remove vm-infinite-recursion

It doesn't work reliably on all platforms.

see #7432

Signed-off-by: Fedor Indutny <fedor@indutny.com>
buffer: truncate buffer after string decode

When our estimates for a storage size are higher than the actual length
of decoded data, the destination buffer should be truncated. Otherwise
`Buffer::Length` will give misleading information to C++ layer.

fix #7365

Signed-off-by: Fedor Indutny <fedor@indutny.com>
buffer: return uint if MSB is 1 in readUInt32

Fix issue where a signed integer is returned.

Example:

var b = new Buffer(4);
b.writeUInt32BE(0xffffffff);
b.readUInt32BE(0) == -1

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
main: Handle SIGINT properly.

As explained by http://www.cons.org/cracauer/sigint.html

Signed-off-by: Fedor Indutny <fedor@indutny.com>
net: bind to `::` TCP address by default

Try binding TCP socket to `::` first before falling back to
`0.0.0.0`.
net: deduplicate Socket.prototype.address

Signed-off-by: Fedor Indutny <fedor@indutny.com>
fs: return blksize on stats object

Oversight to not pass blksize to fs.Stats on initialization.

Also added a test to make sure the object property has been set. Since
now on Windows both blksize and blocks will simply be set to undefined.
events: check if _events is an own property

Without this check it is possible to have the _events object shared
amongst instances.

Fixes #7157

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
tls: set _connecting before starting the flow

When creating a TLSSocket instance based on the existing connecting
socket, `_connecting` property is copied after the initialization of
`net.Socket`. However, since `net.Socket` constructor will call
`.read(0)` if the `readable` is true - error may happen at this code
chunk in net.js:

    Socket.prototype._read = function(n) {
      debug('_read');

      if (this._connecting || !this._handle) {
        debug('_read wait for connection');
        this.once('connect', this._read.bind(this, n));
    ...

Leading to a test failures on windows:

 - test/simple/test-tls-connect-given-socket.js

Signed-off-by: Fedor Indutny <fedor@indutny.com>
tls: support OCSP on client and server
tls: `getPeerCertificate(detailed)`

Add `raw` property to certificate, add mode to output full certificate
chain.
src: lint after OCSP commits