modules

package
v0.0.0-...-d3cc92b Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 26 Imported by: 1

Documentation

Index

Constants

View Source
const FeedbackPkg = feedback.Package("modules")

Variables

View Source
var (
	ProjectType_name = map[int32]string{
		0: "CLIENT",
		1: "SERVER",
	}
	ProjectType_value = map[string]int32{
		"CLIENT": 0,
		"SERVER": 1,
	}
)

Enum value maps for ProjectType.

View Source
var (
	ErrUnsupportedProjectType     = errors.New("unsupported project type")
	ErrUnsupportedCodeGameVersion = errors.New("unsupported codegame version")
)
View Source
var ErrFileNotFound = errors.New("file not found")
View Source
var ErrVersionNotFound = errors.New("version not found")
View Source
var File_action_data_proto protoreflect.FileDescriptor

Functions

func AvailableLanguages

func AvailableLanguages() map[string]AvailableLanguage

Types

type Action

type Action string
const (
	ActionInfo      Action = "info"
	ActionCreate    Action = "create"
	ActionUpdate    Action = "update"
	ActionRunClient Action = "run_client"
	ActionRunServer Action = "run_server"
	ActionBuild     Action = "build"
)

type ActionCreateData

type ActionCreateData struct {
	ProjectType ProjectType `protobuf:"varint,1,opt,name=projectType,proto3,enum=modules.ProjectType" json:"projectType,omitempty"`
	Language    string      `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"`
	GameName    string      `protobuf:"bytes,3,opt,name=gameName,proto3" json:"gameName,omitempty"`
	// only needed for clients
	GameURL *string `protobuf:"bytes,4,opt,name=gameURL,proto3,oneof" json:"gameURL,omitempty"`
	// empty -> use latest
	LibraryVersion *string `protobuf:"bytes,5,opt,name=libraryVersion,proto3,oneof" json:"libraryVersion,omitempty"`
	// contains filtered or unexported fields
}

func GetCreateData

func GetCreateData() *ActionCreateData

func (*ActionCreateData) Descriptor deprecated

func (*ActionCreateData) Descriptor() ([]byte, []int)

Deprecated: Use ActionCreateData.ProtoReflect.Descriptor instead.

func (*ActionCreateData) GetGameName

func (x *ActionCreateData) GetGameName() string

func (*ActionCreateData) GetGameURL

func (x *ActionCreateData) GetGameURL() string

func (*ActionCreateData) GetLanguage

func (x *ActionCreateData) GetLanguage() string

func (*ActionCreateData) GetLibraryVersion

func (x *ActionCreateData) GetLibraryVersion() string

func (*ActionCreateData) GetProjectType

func (x *ActionCreateData) GetProjectType() ProjectType

func (*ActionCreateData) ProtoMessage

func (*ActionCreateData) ProtoMessage()

func (*ActionCreateData) ProtoReflect

func (x *ActionCreateData) ProtoReflect() protoreflect.Message

func (*ActionCreateData) Reset

func (x *ActionCreateData) Reset()

func (*ActionCreateData) String

func (x *ActionCreateData) String() string

type ActionRunClientData

type ActionRunClientData struct {
	Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"`
	// command line args to pass to the program
	Args     []string `protobuf:"bytes,2,rep,name=args,proto3" json:"args,omitempty"`
	GameURL  string   `protobuf:"bytes,3,opt,name=gameURL,proto3" json:"gameURL,omitempty"`
	GameID   string   `protobuf:"bytes,4,opt,name=gameID,proto3" json:"gameID,omitempty"`
	Spectate bool     `protobuf:"varint,5,opt,name=spectate,proto3" json:"spectate,omitempty"`
	// needed if spectate is false
	PlayerID *string `protobuf:"bytes,6,opt,name=playerID,proto3,oneof" json:"playerID,omitempty"`
	// needed if spectate is false
	PlayerSecret *string `protobuf:"bytes,7,opt,name=playerSecret,proto3,oneof" json:"playerSecret,omitempty"`
	// contains filtered or unexported fields
}

