func addrParts(address string) (string, int, error) {
	addr, err := net.ResolveTCPAddr("tcp", address)
	if err != nil {
		return "", 0, err
	}
	return addr.IP.String(), addr.Port, nil
}
The following functions are mostly extracted from Serf. See setupAgent function in cmd/serf/command/agent/command.go
Thanks for the extraordinary software.

Source: https://github.com/hashicorp/serf/blob/master/cmd/serf/command/agent/command.go#L204
package config
import (
	"fmt"
	"net"
	"runtime"
	"strconv"
	"github.com/hashicorp/go-sockaddr"
)