mirror

package
v0.6.19 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidURL          = errors.New("invalid URL")
	ErrMissingMirrors      = errors.New("no mirrors provided")
	ErrNotFound            = errors.New("no mirror found")
	ErrUnsupportedArtifact = errors.New("unsupported artifact")
)

Functions

This section is empty.

Types

type GitHub

type GitHub[T artifact.Artifact] struct{}

A mirror implementation for fetching artifacts via releases on the Godot GitHub repository.

func (GitHub[T]) Hosts added in v0.6.0

func (m GitHub[T]) Hosts() []string

Hosts returns the host URLs at which artifacts are hosted.

func (GitHub[T]) Name added in v0.6.0

func (m GitHub[T]) Name() string

Name returns the display name of the mirror.

func (GitHub[T]) Remote added in v0.6.0

func (m GitHub[T]) Remote(a T) (artifact.Remote[T], error)

Remote returns an 'artifact.Remote' wrapper around a specified artifact. The remote wrapper contains the URL at which the artifact can be downloaded.

type Hoster added in v0.6.0

type Hoster interface {
	// Hosts returns a slice of URL hosts at which the mirror hosts artifacts.
	Hosts() []string
}

Hoster is a mirror which describes the host URLs at which it hosts content. This can be used to restrict redirects when downloading artifacts, improving security.

type Mirror

type Mirror[T artifact.Artifact] interface {
	Hoster
	Remoter[T]

	Name() string
}

Mirror specifies a host of Godot release artifacts.

func Select

func Select[T artifact.Artifact](
	ctx context.Context,
	mirrors []Mirror[T],
	a T,
) (Mirror[T], error)

Select chooses the best 'Mirror' of those provided for downloading the specified Godot release artifact.

type Remoter added in v0.6.0

type Remoter[T artifact.Artifact] interface {
	Remote(a T) (artifact.Remote[T], error)
}

Remoter is a type that can resolve the URL at which a specified artifact is hosted. Provided artifacts must be versioned.

type TuxFamily

type TuxFamily[T artifact.Artifact] struct{}

A mirror implementation for fetching artifacts via the Godot TuxFamily host.

func (TuxFamily[T]) Hosts added in v0.6.0

func (m TuxFamily[T]) Hosts() []string

Hosts returns the host URLs at which artifacts are hosted.

func (TuxFamily[T]) Name added in v0.6.0

func (m TuxFamily[T]) Name() string

Name returns the display name of the mirror.

func (TuxFamily[T]) Remote added in v0.6.0

func (m TuxFamily[T]) Remote(a T) (artifact.Remote[T], error)

Remote returns an 'artifact.Remote' wrapper around a specified artifact. The remote wrapper contains the URL at which the artifact can be downloaded.

Jump to

Keyboard shortcuts

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