version

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// DefaultURL defines the default Minecraft version URL.
	DefaultURL = "https://launchermeta.mojang.com/mc/game/version_manifest.json"
)

Variables

View Source
var (
	// OldestMinecraft defines the oldest allowed Minecraft version.
	OldestMinecraft = "1.6.4"
)

Functions

This section is empty.

Types

type ByVersion added in v0.2.0

type ByVersion Versions

ByVersion sorts a list of Minecraft versions by ID.

func (ByVersion) Len added in v0.2.0

func (b ByVersion) Len() int

Len is part of the sorting algorithm.

func (ByVersion) Less added in v0.2.0

func (b ByVersion) Less(i, j int) bool

Less is part of the sorting algorithm.

func (ByVersion) Sort added in v0.2.0

func (b ByVersion) Sort()

Sort simply sorts the versions list.

func (ByVersion) Swap added in v0.2.0

func (b ByVersion) Swap(i, j int)

Swap is part of the sorting algorithm.

type Filter

type Filter struct {
	Version string
}

Filter defines filter attributes for Versions.

type Response

type Response struct {
	Releases  Versions `json:"releases"`
	Snapshots Versions `json:"snapshots"`
}

Response is the standard root element for the version list.

func FromDefault

func FromDefault() (Response, error)

FromDefault is a simply wrapper that loads the default URL.

func FromPath

func FromPath(path string) (Response, error)

FromPath parses a version definition from file path.

func FromString

func FromString(content []byte) (Response, error)

FromString parses a version definition from string.

func FromURL

func FromURL(path string) (Response, error)

FromURL parses a version definition from URL.

func (*Response) UnmarshalJSON

func (r *Response) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the custom JSON unmarshaler.

type Version

type Version struct {
	ID      string    `json:"id"`
	URL     string    `json:"url"`
	Latest  bool      `json:"latest"`
	Release time.Time `json:"release"`
}

Version defines the standard version format.

type Versions

type Versions []Version

Versions is simply a collection of Version.

func (Versions) Filter

func (v Versions) Filter(filter *Filter) Versions

Filter reduces the list of Versions by given criteria.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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