net: fix inconsistent behavior across platforms in SetKeepAlivePeriod

The previous implementation used per-socket TCP keepalive options
wrong. For example, it used another level socket option to control
TCP and it didn't use TCP_KEEPINTVL option when possible.

Fixes issue 8683.
Fixes issue 8701.
Update issue 8679

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://codereview.appspot.com/136480043