Documentation
¶
Index ¶
Constants ¶
View Source
const ( MsgOK int16 = iota // OK. MsgInvalidMsg // Invalid message type. Right after this the connection is closed. MsgInvalidParam // Invalid parameters. Right after this the connection is closed. MsgAuthFailed // Wrong password / Not authenticated. Right after this the connection is closed. MsgUnsupportedHash // Unsupported hash type. MsgErrorMessage // A error with a string message. After this the connection is closed. )
View Source
const ( // Client sends MsgAuthenticate to authenticate themselves. // Salt is joined right after the real password before hashing. // // [MsgAuthenticate] [HashType int16] [Username string] [Hash []byte] MsgAuthenticate int16 = 100 + iota // Client sends MsgMakeRequest to request a make. // After a MsgMakeRequestOK the client sends files via MsgMakeSendFile and MsgMakeSendFileEnd. // and waits for MsgErrorMessage/MsgMakeOutput and MsgMakeOutputEnd. // // For now the Filename count should be 1. // [MsgMakeRequest] [Type string] [FilenameCount int32] [... [Filename string] .. ] // [OptionCount int32] [... [OptionKey string] [OptionValue string] ...] MsgMakeRequest // Server sends MsgMakeRequestOK after the request has been accepted. // [MsgMakeRequestOK] [RecipeType string] MsgMakeRequestOK // Server sends MsgMakeRequestNoRecipe if no matching recipe can be found. MsgMakeRequstNoRecipe // Client sends MsgMakeSendFile to send a file. // // [MsgMakeSendFile] [Name string] [Data []byte] MsgMakeSendFile // Client sends MsgMakeSendFileEnd after it has sent every file in the MakeRequest. MsgMakeSendFileEnd // Server sends MsgMakeOutput after making the recipe. // // [MsgMakeOutput] [Name string] [Data []byte] MsgMakeOutput // Server sends MsgMakeOutputEnd after it has sent every file in the output. // // After this message the make session is considered complete. MsgMakeOutputEnd // MsgGoodbye can be sent at any time by any side to close the connection. MsgGoodbye )
View Source
const ( // MsgStdmsg carries a message from the rmake daemon to the client. // // Usually it indicates the next command to be executed. MsgStdmsg int16 = 200 + iota // MsgStdout carries a stdout message by one of the Commands. MsgStdout // MsgStderr carries a stderr message by one of the Commands. MsgStderr )
Messages. All of them are followed by a single [string].
View Source
const (
// The default port for rmaked to listen on
DefaultPort = 25386
)
View Source
const (
HashTypeSHA256 int16 = iota
)
Variables ¶
View Source
var ( ErrInvalidMsg = errors.New("invalid message code") ErrInvalidParam = errors.New("invalid message parameters") )
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { Underlying io.ReadWriteCloser // The underlying connection. Authed bool // Whether or not the connection is authencated. User string // The user name if authencated. Request *Request // The current request on the connection, or nil for none. }
Conn is a rmake connection.
func (*Conn) Make ¶
Make processes and completes the make request.
Make should be called after the server replied MsgMakeRequestOK, c.Request.Recipe is set, and the client should now be sending files.
If err!=nil, the connection is closed. And if err is not one of ErrInvalidMsg/ErrInvalidParam, A MsgErrorMessage is sent.
type Recipe ¶
type Recipe struct { Name string // Short name for the recipe. FileGlob string // The recipe is selected automatically if the glob matches the file uploaded. Command []string // What to execute in order in the working directory. OutputGlob string // Matches output files to be sent to the client. MaxTime int // Maximum time, in milliseconds, for the task to finish. // contains filtered or unexported fields }
Recipe contains instructions for what to do for a request.
type Request ¶
type Request struct { Recipe *Recipe // The recipe used, nil on the client. Filename string // The first filename. Type string // The recipe type, if specified. Option map[string]string // Other options, if specified. // contains filtered or unexported fields }
Request is a make request. The request is fed to Recipe.Command via template.
Click to show internal directories.
Click to hide internal directories.