diff --git a/README.md b/README.md index 6c3d6a1..a8f460e 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,8 @@ pndpd proxy ", commandLineRead, configRead) +} + +func configRead(s []string) { + // Prints out the contents of the config file that are relevant for this module (that are inside the example{} option) + for _, n := range s { + fmt.Println(n) + } +} + +func commandLineRead(s []string) { + // Prints out the command line options given to the program if the command starts with "example" + for _, n := range s { + fmt.Println(n) + } +} diff --git a/modules/modules.go b/modules/modules.go new file mode 100644 index 0000000..0993a9d --- /dev/null +++ b/modules/modules.go @@ -0,0 +1,21 @@ +package modules + +var ModuleList []*Module + +type Module struct { + Name string + Option string + OptionDescription string + CommandLineCallback func([]string) + ConfigCallback func([]string) +} + +func RegisterModule(name string, option string, description string, commandLineCallback func([]string), configCallback func([]string)) { + ModuleList = append(ModuleList, &Module{ + Name: name, + Option: option, + OptionDescription: description, + CommandLineCallback: commandLineCallback, + ConfigCallback: configCallback, + }) +} diff --git a/pndp/process.go b/pndp/process.go index 9b24d1b..47a2dad 100644 --- a/pndp/process.go +++ b/pndp/process.go @@ -57,7 +57,7 @@ func (obj *ResponderObj) start() { }() go respond(obj.iface, requests, ndp_ADV, nil, obj.filter, obj.autosense, obj.stopWG, obj.stopChan) go listen(obj.iface, requests, ndp_SOL, obj.stopWG, obj.stopChan) - fmt.Println("Started responder instance on interface ", obj.iface) + fmt.Println("Started responder instance on interface", obj.iface) <-obj.stopChan } @@ -128,7 +128,7 @@ func (obj *ProxyObj) start() { go listen(obj.iface2, req_iface2_adv_iface1, ndp_ADV, obj.stopWG, obj.stopChan) go respond(obj.iface1, req_iface2_adv_iface1, ndp_ADV, out_iface2_sol_questions_iface1_adv, nil, "", obj.stopWG, obj.stopChan) - fmt.Println("Started Proxy instance for interfaces: ", obj.iface1, " and ", obj.iface2) + fmt.Println("Started Proxy instance for interfaces:", obj.iface1, "and", obj.iface2) <-obj.stopChan }