Commit 518415d
Changed files (2)
question.go
@@ -0,0 +1,33 @@
+// Questioner contains the data necessary for retrieving questions
+package main
+
+import (
+ "fmt"
+)
+
+type Record struct {
+ question,
+ answer,
+ category string
+}
+
+// parseLine parses a csv line and returns a single record
+func parseLine(line string) (Record, error) {
+ var record Record
+ return record, fmt.Errorf("Unable to parse line for %s", line)
+}
+
+// loadFile reads the lines of the question directory and returns an array of Records
+// The questions are expected in the form of a csv in the order
+// question, answer, category
+// Lines starting with '#' are ignored
+func LoadFile(questionFile string) ([]Record, error) {
+
+ return nil, fmt.Errorf("Unable to finish readLines for %s", questionFile)
+}
+
+// loadDirectory uses the given directory to load questions from the files therein
+func LoadDirectory(questionDirectory string) ([]Record, error) {
+
+ return nil, fmt.Errorf("Unable to finish loadDirectory for %s", questionDirectory)
+}
questioner.go
@@ -39,6 +39,8 @@ type CONFIG struct {
PRIVATE_KEY string
// USE_HTTPS determines if the server should use HTTPS
USE_HTTPS bool
+ // QUESTIONS contains the path to the questions directory
+ QUESTIONS string
}
// defaultConfig is used when no configuration file is given
@@ -49,6 +51,7 @@ MAX_CONNECTIONS = 1500
PERMIT_BLANK_PASSWORD = true
USE_HTTPS = false
PRIVATE_KEY = "~/.ssh/question.priv"
+QUESTIONS = "/path/to/questions"
`
//LoadConfiguration loads the configuration file