func FixIPv6(ipStr string) (string, error) {
	split := strings.Split(ipStr, ":::")
	switch len(split) {
	case 1:
		return ipStr, nil
	case 2:
		if split[1][0] == ':' {
			return "", ErrIPv6QuadColon
		}
		return split[0] + "::" + split[1], nil
	default:
		return ipStr, ErrIPv6MultipleTripleColon
	}
}
FixIPv6 fixes triple colon ::: which is produced by sidestream.
This error is produced by older versions of the c-web100 library, which is still
used by sidestream.
package web100
import (
	"errors"
	"io"
	"io/ioutil"
	"net"
	"strings"
	"syscall"
)
func ParseWeb100Definitions(tcpKis io.Reader) (map[string]string, error) {
	var legacyNamesToNewNames map[string]string
	var preferredName string
	data, err := ioutil.ReadAll(tcpKis)
	if err != nil {
		return nil, err
	}
	legacyNamesToNewNames = make(map[string]string)
	for _, line := range strings.Split(string(data), "\n") {
		fields := strings.Fields(line)
		if len(fields) < 2 {
			continue
		}
		if fields[0] == "VariableName:" {
			preferredName = fields[1]
		}
		if fields[0] == "RenameFrom:" {
			for _, legacyName := range fields[1:] {
				legacyNamesToNewNames[legacyName] = preferredName
			}
		}
	}
	return legacyNamesToNewNames, nil
}
func ParseIPFamily(ipStr string) int64 {
	ip := net.ParseIP(ipStr)
	if ip.To4() != nil {
		return syscall.AF_INET
	} else if ip.To16() != nil {
		return syscall.AF_INET6
	}
	return -1
}
var (
	ErrIPIsUnparseable   = errors.New("IP not parsable")
	ErrIPIsUnconvertible = errors.New("IP not convertible to ipv4 or ipv6")
	ErrIPIsZero          = errors.New("IP is zero/unspecified")
	ErrIPIsUnroutable    = errors.New("IP is nonroutable")
	ErrIPv4IsPrivate    = errors.New("private IPv4")
	ErrIPv6IsPrivate    = errors.New("private IPv6")
	ErrIPv4IsUnroutable = errors.New("unroutable IPv4")
	ErrIPv6IsUnroutable = errors.New("unroutable IPv6")
	ErrIPv6MultipleTripleColon = errors.New("more than one ::: in an ip address")
	ErrIPv6QuadColon           = errors.New("IP address contains :::: ")
)