Documentation
¶
Index ¶
- Variables
- func EvaluateRules(rules []Rule, profile *Profile) bool
- func OsVersion() (string, error)
- type Argument
- type Artifact
- type Asset
- type AssetIndex
- type AssetIndexContents
- type AuthData
- type AuthProvider
- type Lib
- type LibClassifiers
- type LogCfg
- type MojangAuth
- type Profile
- type Root
- func (r *Root) AssetsDir() string
- func (r *Root) GetVersion(id string) (*Version, error)
- func (r *Root) LibrariesDir() string
- func (r *Root) RemoteVersions() (*VersionManifest, error)
- func (r *Root) RunVersion(ver *Version, prof *Profile, logRedirect io.Writer) error
- func (r *Root) UpdateVersion(ver *Version) error
- func (r *Root) Versions() (map[string]VersionMeta, error)
- func (r *Root) VersionsDir() string
- type Rule
- type RuleAct
- type Version
- func (v *Version) BuildClassPath(versionDir, libsDir string) (string, error)
- func (v *Version) BuildCommandLine(prof Profile, authData AuthData, ...) (bin string, args []string, err error)
- func (v *Version) DownloadAssets(assetsDir string) error
- func (v *Version) DownloadAssetsIndex(assetsDir string) error
- func (v *Version) DownloadClient(versionsDir string) error
- func (v *Version) DownloadLibraries(libDir string) error
- func (v *Version) ExtractNatives(libDir, nativeDir string) error
- type VersionManifest
- type VersionMeta
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrIncompatibleFormat = errors.New("ReadVersionJSON: JSON format version is higher than supported by library")
View Source
var ErrInvalidFormat = errors.New("ReadVersionJSON: passed JSON object doesn't matches expected schema")
Functions ¶
func EvaluateRules ¶
Types ¶
type Artifact ¶
type AssetIndex ¶
type AssetIndexContents ¶
type AuthProvider ¶
type AuthProvider interface {
// Login initiates new session using specified credentials.
Login(user, pass string) (AuthData, error)
// Refresh updates login information in passed structure to keep user logged in.
// Old information is no longer usable.
Refresh(ad *AuthData) error
// Validate checks whether information in AuthData structure is still usable.
Validate(ad AuthData) (bool, error)
// Invalidate terminates session.
Invalidate(ad AuthData)
}
type Lib ¶
type Lib struct {
Downloads struct {
MainJar *Artifact `json:"artifact"`
LibClassifiers `json:"classifiers"`
} `json:"downloads"`
NativeSuffixes struct {
Linux string `json:"linux"`
MacOS string `json:"osx"`
Windows string `json:"windows"`
} `json:"natives"`
Name string `json:"name"`
Rules []Rule `json:"rules"`
ExtractRules struct {
Exclude []string `json:"exclude"`
} `json:"extract"`
}
func (*Lib) ExtractNative ¶
func (*Lib) NativeSavePath ¶
NativeSavePath returns FS path where library's "native" component should be stored when downloaded (path is relative to libraries directory root).
If library have no native component - empty string is returned.
type LibClassifiers ¶
type MojangAuth ¶
type MojangAuth struct {
// ClientID must be set to persistent value unique for this client.
// Changing ClientID will make all old sessions unusable.
ClientID string
// URL that will be prepended ot each API endpoint path.
// Defaults to https://authserver.mojang.com.
AuthURL string
}
MojangAuth implements AuthProvider using "Yggdrasil" authentication scheme.
func (MojangAuth) Invalidate ¶
func (ma MojangAuth) Invalidate(ad AuthData) error
func (MojangAuth) Refresh ¶
func (ma MojangAuth) Refresh(ad *AuthData) error
type Root ¶
type Root struct {
LauncherDir string
AuthData AuthData
LatestRelease string
LatestSnapshot string
// contains filtered or unexported fields
}
func (*Root) LibrariesDir ¶
func (*Root) RemoteVersions ¶
func (r *Root) RemoteVersions() (*VersionManifest, error)
func (*Root) RunVersion ¶
func (*Root) UpdateVersion ¶
func (*Root) VersionsDir ¶
type Rule ¶
type Rule struct {
Action RuleAct `json:"action" mapstructure:"action"`
// OS information. All fields are regexes.
OS struct {
Name string `json:"name" mapstructure:"name"`
Version string `json:"version" mapstructure:"version"`
Arch string `json:"arch" mapstructure:"arch"`
} `json:"os" mapstructure:"os"`
Features struct {
IsDemoUser *bool `json:"is_demo_user" mapstructure:"is_demo_user"`
HasCustomResolution *bool `json:"has_custom_resolution" mapstructure:"has_custom_resolution"`
} `json:"features" mapstructure:"features"`
}
type Version ¶
type Version struct {
AssetIndex AssetIndex `json:"assetIndex"`
Downloads struct {
Client Artifact `json:"client"`
Server Artifact `json:"server"`
} `json:"downloads"`
ID string `json:"id"`
Libraries []Lib `json:"libraries"`
//ClientLog LogCfg
MainClass string `json:"mainClass"`
GameArgs []Argument
JVMArgs []Argument
Type string `json:"type"`
}
func ReadVersionJSON ¶
func (*Version) BuildClassPath ¶
func (*Version) BuildCommandLine ¶
func (*Version) DownloadAssets ¶
func (*Version) DownloadAssetsIndex ¶
func (*Version) DownloadClient ¶
func (*Version) DownloadLibraries ¶
func (*Version) ExtractNatives ¶
type VersionManifest ¶
type VersionManifest struct {
Latest struct {
Release string `json:"release"`
Snapshot string `json:"snapshot"`
} `json:"latest"`
Versions []VersionMeta `json:"versions"`
}
Click to show internal directories.
Click to hide internal directories.