func StripGreasedVersions(versions []VersionNumber) []VersionNumber {
	realVersions := make([]VersionNumber, 0, len(versions))
	for _, v := range versions {
		if v&0x0f0f0f0f != 0x0a0a0a0a {
			realVersions = append(realVersions, v)
		}
	}
	return realVersions
}
StripGreasedVersions strips all greased versions from a slice of versions
package protocol
import (
	"crypto/rand"
	"encoding/binary"
	"fmt"
	"math"
)
type VersionNumber uint32
const (
	gquicVersion0   = 0x51303030
	maxGquicVersion = 0x51303439
)
const (
	VersionTLS      VersionNumber = 0x51474fff
	VersionWhatever VersionNumber = 1  
	VersionUnknown  VersionNumber = math.MaxUint32
)
var SupportedVersions = []VersionNumber{VersionTLS}
func IsValidVersion(v VersionNumber) bool {
	return v == VersionTLS || IsSupportedVersion(SupportedVersions, v)
}
func (vn VersionNumber) String() string {
	switch vn {
	case VersionWhatever:
		return "whatever"
	case VersionUnknown:
		return "unknown"
	case VersionTLS:
		return "TLS dev version (WIP)"
	default:
		if vn.isGQUIC() {
			return fmt.Sprintf("gQUIC %d", vn.toGQUICVersion())
		}
		return fmt.Sprintf("%#x", uint32(vn))
	}
}
func (vn VersionNumber) ToAltSvc() string {
	return fmt.Sprintf("%d", vn)
}
func (vn VersionNumber) isGQUIC() bool {
	return vn > gquicVersion0 && vn <= maxGquicVersion
}
func (vn VersionNumber) toGQUICVersion() int {
	return int(10*(vn-gquicVersion0)/0x100) + int(vn%0x10)
}
func IsSupportedVersion(supported []VersionNumber, v VersionNumber) bool {
	for _, t := range supported {
		if t == v {
			return true
		}
	}
	return false
}
func ChooseSupportedVersion(ours, theirs []VersionNumber) (VersionNumber, bool) {
	for _, ourVer := range ours {
		for _, theirVer := range theirs {
			if ourVer == theirVer {
				return ourVer, true
			}
		}
	}
	return 0, false
}
func generateReservedVersion() VersionNumber {
	b := make([]byte, 4)
	_, _ = rand.Read(b)  
	return VersionNumber((binary.BigEndian.Uint32(b) | 0x0a0a0a0a) & 0xfafafafa)
}
func GetGreasedVersions(supported []VersionNumber) []VersionNumber {
	b := make([]byte, 1)
	_, _ = rand.Read(b)  
	randPos := int(b[0]) % (len(supported) + 1)
	greased := make([]VersionNumber, len(supported)+1)
	copy(greased, supported[:randPos])
	greased[randPos] = generateReservedVersion()
	copy(greased[randPos+1:], supported[randPos:])
	return greased
}