func GetRunClientData

func GetRunClientData() *ActionRunClientData

func (*ActionRunClientData) Descriptor deprecated

func (*ActionRunClientData) Descriptor() ([]byte, []int)

Deprecated: Use ActionRunClientData.ProtoReflect.Descriptor instead.

func (*ActionRunClientData) GetArgs

func (x *ActionRunClientData) GetArgs() []string

func (*ActionRunClientData) GetGameID

func (x *ActionRunClientData) GetGameID() string

func (*ActionRunClientData) GetGameURL

func (x *ActionRunClientData) GetGameURL() string

func (*ActionRunClientData) GetLanguage

func (x *ActionRunClientData) GetLanguage() string

func (*ActionRunClientData) GetPlayerID

func (x *ActionRunClientData) GetPlayerID() string

func (*ActionRunClientData) GetPlayerSecret

func (x *ActionRunClientData) GetPlayerSecret() string

func (*ActionRunClientData) GetSpectate

func (x *ActionRunClientData) GetSpectate() bool

func (*ActionRunClientData) ProtoMessage

func (*ActionRunClientData) ProtoMessage()

func (*ActionRunClientData) ProtoReflect

func (x *ActionRunClientData) ProtoReflect() protoreflect.Message

func (*ActionRunClientData) Reset

func (x *ActionRunClientData) Reset()

func (*ActionRunClientData) String

func (x *ActionRunClientData) String() string

type ActionRunServerData

type ActionRunServerData struct {
	Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"`
	// command line args to pass to the program
	Args []string `protobuf:"bytes,2,rep,name=args,proto3" json:"args,omitempty"`
	Port *int32   `protobuf:"varint,3,opt,name=port,proto3,oneof" json:"port,omitempty"`
	// contains filtered or unexported fields
}

func GetRunServerData

func GetRunServerData() *ActionRunServerData

func (*ActionRunServerData) Descriptor deprecated

func (*ActionRunServerData) Descriptor() ([]byte, []int)

Deprecated: Use ActionRunServerData.ProtoReflect.Descriptor instead.

func (*ActionRunServerData) GetArgs

func (x *ActionRunServerData) GetArgs() []string

func (*ActionRunServerData) GetLanguage

func (x *ActionRunServerData) GetLanguage() string

func (*ActionRunServerData) GetPort

func (x *ActionRunServerData) GetPort() int32

func (*ActionRunServerData) ProtoMessage

func (*ActionRunServerData) ProtoMessage()

func (*ActionRunServerData) ProtoReflect

func (x *ActionRunServerData) ProtoReflect() protoreflect.Message

func (*ActionRunServerData) Reset

func (x *ActionRunServerData) Reset()

func (*ActionRunServerData) String

func (x *ActionRunServerData) String() string

type ActionUpdateData

type ActionUpdateData struct {
	ProjectType ProjectType `protobuf:"varint,1,opt,name=projectType,proto3,enum=modules.ProjectType" json:"projectType,omitempty"`
	Language    string      `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"`
	// only needed for clients
	GameURL *string `protobuf:"bytes,3,opt,name=gameURL,proto3,oneof" json:"gameURL,omitempty"`
	// empty -> use latest
	LibraryVersion *string `protobuf:"bytes,4,opt,name=libraryVersion,proto3,oneof" json:"libraryVersion,omitempty"`
	// contains filtered or unexported fields
}

func GetUpdateData

func GetUpdateData() *ActionUpdateData

func (*ActionUpdateData) Descriptor deprecated

func (*ActionUpdateData) Descriptor() ([]byte, []int)

Deprecated: Use ActionUpdateData.ProtoReflect.Descriptor instead.

func (*ActionUpdateData) GetGameURL

func (x *ActionUpdateData) GetGameURL() string

func (*ActionUpdateData) GetLanguage

func (x *ActionUpdateData) GetLanguage() string

func (*ActionUpdateData) GetLibraryVersion

func (x *ActionUpdateData) GetLibraryVersion() string

func (*ActionUpdateData) GetProjectType

