wsproxysdk

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	SDKClient *codersdk.Client
	// contains filtered or unexported fields
}

Client is a HTTP client for a subset of Coder API routes that external proxies need.

func New

func New(serverURL *url.URL) *Client

New creates a external proxy client for the provided primary coder server URL.

func (*Client) DialWorkspaceAgent

func (c *Client) DialWorkspaceAgent(ctx context.Context, agentID uuid.UUID, options *codersdk.DialWorkspaceAgentOptions) (agentConn *codersdk.WorkspaceAgentConn, err error)

DialWorkspaceAgent calls the underlying codersdk.Client's DialWorkspaceAgent method.

func (*Client) IssueSignedAppToken

IssueSignedAppToken issues a new signed app token for the provided app request. The error page will be returned as JSON. For use in external proxies, use IssueSignedAppTokenHTML instead.

func (*Client) IssueSignedAppTokenHTML

IssueSignedAppTokenHTML issues a new signed app token for the provided app request. The error page will be returned as HTML in most cases, and will be written directly to the provided http.ResponseWriter.

func (*Client) Request

func (c *Client) Request(ctx context.Context, method, path string, body interface{}, opts ...codersdk.RequestOption) (*http.Response, error)

Request wraps the underlying codersdk.Client's Request method.

func (*Client) RequestIgnoreRedirects

func (c *Client) RequestIgnoreRedirects(ctx context.Context, method, path string, body interface{}, opts ...codersdk.RequestOption) (*http.Response, error)

RequestIgnoreRedirects wraps the underlying codersdk.Client's Request method on the client that ignores redirects.

func (*Client) SessionToken

func (c *Client) SessionToken() string

SessionToken returns the currently set token for the client.

func (*Client) SetSessionToken

func (c *Client) SetSessionToken(token string) error

SetSessionToken sets the session token for the client. An error is returned if the session token is not in the correct format for external proxies.

type IssueSignedAppTokenResponse

type IssueSignedAppTokenResponse struct {
	// SignedTokenStr should be set as a cookie on the response.
	SignedTokenStr string `json:"signed_token_str"`
}

type RegisterWorkspaceProxyRequest

type RegisterWorkspaceProxyRequest struct {
	// AccessURL that hits the workspace proxy api.
	AccessURL string `json:"access_url"`
	// WildcardHostname that the workspace proxy api is serving for subdomain apps.
	WildcardHostname string `json:"wildcard_hostname"`
}

type RegisterWorkspaceProxyResponse

type RegisterWorkspaceProxyResponse struct {
	AppSecurityKey string `json:"app_security_key"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL