func NewChannel()

in server/server.go [132:164]


func NewChannel(tlsVersion uint16) (ch *Channel, err error) {
	ch = &Channel{}
	ch.state = ServerStateUninitialized
	ch.shim = ts.NewTransportShim()

	crt, err := tls.X509KeyPair([]byte(constants.SrvTestCrt), []byte(constants.SrvTestKey))
	if err != nil {
		return nil, fmt.Errorf("failed to create server credentials: %v", err)
	}

	conf := &tls.Config{
		Certificates:           []tls.Certificate{crt},
		MinVersion:             tlsVersion,
		MaxVersion:             tlsVersion,
		CipherSuites:           constants.AllowableCipherSuites,
		SessionTicketsDisabled: true,
		InsecureSkipVerify:     true,
	}
	ch.conn = tls.Server(ch.shim, conf)
	id, err := uuid.NewRandom()

	if err != nil {
		return nil, fmt.Errorf("failed to create UUID: %v", err)
	}

	ch.connID, err = id.MarshalBinary()

	if err != nil {
		return nil, fmt.Errorf("failed to create connection id: %v", err)
	}

	return ch, nil
}