func (x *ActionUpdateData) GetProjectType() ProjectType

func (*ActionUpdateData) ProtoMessage

func (*ActionUpdateData) ProtoMessage()

func (*ActionUpdateData) ProtoReflect

func (x *ActionUpdateData) ProtoReflect() protoreflect.Message

func (*ActionUpdateData) Reset

func (x *ActionUpdateData) Reset()

func (*ActionUpdateData) String

func (x *ActionUpdateData) String() string

type AvailableLanguage

type AvailableLanguage struct {
	DisplayName    string
	SupportsClient bool
	SupportsServer bool
}

type Module

type Module struct {
	Lang        string
	DisplayName string
	// contains filtered or unexported fields
}

func LoadModule

func LoadModule(lang string) (*Module, error)

func (*Module) ExecCreateClient

func (m *Module) ExecCreateClient(gameName, gameURL, language string, cgVersion versions.Version) (modVersion versions.Version, err error)

func (*Module) ExecCreateServer

func (m *Module) ExecCreateServer(gameName, language string) (modVersion versions.Version, err error)

func (*Module) ExecInfo

func (m *Module) ExecInfo(modVersion versions.Version) (ModuleInfo, error)

func (*Module) ExecRunClient

func (m *Module) ExecRunClient(modVersion versions.Version, gameURL, language, gameID string, playerID, playerSecret *string, spectate bool, args []string) error

func (*Module) ExecRunServer

func (m *Module) ExecRunServer(modVersion versions.Version, language string, port *int32, args []string) error

func (*Module) ExecUpdateClient

func (m *Module) ExecUpdateClient(language, gameURL string, cgVersion versions.Version) (modVersion versions.Version, err error)

func (*Module) ExecUpdateServer

func (m *Module) ExecUpdateServer(language, gameURL string, cgVersion versions.Version) (modVersion versions.Version, err error)

type ModuleInfo

type ModuleInfo struct {
	Version         versions.Version
	Actions         []Action                      `json:"actions"`
	LibraryVersions map[string][]versions.Version `json:"library_versions"`
	ProjectTypes    []string                      `json:"project_types"`
}

type ProjectType

type ProjectType int32
const (
	ProjectType_CLIENT ProjectType = 0
	ProjectType_SERVER ProjectType = 1
)

func (ProjectType) Descriptor

func (ProjectType) Enum

func (x ProjectType) Enum() *ProjectType

func (ProjectType) EnumDescriptor deprecated

func (ProjectType) EnumDescriptor() ([]byte, []int)

Deprecated: Use ProjectType.Descriptor instead.

func (ProjectType) Number

func (x ProjectType) Number() protoreflect.EnumNumber

func (ProjectType) String

func (x ProjectType) String() string

func (ProjectType) Type

type ProviderGithub

type ProviderGithub struct{}

func (*ProviderGithub) DownloadModuleBinary

func (p *ProviderGithub) DownloadModuleBinary(target io.Writer, providerVars map[string]any, version versions.Version) error

func (*ProviderGithub) FindExactVersion

func (p *ProviderGithub) FindExactVersion(providerVars map[string]any, version versions.Version) (versions.Version, error)

func (*ProviderGithub) Name

func (p *ProviderGithub) Name() string

func (*ProviderGithub) ValidateProviderVars

func (p *ProviderGithub) ValidateProviderVars(providerVars map[string]any) []string

type ProviderLocal

type ProviderLocal struct{}

func (*ProviderLocal) DownloadModuleBinary

func (p *ProviderLocal) DownloadModuleBinary(target io.Writer, providerVars map[string]any, version versions.Version) error

func (*ProviderLocal) FindExactVersion

func (p *ProviderLocal) FindExactVersion(providerVars map[string]any, version versions.Version) (versions.Version, error)

func (*ProviderLocal) Name

func (p *ProviderLocal) Name() string

func (*ProviderLocal) ValidateProviderVars

func (p *ProviderLocal) ValidateProviderVars(providerVars map[string]any) []string

Jump to

Keyboard shortcuts

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