Documentation
¶
Index ¶
- Constants
- Variables
- func GetInstallerNames() (installers []string)
- func SetLogger(newLoger logger.Logger)
- type AssetIndex
- type AssetNotFoundErr
- type ContentLengthNotMatchErr
- type DlCallback
- type DownloadInfo
- type FabricInstaller
- func (r *FabricInstaller) GetInstallers() (res []FabricInstallerVersion, err error)
- func (r *FabricInstaller) Install(path, name string, target string) (installed string, err error)
- func (r *FabricInstaller) InstallWithLoader(path, name string, target string, loader string) (installed string, err error)
- func (r *FabricInstaller) ListVersions(snapshot bool) (versions []string, err error)
- type FabricInstallerVersion
- type ForgeInstaller
- func (r *ForgeInstaller) GetInstallerVersions() (data MavenMetadata, err error)
- func (r *ForgeInstaller) GetLatestInstaller(target string) (version string, err error)
- func (r *ForgeInstaller) Install(path, name string, target string) (installed string, err error)
- func (r *ForgeInstaller) InstallWithLoader(path, name string, target string, loader string) (installed string, err error)
- func (r *ForgeInstaller) ListVersions(snapshot bool) (versions []string, err error)
- type HTTPClient
- func (c *HTTPClient) Do(req *http.Request) (res *http.Response, err error)
- func (c *HTTPClient) Download(url string, path string, mode os.FileMode, hashes StringMap, size int64, ...) (err error)
- func (c *HTTPClient) DownloadTmp(url string, pattern string, mode os.FileMode, hashes StringMap, size int64, ...) (path string, err error)
- func (c *HTTPClient) Get(url string) (res *http.Response, err error)
- func (c *HTTPClient) GetJson(url string, obj any) (err error)
- func (c *HTTPClient) GetXml(url string, obj any) (err error)
- func (c *HTTPClient) Head(url string) (res *http.Response, err error)
- func (c *HTTPClient) NewRequest(method string, url string, body io.Reader) (req *http.Request, err error)
- func (c *HTTPClient) Post(url string, contentType string, body io.Reader) (res *http.Response, err error)
- func (c *HTTPClient) PostForm(url string, form url.Values) (res *http.Response, err error)
- type HashErr
- type HttpStatusError
- type Installer
- type JavaVersion
- type LibraryDownloadInfo
- type LibraryDownloads
- type LibraryInfo
- type LibraryRule
- type MavenMetadata
- type MavenMetadataVersioning
- type Mrpack
- func (p *Mrpack) Close() (err error)
- func (p *Mrpack) InstallClient(target string) (err error)
- func (p *Mrpack) InstallClientWithOptional(target string, optionalChecker MrpackOptionalChecker) (err error)
- func (p *Mrpack) InstallServer(target string) (err error)
- func (p *Mrpack) InstallServerWithOptional(target string, optionalChecker MrpackOptionalChecker) (err error)
- func (p *Mrpack) OverrideClient(target string) (err error)
- func (p *Mrpack) OverrideServer(target string) (err error)
- type MrpackFileMeta
- type MrpackMeta
- type MrpackOptionalChecker
- type MrpackVerisonErr
- type NotLocalPathErr
- type QuiltInstaller
- func (r *QuiltInstaller) GetInstallerVersions() (data MavenMetadata, err error)
- func (r *QuiltInstaller) GetLatestInstaller() (version string, err error)
- func (r *QuiltInstaller) Install(path, name string, target string) (installed string, err error)
- func (r *QuiltInstaller) InstallWithLoader(path, name string, target string, loader string) (installed string, err error)
- func (r *QuiltInstaller) ListVersions(snapshot bool) (versions []string, err error)
- type SpigotInstaller
- type StringMap
- type UnsupportGameErr
- type VanillaInstaller
- func (r *VanillaInstaller) GetVersion(url string) (res VanillaVersion, err error)
- func (r *VanillaInstaller) GetVersions() (res VanillaVersions, err error)
- func (r *VanillaInstaller) Install(path, name string, target string) (installed string, err error)
- func (r *VanillaInstaller) ListVersions(snapshot bool) (versions []string, err error)
- type VanillaLatestInfo
- type VanillaVersion
- type VanillaVersionInfo
- type VanillaVersions
- type Version
- type VersionNotFoundErr
Constants ¶
View Source
const ( MrpackEnvRequired = "required" MrpackEnvOptional = "optional" MrpackEnvUnsupported = "unsupported" )
View Source
const SpigotBuildToolsURI = "https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar"
Variables ¶
View Source
var DefaultFabricInstaller = &FabricInstaller{
MetaUrl: "https://meta.fabricmc.net",
}
View Source
var DefaultForgeInstaller = &ForgeInstaller{
MavenUrl: "https://maven.minecraftforge.net",
}
View Source
var DefaultHTTPClient = &HTTPClient{ Client: http.Client{ Timeout: time.Second * 10, }, UserAgent: "github.com/kmcsr/server-installer/" + PkgVersion, }
View Source
var DefaultQuiltInstaller = &QuiltInstaller{
MavenUrl: "https://maven.quiltmc.org/repository/release",
}
View Source
var EmptyLinkArrayErr = errors.New("Link array is empty")
View Source
var Installers = make(map[string]Installer, 10)
View Source
var PkgVersion = "dev"
View Source
var TargetAlreadyExistErr = errors.New("Target file already exists, please clean the install directory and retry")
View Source
var VanillaIns = &VanillaInstaller{
ManifestUrl: "https://launchermeta.mojang.com/mc/game/version_manifest.json",
}
Functions ¶
func GetInstallerNames ¶
func GetInstallerNames() (installers []string)
Types ¶
type AssetIndex ¶
type AssetIndex struct {
DownloadInfo
Id string `json:"id"`
TotalSize int64 `json:"totalSize"`
}
type AssetNotFoundErr ¶
func (*AssetNotFoundErr) Error ¶
func (e *AssetNotFoundErr) Error() string
type ContentLengthNotMatchErr ¶ added in v1.2.0
func (*ContentLengthNotMatchErr) Error ¶ added in v1.2.0
func (e *ContentLengthNotMatchErr) Error() string
type DlCallback ¶ added in v1.2.0
type DownloadInfo ¶
type FabricInstaller ¶
type FabricInstaller struct {
MetaUrl string // Default is "https://meta.fabricmc.net"
}
func (*FabricInstaller) GetInstallers ¶
func (r *FabricInstaller) GetInstallers() (res []FabricInstallerVersion, err error)
func (*FabricInstaller) Install ¶
func (r *FabricInstaller) Install(path, name string, target string) (installed string, err error)
func (*FabricInstaller) InstallWithLoader ¶ added in v1.2.0
func (*FabricInstaller) ListVersions ¶ added in v1.2.3
func (r *FabricInstaller) ListVersions(snapshot bool) (versions []string, err error)
type FabricInstallerVersion ¶
type ForgeInstaller ¶
type ForgeInstaller struct {
MavenUrl string // Default is "https://maven.minecraftforge.net"
}
func (*ForgeInstaller) GetInstallerVersions ¶
func (r *ForgeInstaller) GetInstallerVersions() (data MavenMetadata, err error)
func (*ForgeInstaller) GetLatestInstaller ¶
func (r *ForgeInstaller) GetLatestInstaller(target string) (version string, err error)
func (*ForgeInstaller) Install ¶
func (r *ForgeInstaller) Install(path, name string, target string) (installed string, err error)
func (*ForgeInstaller) InstallWithLoader ¶ added in v1.2.0
func (*ForgeInstaller) ListVersions ¶ added in v1.2.3
func (r *ForgeInstaller) ListVersions(snapshot bool) (versions []string, err error)
type HTTPClient ¶ added in v1.2.0
func (*HTTPClient) Download ¶ added in v1.2.0
func (c *HTTPClient) Download(url string, path string, mode os.FileMode, hashes StringMap, size int64, cb DlCallback) (err error)
func (*HTTPClient) DownloadTmp ¶ added in v1.2.0
func (c *HTTPClient) DownloadTmp(url string, pattern string, mode os.FileMode, hashes StringMap, size int64, cb DlCallback) (path string, err error)
func (*HTTPClient) Get ¶ added in v1.2.0
func (c *HTTPClient) Get(url string) (res *http.Response, err error)
func (*HTTPClient) GetJson ¶ added in v1.2.0
func (c *HTTPClient) GetJson(url string, obj any) (err error)
func (*HTTPClient) GetXml ¶ added in v1.2.0
func (c *HTTPClient) GetXml(url string, obj any) (err error)
func (*HTTPClient) Head ¶ added in v1.2.0
func (c *HTTPClient) Head(url string) (res *http.Response, err error)
func (*HTTPClient) NewRequest ¶ added in v1.2.0
type HttpStatusError ¶ added in v1.2.0
type HttpStatusError struct {
Code int
}
func (*HttpStatusError) Error ¶ added in v1.2.0
func (e *HttpStatusError) Error() string
type Installer ¶
type JavaVersion ¶
type LibraryDownloadInfo ¶
type LibraryDownloadInfo struct {
DownloadInfo
Path string `json:"path"`
}
type LibraryDownloads ¶
type LibraryDownloads struct {
Artifact *LibraryDownloadInfo `json:"artifact,omitempty"`
Classifiers map[string]LibraryDownloadInfo `json:"classifiers,omitempty"`
}
type LibraryInfo ¶
type LibraryInfo struct {
Name string `json:"name"`
Downloads LibraryDownloads `json:"downloads"`
Rules []LibraryRule `json:"rules,omitempty"`
Extract map[string]any `json:"extract,omitempty"`
Natives map[string]string `json:"natives,omitempty"`
}
type LibraryRule ¶
type MavenMetadata ¶
type MavenMetadata struct {
GroupId string `xml:"groupId"`
ArtifactId string `xml:"artifactId"`
Versioning MavenMetadataVersioning `xml:"versioning"`
}
func DecodeMavenMetadata ¶
func DecodeMavenMetadata(body []byte) (data MavenMetadata, err error)
func GetMavenMetadata ¶
func GetMavenMetadata(link string) (data MavenMetadata, err error)
type MavenMetadataVersioning ¶
type Mrpack ¶ added in v1.2.0
type Mrpack struct {
MrpackMeta
// contains filtered or unexported fields
}
func OpenMrpack ¶ added in v1.2.0
func (*Mrpack) InstallClient ¶ added in v1.2.0
func (*Mrpack) InstallClientWithOptional ¶ added in v1.2.0
func (p *Mrpack) InstallClientWithOptional(target string, optionalChecker MrpackOptionalChecker) (err error)
func (*Mrpack) InstallServer ¶ added in v1.2.0
func (*Mrpack) InstallServerWithOptional ¶ added in v1.2.0
func (p *Mrpack) InstallServerWithOptional(target string, optionalChecker MrpackOptionalChecker) (err error)
func (*Mrpack) OverrideClient ¶ added in v1.2.0
func (*Mrpack) OverrideServer ¶ added in v1.2.0
type MrpackFileMeta ¶ added in v1.2.0
type MrpackMeta ¶ added in v1.2.0
type MrpackOptionalChecker ¶ added in v1.2.0
type MrpackOptionalChecker func(f MrpackFileMeta) bool
type MrpackVerisonErr ¶ added in v1.2.0
func (*MrpackVerisonErr) Error ¶ added in v1.2.0
func (e *MrpackVerisonErr) Error() string
type NotLocalPathErr ¶ added in v1.2.0
type NotLocalPathErr struct {
Path string
}
func (*NotLocalPathErr) Error ¶ added in v1.2.0
func (e *NotLocalPathErr) Error() string
type QuiltInstaller ¶ added in v1.2.0
type QuiltInstaller struct {
MavenUrl string
}
func (*QuiltInstaller) GetInstallerVersions ¶ added in v1.2.1
func (r *QuiltInstaller) GetInstallerVersions() (data MavenMetadata, err error)
func (*QuiltInstaller) GetLatestInstaller ¶ added in v1.2.1
func (r *QuiltInstaller) GetLatestInstaller() (version string, err error)
func (*QuiltInstaller) Install ¶ added in v1.2.1
func (r *QuiltInstaller) Install(path, name string, target string) (installed string, err error)
func (*QuiltInstaller) InstallWithLoader ¶ added in v1.2.1
func (*QuiltInstaller) ListVersions ¶ added in v1.2.3
func (r *QuiltInstaller) ListVersions(snapshot bool) (versions []string, err error)
type SpigotInstaller ¶
type SpigotInstaller struct {
}
func (*SpigotInstaller) Install ¶
func (*SpigotInstaller) Install(path, name string, target string) (installed string, err error)
func (*SpigotInstaller) ListVersions ¶ added in v1.2.3
func (r *SpigotInstaller) ListVersions(snapshot bool) (versions []string, err error)
type UnsupportGameErr ¶ added in v1.2.0
type UnsupportGameErr struct {
Game string
}
func (*UnsupportGameErr) Error ¶ added in v1.2.0
func (e *UnsupportGameErr) Error() string
type VanillaInstaller ¶
type VanillaInstaller struct {
ManifestUrl string // Default is "https://launchermeta.mojang.com/mc/game/version_manifest.json"
}
func (*VanillaInstaller) GetVersion ¶
func (r *VanillaInstaller) GetVersion(url string) (res VanillaVersion, err error)
func (*VanillaInstaller) GetVersions ¶
func (r *VanillaInstaller) GetVersions() (res VanillaVersions, err error)
func (*VanillaInstaller) Install ¶
func (r *VanillaInstaller) Install(path, name string, target string) (installed string, err error)
func (*VanillaInstaller) ListVersions ¶ added in v1.2.3
func (r *VanillaInstaller) ListVersions(snapshot bool) (versions []string, err error)
type VanillaLatestInfo ¶
type VanillaVersion ¶
type VanillaVersion struct {
Id string `json:"id"`
AssetIndex AssetIndex `json:"assetIndex"`
Assets string `json:"assets"`
ComplianceLevel int `json:"complianceLevel"`
Downloads map[string]DownloadInfo `json:"downloads"`
JavaVersion JavaVersion `json:"javaVersion"`
Libraries []LibraryInfo `json:"libraries"`
Logging map[string]any `json:"logging"` // TODO
MainClass string `json:"mainClass"`
MinecraftArguments string `json:"minecraftArguments"`
MinimumLauncherVersion int `json:"minimumLauncherVersion"`
ReleaseTime time.Time `json:"releaseTime"`
Time time.Time `json:"time"`
Type string `json:"type"`
}
type VanillaVersionInfo ¶
type VanillaVersions ¶
type VanillaVersions struct {
Latest VanillaLatestInfo `json:"latest"`
Versions []VanillaVersionInfo `json:"versions"`
}
type Version ¶
func VersionFromString ¶
type VersionNotFoundErr ¶
type VersionNotFoundErr struct {
Version string
}
func (*VersionNotFoundErr) Error ¶
func (e *VersionNotFoundErr) Error() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.