Commit cd46518

Richard Luby <richluby@gmail.com>
2016-10-21 14:58:20
added documentation comments
added comments to describe functionality
1 parent 9dacda0
Changed files (1)
questioner.go
@@ -10,28 +10,35 @@ import (
 	"os"
 )
 
-// define exit error codes
+// EXIT_CODES define exit error codes
 type EXIT_CODES struct {
 	BAD_CONFIG,
 	FILE_IO_ERROR,
 	NETWORK_IO_ERROR int
 }
 
-// declare exit codes
+// EXIT_CODE declares exit codes
 var EXIT_CODE = EXIT_CODES{
 	BAD_CONFIG:       1,
 	FILE_IO_ERROR:    2,
 	NETWORK_IO_ERROR: 3}
 
-// define defaults for the server
+// CONFIG defines default for the server
 type CONFIG struct {
-	LISTEN_PORT, MAX_CONNECTIONS int
-	PERMIT_BLANK_PASSWORD        bool
-	PRIVATE_KEY                  string
+	//LISTEN_PORT defines the the port on which to listen
+	LISTEN_PORT int
+	// MAX_CONNECTIONS defines the maximum numbers of users with an active connection
+	MAX_CONNECTIONS int
+	// PERMIT_BLANK_PASSWORD determines if a password should be provided with the user names
+	PERMIT_BLANK_PASSWORD bool
+	// PRIVATE_KEY defines the path to the server's private key for signing https connections
+	PRIVATE_KEY string
 }
 
+// config contains the configuration for the program
 var config CONFIG
 
+// defaultConfig is used when no configuration file is given
 const defaultConfig = `
 LISTEN_PORT = 8022
 MAX_CONNECTIONS = 1500
@@ -40,6 +47,7 @@ PRIVATE_KEY = "~/.ssh/question.priv"
 `
 
 //LoadConfiguration loads the configuration file
+// cfgFile : the file that contains the configuration
 func LoadConfiguration(cfgFile string) CONFIG {
 	var contents string
 	if cfgFile == "" {
@@ -59,10 +67,22 @@ func LoadConfiguration(cfgFile string) CONFIG {
 	return config
 }
 
+// HandleConnections processes client connections
+func HandleConnections() {
+
+}
+
+//Listen sets binds the listening server and starts the listening loop
+func Listen(serverConfig CONFIG) {
+	//bind socket
+	//start loop
+}
+
 // main handles starting the listening server
 func main() {
 	confFile := flag.String("conf-file", "", "define a specific configuration file to read")
 	flag.Parse()
-	LoadConfiguration(*confFile)
+	config = LoadConfiguration(*confFile)
+	Listen(config)
 	fmt.Printf("%+v\n", config)
 }