Refactor stations discovery and add hostapd discovery
This commit is contained in:
parent
69594c2fe4
commit
2922a03724
15 changed files with 1339 additions and 249 deletions
24
internal/station/factory.go
Normal file
24
internal/station/factory.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package station
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nemunaire/repeater/internal/station/arp"
|
||||
"github.com/nemunaire/repeater/internal/station/backend"
|
||||
"github.com/nemunaire/repeater/internal/station/dhcp"
|
||||
"github.com/nemunaire/repeater/internal/station/hostapd"
|
||||
)
|
||||
|
||||
// createBackend creates a station backend based on the backend name
|
||||
func createBackend(backendName string) (backend.StationBackend, error) {
|
||||
switch backendName {
|
||||
case "arp":
|
||||
return arp.NewBackend(), nil
|
||||
case "dhcp":
|
||||
return dhcp.NewBackend(), nil
|
||||
case "hostapd":
|
||||
return hostapd.NewBackend(), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("invalid station backend: %s (must be 'arp', 'dhcp', or 'hostapd')", backendName)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue