Skip to content
Open

Cell #2765

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 173 additions & 9 deletions core/internal/mocks/network/mock_Backend.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 47 additions & 29 deletions core/internal/server/network/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ type Backend interface {
GetWiFiEnabled() (bool, error)
SetWiFiEnabled(enabled bool) error

GetCellularEnabled() (bool, error)
SetCellularEnabled(enabled bool) error

ScanWiFi() error
ScanWiFiDevice(device string) error
GetWiFiNetworkDetails(ssid string) (*NetworkInfoResponse, error)
Expand All @@ -27,6 +30,13 @@ type Backend interface {
DisconnectEthernetDevice(device string) error
ActivateWiredConnection(uuid string) error

GetCellularDevices() []CellularDevice
GetCellularConnections() ([]WiredConnection, error)
ConnectCellular() error
DisconnectCellular() error
DisconnectCellularDevice(device string) error
ActivateCellularConnection(uuid string) error

ListVPNProfiles() ([]VPNProfile, error)
ListActiveVPN() ([]VPNActive, error)
ConnectVPN(uuidOrName string, singleActive bool) error
Expand All @@ -52,33 +62,41 @@ type Backend interface {
}

type BackendState struct {
Backend string
NetworkStatus NetworkStatus
EthernetIP string
EthernetDevice string
EthernetConnected bool
EthernetConnectionUuid string
EthernetDevices []EthernetDevice
WiFiIP string
WiFiDevice string
WiFiConnected bool
WiFiEnabled bool
WiFiSSID string
WiFiBSSID string
WiFiSignal uint8
WiFiNetworks []WiFiNetwork
SavedWiFiNetworks []WiFiNetwork
WiFiDevices []WiFiDevice
WiredConnections []WiredConnection
VPNProfiles []VPNProfile
VPNActive []VPNActive
IsConnecting bool
ConnectingSSID string
ConnectingDevice string
ConnectingPreExisting bool
IsConnectingVPN bool
ConnectingVPNUUID string
LastError string
VPNError string
VPNErrorUuid string
Backend string
NetworkStatus NetworkStatus
EthernetIP string
EthernetDevice string
EthernetConnected bool
EthernetConnectionUuid string
EthernetDevices []EthernetDevice
CellularIP string
CellularDevice string
CellularConnected bool
CellularEnabled bool
CellularHardwareEnabled bool
CellularConnectionUuid string
CellularDevices []CellularDevice
CellularConnections []WiredConnection
WiFiIP string
WiFiDevice string
WiFiConnected bool
WiFiEnabled bool
WiFiSSID string
WiFiBSSID string
WiFiSignal uint8
WiFiNetworks []WiFiNetwork
SavedWiFiNetworks []WiFiNetwork
WiFiDevices []WiFiDevice
WiredConnections []WiredConnection
VPNProfiles []VPNProfile
VPNActive []VPNActive
IsConnecting bool
ConnectingSSID string
ConnectingDevice string
ConnectingPreExisting bool
IsConnectingVPN bool
ConnectingVPNUUID string
LastError string
VPNError string
VPNErrorUuid string
}
32 changes: 32 additions & 0 deletions core/internal/server/network/backend_hybrid_iwd_networkd.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,38 @@ func (b *HybridIwdNetworkdBackend) ActivateWiredConnection(uuid string) error {
return b.l3.ActivateWiredConnection(uuid)
}

func (b *HybridIwdNetworkdBackend) GetCellularDevices() []CellularDevice {
return []CellularDevice{}
}

func (b *HybridIwdNetworkdBackend) GetCellularEnabled() (bool, error) {
return false, fmt.Errorf("cellular radio control not supported in hybrid mode")
}

func (b *HybridIwdNetworkdBackend) SetCellularEnabled(enabled bool) error {
return fmt.Errorf("cellular radio control not supported in hybrid mode")
}

func (b *HybridIwdNetworkdBackend) GetCellularConnections() ([]WiredConnection, error) {
return nil, fmt.Errorf("cellular connections not supported in hybrid mode")
}

func (b *HybridIwdNetworkdBackend) ConnectCellular() error {
return fmt.Errorf("cellular connections not supported in hybrid mode")
}

func (b *HybridIwdNetworkdBackend) DisconnectCellular() error {
return fmt.Errorf("cellular connections not supported in hybrid mode")
}

func (b *HybridIwdNetworkdBackend) DisconnectCellularDevice(device string) error {
return fmt.Errorf("cellular connections not supported in hybrid mode")
}

func (b *HybridIwdNetworkdBackend) ActivateCellularConnection(uuid string) error {
return fmt.Errorf("cellular connections not supported in hybrid mode")
}

func (b *HybridIwdNetworkdBackend) ListVPNProfiles() ([]VPNProfile, error) {
return []VPNProfile{}, nil
}
Expand Down
32 changes: 32 additions & 0 deletions core/internal/server/network/backend_iwd_unimplemented.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,38 @@ func (b *IWDBackend) ActivateWiredConnection(uuid string) error {
return fmt.Errorf("wired connections not supported by iwd")
}

func (b *IWDBackend) GetCellularDevices() []CellularDevice {
return []CellularDevice{}
}

func (b *IWDBackend) GetCellularEnabled() (bool, error) {
return false, fmt.Errorf("cellular radio control not supported by iwd")
}

func (b *IWDBackend) SetCellularEnabled(enabled bool) error {
return fmt.Errorf("cellular radio control not supported by iwd")
}

func (b *IWDBackend) GetCellularConnections() ([]WiredConnection, error) {
return nil, fmt.Errorf("cellular connections not supported by iwd")
}

func (b *IWDBackend) ConnectCellular() error {
return fmt.Errorf("cellular connections not supported by iwd")
}

func (b *IWDBackend) DisconnectCellular() error {
return fmt.Errorf("cellular connections not supported by iwd")
}

func (b *IWDBackend) DisconnectCellularDevice(device string) error {
return fmt.Errorf("cellular connections not supported by iwd")
}

func (b *IWDBackend) ActivateCellularConnection(uuid string) error {
return fmt.Errorf("cellular connections not supported by iwd")
}

func (b *IWDBackend) ListVPNProfiles() ([]VPNProfile, error) {
return nil, fmt.Errorf("VPN not supported by iwd backend")
}
Expand Down
Loading
Loading