Documentation
¶
Index ¶
- func BuildSubmission(course Course, exercise Exercise, user Token, submissionFilename string) error
- func DistributeToken(token Token, to Mail, course Course, config Config) error
- func Serve(addr string)
- func TokenHasValidFormat(t Token) bool
- type Config
- type Course
- type Exercise
- func (e Exercise) GetBuildOutput(submissionFilename string) (io.Reader, error)
- func (e Exercise) GetFeedback(submissionFilename string) (io.Reader, error)
- func (e Exercise) Store() error
- func (e Exercise) StoreSubmission(submission io.Reader, filename string) ([]byte, error)
- func (e Exercise) WasBuildSuccessful(submissionFilename string) bool
- type Mail
- type Token
- type TokenMapping
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildSubmission ¶
func DistributeToken ¶
func TokenHasValidFormat ¶
TokenHasValidFormat verifies that the given token follows the required format.
Types ¶
type Config ¶
type Config struct {
ListenAddress string
MailHost string
MailFrom string
MailUseAuth bool
MailAuthIdent string
MailAuthUser string
MailAuthPass string
}
func DefaultConfig ¶
func DefaultConfig() Config
func LoadConfig ¶
type Course ¶
type Course struct {
Identifier string `json:"-"`
Name string
URL string
Path string `json:"-"`
Exercises map[string]Exercise `json:"-"`
Users []Token
}
Course represents a course with its exercise sheets and registered users.
func LoadCourse ¶
LoadCourse loads course data from disk.
func LoadCourses ¶
LoadCourses loads all courses from the given directory.
func (Course) IsUserAuthorized ¶
type Exercise ¶
Exercise represents an exercise sheet.
func (Exercise) GetBuildOutput ¶
func (Exercise) GetFeedback ¶
func (Exercise) StoreSubmission ¶
func (Exercise) WasBuildSuccessful ¶
type Token ¶
type Token = string
Token that is given to a user, it is commonly used for authenticating uploads.
type TokenMapping ¶
TokenMapping relates tokens to mail addresses. Be careful when handling since this is personal identifiable data.
func LoadTokenMapping ¶
func LoadTokenMapping(mappingFilepath string) (TokenMapping, error)
func NewTokenMapping ¶
func NewTokenMapping(mailAddresses io.Reader) (mapping TokenMapping)
NewTokenMapping creates a TokenMapping from the given io.Reader (typically a file). The input is expected to contain one mail address per line. Tokens are generated on the fly. A token is guaranteed to be unique within the returned mapping.
func (TokenMapping) Store ¶
func (m TokenMapping) Store(filepath string) error
Store stores the mapping as file.