// StartCloudHub starts the cloud hub service
StartCloudHub starts the cloud hub service
// StartCloudHub starts the cloud hub service
func StartCloudHub(config *util.Config, messageq *channelq.ChannelMessageQueue) {
	pool := x509.NewCertPool()
	ok := pool.AppendCertsFromPEM(config.Ca)
	if !ok {
		panic(fmt.Errorf("fail to load ca content"))
	}
	cert, err := tls.X509KeyPair(config.Cert, config.Key)
	if err != nil {
		panic(err)
	}
	tlsConfig := tls.Config{
		ClientCAs:    pool,
		ClientAuth:   tls.RequireAndVerifyClientCert,
		Certificates: []tls.Certificate{cert},
		MinVersion:   tls.VersionTLS12,
		CipherSuites: []uint16{tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256},
	}
	handler.InitHandler(config, messageq)
	svc := server.Server{
		Type:       api.ProtocolTypeQuic,
		Addr:       fmt.Sprintf("%s:%d", config.Address, config.QuicPort),
		TLSConfig:  &tlsConfig,
		AutoRoute:  true,
		ConnNotify: handler.CloudhubHandler.OnRegister,
		ExOpts:     api.QuicServerOption{MaxIncomingStreams: config.MaxIncomingStreams},
	}
	klog.Info("Start cloud hub quic server")
	svc.ListenAndServeTLS("", "")
}
func StartCloudHub ( config * util . Config , messageq * channelq . ChannelMessageQueue ) { pool := x509 . NewCertPool ( ) ok := pool . AppendCertsFromPEM ( config . Ca ) if ! ok { panic ( fmt . Errorf ( " " ) ) } cert , err := tls . X509KeyPair ( config . Cert , config . Key ) if err != nil { panic ( err ) } tlsConfig := tls . Config { ClientCAs : pool , ClientAuth : tls . RequireAndVerifyClientCert , Certificates : [ ] tls . Certificate { cert } , MinVersion : tls . VersionTLS12 , CipherSuites : [ ] uint16 { tls . TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 } , } handler . InitHandler ( config , messageq ) svc := server . Server { Type : api . ProtocolTypeQuic , Addr : fmt . Sprintf ( " " , config . Address , config . QuicPort ) , TLSConfig : & tlsConfig , AutoRoute : true , ConnNotify : handler . CloudhubHandler . OnRegister , ExOpts : api . QuicServerOption { MaxIncomingStreams : config . MaxIncomingStreams } , } klog . Info ( " " ) svc . ListenAndServeTLS ( " " , " " ) }
StartCloudHub starts the cloud hub service
StartCloudHub starts the cloud hub service
// init certificate