Exemple #1
0
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)
}
Exemple #2
0
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)
}
Exemple #3
0
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)
}