Exemple #1
0
func GetPortForwardEndpoint() *url.URL {
	ep := endpoint
	if ep == "" {
		ep = defaultEndpoint
	}
	u, _ := url.Parse(ep)
	return u
}
Exemple #2
0
func New(vulcanURL string, reg *plugin.Registry, ctx context.Context) (*vulcan, error) {
	if _, er := url.Parse(vulcanURL); er != nil {
		return nil, er
	}

	if reg == nil {
		reg = registry.GetRegistry()
	}
	client := api.NewClient(vulcanURL, reg)
	if client == nil {
		return nil, errors.New("Failed to create vulcand client")
	}
	return &vulcan{Client: *client, c: ctx}, nil
}
Exemple #3
0
func TestRequestPort(t *testing.T) {
	is := assert.New(t)
	route := "/port/forward"
	server := testServer("/port/forward", `{"port":1234}`)
	defer server.Close()

	u, er := url.Parse(fmt.Sprintf("%s%s", server.URL, route))
	if !is.NoError(er) {
		t.Log(er.Error())
		t.FailNow()
	}
	endpoint = u.String()

	port, er := RequestPort("1.2.3.4", "user", "pass", uuid.NewV4().String())
	is.NoError(er)
	is.Equal(1234, port)
}