internal/socket: add message IO functionality

This change adds portable message IO methods of Conn, IO message and
control message types, and parse methods for the types to provide
those functionality to the ipv4 and ipv6 packages.

With this change, the ipv4 and ipv6 packages can provide low-level
(but less heap allocation and the cost of invoking system calls) API
such as read and write operations for a batch of IO messages.

On vanilla linux/amd64 virtual machine:
BenchmarkUDP/Iter-1-2            1000000              8068 ns/op             408 B/op         14 allocs/op
BenchmarkUDP/Batch-1-2           1000000              8610 ns/op             440 B/op         14 allocs/op
BenchmarkUDP/Iter-2-2             500000             15390 ns/op             816 B/op         28 allocs/op
BenchmarkUDP/Batch-2-2            500000             12715 ns/op             696 B/op         20 allocs/op
BenchmarkUDP/Iter-4-2             200000             30763 ns/op            1632 B/op         56 allocs/op
BenchmarkUDP/Batch-4-2            300000             21853 ns/op            1216 B/op         32 allocs/op
BenchmarkUDP/Iter-8-2             100000             61460 ns/op            3264 B/op        112 allocs/op
BenchmarkUDP/Batch-8-2            200000             39048 ns/op            2256 B/op         56 allocs/op
BenchmarkUDP/Iter-16-2             50000            122408 ns/op            6528 B/op        224 allocs/op
BenchmarkUDP/Batch-16-2           100000             72728 ns/op            4336 B/op        104 allocs/op
BenchmarkUDP/Iter-32-2             30000            243137 ns/op           13056 B/op        448 allocs/op
BenchmarkUDP/Batch-32-2            50000            141332 ns/op            8496 B/op        200 allocs/op
BenchmarkUDP/Iter-64-2             20000            488125 ns/op           26112 B/op        896 allocs/op
BenchmarkUDP/Batch-64-2            30000            282078 ns/op           16816 B/op        392 allocs/op
BenchmarkUDP/Iter-128-2            10000            973752 ns/op           52224 B/op       1792 allocs/op
BenchmarkUDP/Batch-128-2           10000            551021 ns/op           33456 B/op        776 allocs/op
BenchmarkUDP/Iter-256-2             3000           1977852 ns/op          104448 B/op       3584 allocs/op
BenchmarkUDP/Batch-256-2           10000           1252596 ns/op           66736 B/op       1544 allocs/op
BenchmarkUDP/Iter-512-2             2000           4147495 ns/op          208896 B/op       7168 allocs/op
BenchmarkUDP/Batch-512-2            3000           2175774 ns/op          121128 B/op       2612 allocs/op

Change-Id: I3e08b28917b62dbea7936a86acb24e25ccaf5365
Reviewed-on: https://go-review.googlesource.com/38212
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
43 files changed