upload

package
v0.0.0-...-1d32ed5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package upload provides an HTTP client for uploading images to the relay's /internal/upload endpoint, authenticated with the daemon's machine token.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsImageFile

func IsImageFile(path string) bool

IsImageFile returns true if the file path has a recognised image extension.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client uploads images to the relay HTTP endpoint.

func NewClient

func NewClient(relayWSURL, machineID, authToken string) *Client

NewClient creates an upload client. relayWSURL is the daemon's configured WebSocket URL (e.g. "wss://relay.gsd.build/ws/daemon"); it is converted to an HTTPS base URL automatically.

func (*Client) SetAuthToken

func (c *Client) SetAuthToken(token string)

SetAuthToken updates the bearer token used for future upload requests.

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, filename string, data []byte) (string, error)

Upload sends the image data to the relay and returns the public URL.

Jump to

Keyboard shortcuts

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