protocol

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: 0BSD Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BundleDownloadRequest added in v0.3.2

type BundleDownloadRequest struct {
	Request
	ID string `cbor:"6,keyasint,omitempty"`
}

type BundleDownloadResponse added in v0.3.2

type BundleDownloadResponse struct {
	Response
	Bundle []byte `cbor:"5,keyasint,omitempty"`
}

type BundleSuggestRequest

type BundleSuggestRequest struct {
	Request
	ID Hash `cbor:"6,keyasint,omitempty"`
}

type BundleSuggestResponse

type BundleSuggestResponse struct {
	Response
	Present bool   `cbor:"5,keyasint,omitempty"`
	Missing []Hash `cbor:"6,keyasint,omitempty"`
}

type BundleUploadRequest

type BundleUploadRequest struct {
	Request
	Bundle []byte `cbor:"6,keyasint,omitempty"`
}

type BundleUploadResponse

type BundleUploadResponse struct {
	Response
	ID      Hash   `cbor:"5,keyasint,omitempty"`
	Missing []Hash `cbor:"6,keyasint,omitempty"`
}

type ChunkUploadResult added in v0.5.0

type ChunkUploadResult struct {
	Index    int
	Response *MissingUploadResponse
	Err      error
}

ChunkUploadResult holds the result of a single chunk upload

type DiscoveryInfo added in v0.5.0

type DiscoveryInfo struct {
	Protocols           []string `json:"protocols"`
	URL                 string   `json:"url"`
	APIKeyManagementURL string   `json:"apiKeyManagementUrl"`
}

DiscoveryInfo holds the response from /.well-known/web-publication-protocol

func Discover added in v0.5.0

func Discover() (*DiscoveryInfo, error)

Discover fetches the xmit discovery info from XMIT_URL (default: https://xmit.co)

type FinalizeUploadRequest

type FinalizeUploadRequest struct {
	Request
	ID Hash `cbor:"6,keyasint,omitempty"`
}

type FinalizeUploadResponse

type FinalizeUploadResponse struct {
	Response
}

type Hash

type Hash [32]byte

type ListTeamsRequest added in v0.3.6

type ListTeamsRequest struct {
	Request
}

type ListTeamsResponse added in v0.3.6

type ListTeamsResponse struct {
	Response
	Teams         []Team `cbor:"5,keyasint,omitempty"`
	ManagementURL string `cbor:"6,keyasint,omitempty"`
}

type MissingUploadRequest

type MissingUploadRequest struct {
	Request
	ID    Hash     `cbor:"6,keyasint,omitempty"`
	Parts [][]byte `cbor:"7,keyasint,omitempty"`
}

type MissingUploadResponse

type MissingUploadResponse struct {
	Response
}

type Node

type Node struct {
	Children map[string]*Node `cbor:"1,keyasint,omitempty"`
	Hash     *Hash            `cbor:"2,keyasint,omitempty"`
}

type ParallelDownloader added in v0.5.0

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

ParallelDownloader manages parallel downloads across multiple IPs

func NewParallelDownloader added in v0.5.0

func NewParallelDownloader(baseURL string, concurrency int) (*ParallelDownloader, error)

NewParallelDownloader creates a downloader that spreads requests across IPs

func (*ParallelDownloader) DownloadBundle added in v0.5.0

func (p *ParallelDownloader) DownloadBundle(key, domain, id string) (*BundleDownloadResponse, error)

DownloadBundle downloads a bundle using a round-robin client

func (*ParallelDownloader) DownloadParts added in v0.5.0

func (p *ParallelDownloader) DownloadParts(key, domain string, hashes []Hash) (*PartsDownloadResponse, error)

DownloadParts downloads parts using a round-robin client selection

type ParallelUploader added in v0.5.0

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

ParallelUploader manages parallel chunk uploads across multiple IPs

func NewParallelUploader added in v0.5.0

func NewParallelUploader(baseURL string, concurrency int) (*ParallelUploader, error)

NewParallelUploader creates an uploader that spreads requests across IPs

func (*ParallelUploader) EncMode added in v0.5.0

func (p *ParallelUploader) EncMode() cbor.EncMode

EncMode returns the CBOR encoding mode

func (*ParallelUploader) Finalize added in v0.5.0

func (p *ParallelUploader) Finalize(key, domain string, id Hash) (*FinalizeUploadResponse, error)

Finalize finalizes the upload using a round-robin client

func (*ParallelUploader) SuggestBundle added in v0.5.0

func (p *ParallelUploader) SuggestBundle(key, domain string, id Hash) (*BundleSuggestResponse, error)

SuggestBundle suggests a bundle using a round-robin client

func (*ParallelUploader) UploadBundle added in v0.5.0

func (p *ParallelUploader) UploadBundle(key, domain string, bundle []byte) (*BundleUploadResponse, error)

UploadBundle uploads the bundle using a round-robin client

func (*ParallelUploader) UploadChunksParallel added in v0.5.0

func (p *ParallelUploader) UploadChunksParallel(key, domain string, chunks [][][]byte) []ChunkUploadResult

UploadChunksParallel uploads all chunks in parallel (max concurrency), starting in order

type PartsDownloadRequest added in v0.3.2

type PartsDownloadRequest struct {
	Request
	Hashes []Hash `cbor:"6,keyasint,omitempty"`
}

type PartsDownloadResponse added in v0.3.2

type PartsDownloadResponse struct {
	Response
	Parts [][]byte `cbor:"5,keyasint,omitempty"`
}

type Request

type Request struct {
	Key    string `cbor:"1,keyasint"`
	Team   string `cbor:"2,keyasint,omitempty"`
	Domain string `cbor:"5,keyasint,omitempty"`
}

type RequestKeyRequest added in v0.3.8

type RequestKeyRequest struct {
	Name string `cbor:"1,keyasint,omitempty"`
}

type RequestKeyResponse added in v0.3.8

type RequestKeyResponse struct {
	Response
	BrowserURL string `cbor:"5,keyasint,omitempty"`
	PollURL    string `cbor:"6,keyasint,omitempty"`
	Secret     string `cbor:"7,keyasint,omitempty"`
	RequestID  string `cbor:"8,keyasint,omitempty"`
}

type Response

type Response struct {
	Success  bool     `cbor:"1,keyasint"`
	Errors   []string `cbor:"2,keyasint,omitempty"`
	Warnings []string `cbor:"3,keyasint,omitempty"`
	Messages []string `cbor:"4,keyasint,omitempty"`
}

type Team added in v0.3.6

type Team struct {
	ID   string `cbor:"1,keyasint,omitempty"`
	Name string `cbor:"2,keyasint,omitempty"`
}

Jump to

Keyboard shortcuts

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