downloader

package
v0.0.0-...-d8d03e6 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func DownloadFile

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

func FetchFile

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

func IsExist

func IsExist(path string) bool

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
				Url  string
			}
		}
		Name    *string
		Extract *struct {
			Exclude *[]string
		}
		Natives *map[string]string
		Rules   *[]struct {
			Action string
			Os     *struct {
				Name string
			}
		}
	} `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