Create wifi backend abstraction
This commit is contained in:
parent
f4481bca62
commit
79c28da9c5
7 changed files with 401 additions and 174 deletions
21
internal/wifi/factory.go
Normal file
21
internal/wifi/factory.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package wifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nemunaire/repeater/internal/wifi/backend"
|
||||
"github.com/nemunaire/repeater/internal/wifi/iwd"
|
||||
)
|
||||
|
||||
// createBackend creates the appropriate WiFi backend based on the backend name
|
||||
func createBackend(backendName string) (backend.WiFiBackend, error) {
|
||||
switch backendName {
|
||||
case "iwd":
|
||||
return iwd.NewIWDBackend(), nil
|
||||
case "wpasupplicant":
|
||||
// TODO: Implement wpa_supplicant backend
|
||||
return nil, fmt.Errorf("wpa_supplicant backend not yet implemented")
|
||||
default:
|
||||
return nil, fmt.Errorf("invalid wifi backend: %s (must be 'iwd' or 'wpasupplicant')", backendName)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue