コード例 #1
0
ファイル: migrate.go プロジェクト: jameinel/lxd
func (c *migrationSink) connectWithSecret(secret string) (*websocket.Conn, error) {
	query := url.Values{"secret": []string{secret}}

	// The URL is a https URL to the operation, mangle to be a wss URL to the secret
	wsUrl := fmt.Sprintf("wss://%s/websocket?%s", strings.TrimPrefix(c.url, "https://"), query.Encode())

	return lxd.WebsocketDial(c.dialer, wsUrl)
}
コード例 #2
0
ファイル: migrate.go プロジェクト: jumpstarter-io/lxd
func (c *migrationSink) connectWithSecret(secret string) (*websocket.Conn, error) {
	query := url.Values{"secret": []string{secret}}

	// TODO: we shouldn't assume this is a HTTP URL
	url := c.url + "?" + query.Encode()

	return lxd.WebsocketDial(c.dialer, url)
}
コード例 #3
0
ファイル: migrate.go プロジェクト: czl349095941/lxd
func (c *migrationSink) connectWithSecret(secret string) (*websocket.Conn, error) {
	query := url.Values{"secret": []string{secret}}

	// The URL is a https URL to the operation, mangle to be a wss URL to the secret
	url := c.url
	if strings.HasPrefix(url, "https://") {
		url = fmt.Sprintf("wss://%s", strings.TrimPrefix(url, "https://"))
	}

	// FIXME: This is a backward compatibility codepath
	if !strings.HasSuffix(url, "/websocket") {
		url = fmt.Sprintf("%s/websocket", url)
	}

	// Append the secret suffix
	url = fmt.Sprintf("%s?%s", url, query.Encode())

	return lxd.WebsocketDial(c.dialer, url)
}