Documentation ¶
Overview ¶
Package bedrock provides the tools to manage bedrock servers
Index ¶
- func DummyBackup(files []File) error
- type BackupOptions
- type Backupper
- type BackupperFunc
- type File
- type Server
- func (s *Server) Attach(in io.Reader, out io.Writer) error
- func (s *Server) Backup(ctx context.Context, opts BackupOptions) error
- func (s *Server) SendRawCommand(rawCommand string)
- func (s *Server) SendRawCommandWaitResponse(ctx context.Context, rawCommand, response string) (output string, err error)
- func (s *Server) Stop()
- type TarBackup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DummyBackup ¶
Types ¶
type BackupOptions ¶
type BackupOptions struct { // Backupper that will Backupper Backupper // CommandTimeout time to wait for the expected response. CommandTimeout time.Duration // SavePause is the delay after the save command. SavePause time.Duration }
BackupOptions
type BackupperFunc ¶
func (BackupperFunc) Backup ¶
func (f BackupperFunc) Backup(files []File) error
BackupperFunc implements the Backupper interface.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents a Minecraft Bedrock Server instance.
func RunServer ¶
RunServer will start the Minecraft server and sets up 3 Go routines: - Read messages from the console. - Setup write queue to send messages to the console. - Wait for the server to exit and cleanup channels and goroutines.
func (*Server) Backup ¶
func (s *Server) Backup(ctx context.Context, opts BackupOptions) error
Backup holds, queries, call external backups runction and resumes the server. See bedrock_server_how_to.html of the bedrock server download for more information. Warning, when this returns an error it could leave the server in an unstable state.
func (*Server) SendRawCommand ¶
SendRawCommand sends the given string directly to the server console.
func (*Server) SendRawCommandWaitResponse ¶
func (s *Server) SendRawCommandWaitResponse( ctx context.Context, rawCommand, response string) (output string, err error)
SendRawCommandWaitResponse sends a command and returns when the response is returned or the context is canceled. response is a regex that can match over multiple lines.