downloader

package
v0.0.0-...-30d8e43 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OperatingSystem,
	MinecraftDir,
	VersionDir,
	LibrariesDir,
	NativesDir,
	LauncherDir,
	AssetsDir string
)

Functions

func CheckSum

func CheckSum(data []byte, sha1check string) bool

func CheckSumByPath

func CheckSumByPath(path, sha1check string) bool

func DownloadAndCheck

func DownloadAndCheck(out, url, sha1check string) error

func DownloadFile

func DownloadFile(url, output string) ([]byte, error)

func FetchFile

func FetchFile(url string) ([]byte, error)

func MakeAllDirs

func MakeAllDirs(dir *string) error

func SetUpVariables

func SetUpVariables(dir *string)

Types

type AssetIndex

type AssetIndex struct {
	Objects map[string]struct {
		Hash string
		Size uint
	}

	Virtual        bool `json:"virtual,omitempty"`
	MapToResources bool `json:"map_to_resources,omitempty"`
}
var Ai AssetIndex

type DownloadsEntry

type DownloadsEntry struct {
	Sha1 string
	Size uint
	Url  string
}

type LibraryDownloadEntry

type LibraryDownloadEntry struct {
	Path string
	Sha1 string
	Size uint
	Url  string
}

type VersionInfo

type VersionInfo struct {
	Id              string
	Type            string
	Url             string
	Time            string
	ReleaseTime     string
	Sha1            string
	ComplianceLevel uint
}

type VersionJSON

type VersionJSON struct {
	Arguments struct {
		Game []interface{}
		Jvm  []interface{}
	} `json:"arguments"`
	AssetIndex *struct {
		Id        string
		Sha1      string
		Size      uint
		TotalSize uint
		Url       string
	} `json:"assetIndex"`
	Assets          string `json:"assets"`
	ComplianceLevel uint   `json:"complianceLeveL"`
	Downloads       *struct {
		Client          DownloadsEntry
		Client_mappings DownloadsEntry
		Server          DownloadsEntry
		Server_mappings DownloadsEntry
	} `json:"downloads"`
	Id           string  `json:"id"`
	InheritsFrom *string `json:"inheritsFrom,omitempty"`
	JavaVersion  struct {
		Component    string
		MajorVersion uint
	} `json:"javaVersion"`
	Libraries []struct {
		Downloads *struct {
			Artifact    *LibraryDownloadEntry
			Classifiers *map[string]struct {
				Path string `json:"path"`
				Size uint   `json:"size"`
				Sha1 string `json:"sha1"`
				Url  string `json:"url"`
			}
		} `json:"downloads"`
		Name    *string `json:"name"`
		Extract *struct {
			Exclude *[]string
		} `json:"extract"`
		Natives *map[string]string `json:"natives"`
		Rules   *[]struct {
			Action string
			Os     *struct {
				Name string
			}
		} `json:"rules"`
	} `json:"libraries"`
	Logging struct {
		Client struct {
			Argument string
			File     struct {
				Id   string
				Sha1 string
				Size uint
				Url  string
			}
			Type string
		}
	} `json:"logging"`
	MainClass              string      `json:"mainClass"`
	MinecraftArguments     *string     `json:"minecraftArguments,omitempty"`
	MinimumLauncherVersion interface{} `json:"minimumLauncherVersion"`
	ReleaseTime            string      `json:"releaseTime"`
	Time                   string      `json:"time"`
	Type                   string      `json:"type"`
}

func NewClientJSON

func NewClientJSON(vm VersionManifest, version string) (*VersionJSON, error)

func (VersionJSON) FetchLibraries

func (v VersionJSON) FetchLibraries(log chan string) error

func (VersionJSON) GetAssets

func (v VersionJSON) GetAssets(log chan string) error

type VersionManifest

type VersionManifest struct {
	Latest struct {
		Release  string
		Snapshot string
	}
	Versions []VersionInfo
}

func GetVersionManifest

func GetVersionManifest() (*VersionManifest, error)

Jump to

Keyboard shortcuts

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