mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
core: replace all use of interface{} with any (#848)
This commit is contained in:
@@ -9,9 +9,9 @@ import (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
type SuccessResult struct {
|
||||
@@ -190,7 +190,7 @@ func handlePairingSubmit(conn net.Conn, req Request, manager *Manager) {
|
||||
return
|
||||
}
|
||||
|
||||
secretsRaw, ok := req.Params["secrets"].(map[string]interface{})
|
||||
secretsRaw, ok := req.Params["secrets"].(map[string]any)
|
||||
secrets := make(map[string]string)
|
||||
if ok {
|
||||
for k, v := range secretsRaw {
|
||||
|
||||
@@ -34,9 +34,9 @@ type DeviceUpdate struct {
|
||||
}
|
||||
|
||||
type Request struct {
|
||||
ID interface{} `json:"id"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params"`
|
||||
ID any `json:"id"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params"`
|
||||
}
|
||||
|
||||
type Manager struct {
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
type SuccessResult struct {
|
||||
|
||||
@@ -75,7 +75,7 @@ func TestHandleGetPrinters_Error(t *testing.T) {
|
||||
|
||||
handleGetPrinters(conn, req, m)
|
||||
|
||||
var resp models.Response[interface{}]
|
||||
var resp models.Response[any]
|
||||
err := json.NewDecoder(buf).Decode(&resp)
|
||||
assert.NoError(t, err)
|
||||
assert.Nil(t, resp.Result)
|
||||
@@ -103,7 +103,7 @@ func TestHandleGetJobs(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 1,
|
||||
Method: "cups.getJobs",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"printerName": "printer1",
|
||||
},
|
||||
}
|
||||
@@ -130,12 +130,12 @@ func TestHandleGetJobs_MissingParam(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 1,
|
||||
Method: "cups.getJobs",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleGetJobs(conn, req, m)
|
||||
|
||||
var resp models.Response[interface{}]
|
||||
var resp models.Response[any]
|
||||
err := json.NewDecoder(buf).Decode(&resp)
|
||||
assert.NoError(t, err)
|
||||
assert.Nil(t, resp.Result)
|
||||
@@ -155,7 +155,7 @@ func TestHandlePausePrinter(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 1,
|
||||
Method: "cups.pausePrinter",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"printerName": "printer1",
|
||||
},
|
||||
}
|
||||
@@ -182,7 +182,7 @@ func TestHandleResumePrinter(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 1,
|
||||
Method: "cups.resumePrinter",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"printerName": "printer1",
|
||||
},
|
||||
}
|
||||
@@ -209,7 +209,7 @@ func TestHandleCancelJob(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 1,
|
||||
Method: "cups.cancelJob",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"jobID": float64(1),
|
||||
},
|
||||
}
|
||||
@@ -236,7 +236,7 @@ func TestHandlePurgeJobs(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 1,
|
||||
Method: "cups.purgeJobs",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"printerName": "printer1",
|
||||
},
|
||||
}
|
||||
@@ -267,7 +267,7 @@ func TestHandleRequest_UnknownMethod(t *testing.T) {
|
||||
|
||||
HandleRequest(conn, req, m)
|
||||
|
||||
var resp models.Response[interface{}]
|
||||
var resp models.Response[any]
|
||||
err := json.NewDecoder(buf).Decode(&resp)
|
||||
assert.NoError(t, err)
|
||||
assert.Nil(t, resp.Result)
|
||||
|
||||
@@ -62,7 +62,7 @@ func (sm *SubscriptionManager) createSubscription() (int, error) {
|
||||
req.OperationAttributes[ipp.AttributeRequestingUserName] = "dms"
|
||||
|
||||
// Subscription attributes go in SubscriptionAttributes (subscription-attributes-tag in IPP)
|
||||
req.SubscriptionAttributes = map[string]interface{}{
|
||||
req.SubscriptionAttributes = map[string]any{
|
||||
"notify-events": []string{
|
||||
"printer-state-changed",
|
||||
"printer-added",
|
||||
|
||||
@@ -83,7 +83,7 @@ func (sm *DBusSubscriptionManager) createDBusSubscription() (int, error) {
|
||||
req.OperationAttributes[ipp.AttributePrinterURI] = fmt.Sprintf("%s/", sm.baseURL)
|
||||
req.OperationAttributes[ipp.AttributeRequestingUserName] = "dms"
|
||||
|
||||
req.SubscriptionAttributes = map[string]interface{}{
|
||||
req.SubscriptionAttributes = map[string]any{
|
||||
"notify-events": []string{
|
||||
"printer-state-changed",
|
||||
"printer-added",
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
type SuccessResult struct {
|
||||
|
||||
@@ -41,7 +41,7 @@ type Manager struct {
|
||||
display *wlclient.Display
|
||||
ctx *wlclient.Context
|
||||
registry *wlclient.Registry
|
||||
manager interface{}
|
||||
manager any
|
||||
|
||||
outputs syncmap.Map[uint32, *outputState]
|
||||
|
||||
@@ -67,7 +67,7 @@ type outputState struct {
|
||||
id uint32
|
||||
registryName uint32
|
||||
output *wlclient.Output
|
||||
ipcOutput interface{}
|
||||
ipcOutput any
|
||||
name string
|
||||
active uint32
|
||||
tags []TagState
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID interface{} `json:"id"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params"`
|
||||
ID any `json:"id"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params"`
|
||||
}
|
||||
|
||||
func HandleRequest(conn net.Conn, req Request, m *Manager) {
|
||||
|
||||
@@ -56,7 +56,7 @@ func TestHandleRequest(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "evdev.getState",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
HandleRequest(conn, req, m)
|
||||
@@ -85,7 +85,7 @@ func TestHandleRequest(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 456,
|
||||
Method: "evdev.unknownMethod",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
HandleRequest(conn, req, m)
|
||||
@@ -114,7 +114,7 @@ func TestHandleGetState(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 789,
|
||||
Method: "evdev.getState",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleGetState(conn, req, m)
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
type SuccessResult struct {
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
type SuccessResult struct {
|
||||
|
||||
@@ -56,7 +56,7 @@ func mockGetAllAccountsProperties() *dbus.Call {
|
||||
"Locked": dbus.MakeVariant(false),
|
||||
"PasswordMode": dbus.MakeVariant(int32(1)),
|
||||
}
|
||||
return &dbus.Call{Err: nil, Body: []interface{}{props}}
|
||||
return &dbus.Call{Err: nil, Body: []any{props}}
|
||||
}
|
||||
|
||||
func TestRespondError_Freedesktop(t *testing.T) {
|
||||
@@ -134,7 +134,7 @@ func TestHandleSetIconFile(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "freedesktop.accounts.setIconFile",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleSetIconFile(conn, req, manager)
|
||||
@@ -167,7 +167,7 @@ func TestHandleSetIconFile(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "freedesktop.accounts.setIconFile",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"path": "/path/to/icon.png",
|
||||
},
|
||||
}
|
||||
@@ -199,7 +199,7 @@ func TestHandleSetIconFile(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "freedesktop.accounts.setIconFile",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"path": "/path/to/icon.png",
|
||||
},
|
||||
}
|
||||
@@ -226,7 +226,7 @@ func TestHandleSetRealName(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "freedesktop.accounts.setRealName",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleSetRealName(conn, req, manager)
|
||||
@@ -259,7 +259,7 @@ func TestHandleSetRealName(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "freedesktop.accounts.setRealName",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"name": "New Name",
|
||||
},
|
||||
}
|
||||
@@ -289,7 +289,7 @@ func TestHandleSetEmail(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "freedesktop.accounts.setEmail",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleSetEmail(conn, req, manager)
|
||||
@@ -322,7 +322,7 @@ func TestHandleSetEmail(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "freedesktop.accounts.setEmail",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"email": "test@example.com",
|
||||
},
|
||||
}
|
||||
@@ -352,7 +352,7 @@ func TestHandleSetLanguage(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "freedesktop.accounts.setLanguage",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleSetLanguage(conn, req, manager)
|
||||
@@ -377,7 +377,7 @@ func TestHandleSetLocation(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "freedesktop.accounts.setLocation",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleSetLocation(conn, req, manager)
|
||||
@@ -402,7 +402,7 @@ func TestHandleGetUserIconFile(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "freedesktop.accounts.getUserIconFile",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleGetUserIconFile(conn, req, manager)
|
||||
@@ -429,7 +429,7 @@ func TestHandleGetUserIconFile(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "freedesktop.accounts.getUserIconFile",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"username": "testuser",
|
||||
},
|
||||
}
|
||||
@@ -473,7 +473,7 @@ func TestHandleGetColorScheme(t *testing.T) {
|
||||
mockSettingsObj := mockdbus.NewMockBusObject(t)
|
||||
mockCall := &dbus.Call{
|
||||
Err: nil,
|
||||
Body: []interface{}{dbus.MakeVariant(uint32(1))},
|
||||
Body: []any{dbus.MakeVariant(uint32(1))},
|
||||
}
|
||||
mockSettingsObj.EXPECT().Call("org.freedesktop.portal.Settings.ReadOne", dbus.Flags(0), "org.freedesktop.appearance", "color-scheme").Return(mockCall)
|
||||
|
||||
@@ -564,7 +564,7 @@ func TestHandleRequest(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: method,
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
HandleRequest(conn, req, manager)
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
type SuccessResult struct {
|
||||
|
||||
@@ -266,7 +266,7 @@ func TestHandleSetIdleHint(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "loginctl.setIdleHint",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleSetIdleHint(conn, req, manager)
|
||||
@@ -294,7 +294,7 @@ func TestHandleSetIdleHint(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "loginctl.setIdleHint",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"idle": true,
|
||||
},
|
||||
}
|
||||
@@ -327,7 +327,7 @@ func TestHandleSetIdleHint(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "loginctl.setIdleHint",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"idle": false,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ func (m *Manager) updateSessionState() error {
|
||||
}
|
||||
}
|
||||
if v, ok := props["User"]; ok {
|
||||
if userArr, ok := v.Value().([]interface{}); ok && len(userArr) >= 1 {
|
||||
if userArr, ok := v.Value().([]any); ok && len(userArr) >= 1 {
|
||||
if uid, ok := userArr[0].(uint32); ok {
|
||||
m.state.User = uid
|
||||
}
|
||||
@@ -201,7 +201,7 @@ func (m *Manager) updateSessionState() error {
|
||||
}
|
||||
}
|
||||
if v, ok := props["Seat"]; ok {
|
||||
if seatArr, ok := v.Value().([]interface{}); ok && len(seatArr) >= 1 {
|
||||
if seatArr, ok := v.Value().([]any); ok && len(seatArr) >= 1 {
|
||||
if seatID, ok := seatArr[0].(string); ok {
|
||||
m.state.Seat = seatID
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func TestManager_HandleDBusSignal_PrepareForSleep(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.login1.Manager.PrepareForSleep",
|
||||
Body: []interface{}{true},
|
||||
Body: []any{true},
|
||||
}
|
||||
|
||||
manager.handleDBusSignal(sig)
|
||||
@@ -85,7 +85,7 @@ func TestManager_HandleDBusSignal_PrepareForSleep(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.login1.Manager.PrepareForSleep",
|
||||
Body: []interface{}{false},
|
||||
Body: []any{false},
|
||||
}
|
||||
|
||||
manager.handleDBusSignal(sig)
|
||||
@@ -106,7 +106,7 @@ func TestManager_HandleDBusSignal_PrepareForSleep(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.login1.Manager.PrepareForSleep",
|
||||
Body: []interface{}{},
|
||||
Body: []any{},
|
||||
}
|
||||
|
||||
manager.handleDBusSignal(sig)
|
||||
@@ -129,7 +129,7 @@ func TestManager_HandlePropertiesChanged(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.DBus.Properties.PropertiesChanged",
|
||||
Body: []interface{}{
|
||||
Body: []any{
|
||||
"org.freedesktop.login1.Session",
|
||||
map[string]dbus.Variant{
|
||||
"Active": dbus.MakeVariant(true),
|
||||
@@ -155,7 +155,7 @@ func TestManager_HandlePropertiesChanged(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.DBus.Properties.PropertiesChanged",
|
||||
Body: []interface{}{
|
||||
Body: []any{
|
||||
"org.freedesktop.login1.Session",
|
||||
map[string]dbus.Variant{
|
||||
"IdleHint": dbus.MakeVariant(true),
|
||||
@@ -181,7 +181,7 @@ func TestManager_HandlePropertiesChanged(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.DBus.Properties.PropertiesChanged",
|
||||
Body: []interface{}{
|
||||
Body: []any{
|
||||
"org.freedesktop.login1.Session",
|
||||
map[string]dbus.Variant{
|
||||
"IdleSinceHint": dbus.MakeVariant(uint64(123456789)),
|
||||
@@ -208,7 +208,7 @@ func TestManager_HandlePropertiesChanged(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.DBus.Properties.PropertiesChanged",
|
||||
Body: []interface{}{
|
||||
Body: []any{
|
||||
"org.freedesktop.login1.Session",
|
||||
map[string]dbus.Variant{
|
||||
"LockedHint": dbus.MakeVariant(true),
|
||||
@@ -235,7 +235,7 @@ func TestManager_HandlePropertiesChanged(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.DBus.Properties.PropertiesChanged",
|
||||
Body: []interface{}{
|
||||
Body: []any{
|
||||
"org.freedesktop.SomeOtherInterface",
|
||||
map[string]dbus.Variant{
|
||||
"Active": dbus.MakeVariant(true),
|
||||
@@ -259,7 +259,7 @@ func TestManager_HandlePropertiesChanged(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.DBus.Properties.PropertiesChanged",
|
||||
Body: []interface{}{},
|
||||
Body: []any{},
|
||||
}
|
||||
|
||||
assert.NotPanics(t, func() {
|
||||
@@ -279,7 +279,7 @@ func TestManager_HandlePropertiesChanged(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.DBus.Properties.PropertiesChanged",
|
||||
Body: []interface{}{
|
||||
Body: []any{
|
||||
"org.freedesktop.login1.Session",
|
||||
map[string]dbus.Variant{
|
||||
"Active": dbus.MakeVariant(true),
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
type Response[T any] struct {
|
||||
|
||||
@@ -35,7 +35,7 @@ type Backend interface {
|
||||
ListVPNPlugins() ([]VPNPlugin, error)
|
||||
ImportVPN(filePath string, name string) (*VPNImportResult, error)
|
||||
GetVPNConfig(uuidOrName string) (*VPNConfig, error)
|
||||
UpdateVPNConfig(uuid string, updates map[string]interface{}) error
|
||||
UpdateVPNConfig(uuid string, updates map[string]any) error
|
||||
SetVPNCredentials(uuid string, username string, password string, save bool) error
|
||||
DeleteVPN(uuidOrName string) error
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ func (b *HybridIwdNetworkdBackend) GetVPNConfig(uuidOrName string) (*VPNConfig,
|
||||
return nil, fmt.Errorf("VPN not supported in hybrid mode")
|
||||
}
|
||||
|
||||
func (b *HybridIwdNetworkdBackend) UpdateVPNConfig(uuid string, updates map[string]interface{}) error {
|
||||
func (b *HybridIwdNetworkdBackend) UpdateVPNConfig(uuid string, updates map[string]any) error {
|
||||
return fmt.Errorf("VPN not supported in hybrid mode")
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ func (b *IWDBackend) GetVPNConfig(uuidOrName string) (*VPNConfig, error) {
|
||||
return nil, fmt.Errorf("VPN not supported by iwd backend")
|
||||
}
|
||||
|
||||
func (b *IWDBackend) UpdateVPNConfig(uuid string, updates map[string]interface{}) error {
|
||||
func (b *IWDBackend) UpdateVPNConfig(uuid string, updates map[string]any) error {
|
||||
return fmt.Errorf("VPN not supported by iwd backend")
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ func (b *SystemdNetworkdBackend) GetVPNConfig(uuidOrName string) (*VPNConfig, er
|
||||
return nil, fmt.Errorf("VPN not supported by networkd backend")
|
||||
}
|
||||
|
||||
func (b *SystemdNetworkdBackend) UpdateVPNConfig(uuid string, updates map[string]interface{}) error {
|
||||
func (b *SystemdNetworkdBackend) UpdateVPNConfig(uuid string, updates map[string]any) error {
|
||||
return fmt.Errorf("VPN not supported by networkd backend")
|
||||
}
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ type ethernetDeviceInfo struct {
|
||||
}
|
||||
|
||||
type NetworkManagerBackend struct {
|
||||
nmConn interface{}
|
||||
ethernetDevice interface{}
|
||||
nmConn any
|
||||
ethernetDevice any
|
||||
ethernetDevices map[string]*ethernetDeviceInfo
|
||||
wifiDevice interface{}
|
||||
settings interface{}
|
||||
wifiDev interface{}
|
||||
wifiDevice any
|
||||
settings any
|
||||
wifiDev any
|
||||
wifiDevices map[string]*wifiDeviceInfo
|
||||
|
||||
dbusConn *dbus.Conn
|
||||
|
||||
@@ -155,8 +155,8 @@ func (b *NetworkManagerBackend) ConnectEthernet() error {
|
||||
}
|
||||
}
|
||||
|
||||
settings := make(map[string]map[string]interface{})
|
||||
settings["connection"] = map[string]interface{}{
|
||||
settings := make(map[string]map[string]any)
|
||||
settings["connection"] = map[string]any{
|
||||
"id": "Wired connection",
|
||||
"type": "802-3-ethernet",
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestNetworkManagerBackend_HandleDBusSignal_NewConnection(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.NetworkManager.Settings.NewConnection",
|
||||
Body: []interface{}{"/org/freedesktop/NetworkManager/Settings/1"},
|
||||
Body: []any{"/org/freedesktop/NetworkManager/Settings/1"},
|
||||
}
|
||||
|
||||
assert.NotPanics(t, func() {
|
||||
@@ -33,7 +33,7 @@ func TestNetworkManagerBackend_HandleDBusSignal_ConnectionRemoved(t *testing.T)
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.NetworkManager.Settings.ConnectionRemoved",
|
||||
Body: []interface{}{"/org/freedesktop/NetworkManager/Settings/1"},
|
||||
Body: []any{"/org/freedesktop/NetworkManager/Settings/1"},
|
||||
}
|
||||
|
||||
assert.NotPanics(t, func() {
|
||||
@@ -49,7 +49,7 @@ func TestNetworkManagerBackend_HandleDBusSignal_InvalidBody(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.DBus.Properties.PropertiesChanged",
|
||||
Body: []interface{}{"only-one-element"},
|
||||
Body: []any{"only-one-element"},
|
||||
}
|
||||
|
||||
assert.NotPanics(t, func() {
|
||||
@@ -65,7 +65,7 @@ func TestNetworkManagerBackend_HandleDBusSignal_InvalidInterface(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.DBus.Properties.PropertiesChanged",
|
||||
Body: []interface{}{123, map[string]dbus.Variant{}},
|
||||
Body: []any{123, map[string]dbus.Variant{}},
|
||||
}
|
||||
|
||||
assert.NotPanics(t, func() {
|
||||
@@ -81,7 +81,7 @@ func TestNetworkManagerBackend_HandleDBusSignal_InvalidChanges(t *testing.T) {
|
||||
|
||||
sig := &dbus.Signal{
|
||||
Name: "org.freedesktop.DBus.Properties.PropertiesChanged",
|
||||
Body: []interface{}{dbusNMInterface, "not-a-map"},
|
||||
Body: []any{dbusNMInterface, "not-a-map"},
|
||||
}
|
||||
|
||||
assert.NotPanics(t, func() {
|
||||
@@ -137,7 +137,7 @@ func TestNetworkManagerBackend_HandleNetworkManagerChange_ActiveConnections(t *t
|
||||
mockNM.EXPECT().GetPropertyPrimaryConnection().Return(nil, nil).Maybe()
|
||||
|
||||
changes := map[string]dbus.Variant{
|
||||
"ActiveConnections": dbus.MakeVariant([]interface{}{}),
|
||||
"ActiveConnections": dbus.MakeVariant([]any{}),
|
||||
}
|
||||
|
||||
assert.NotPanics(t, func() {
|
||||
@@ -200,7 +200,7 @@ func TestNetworkManagerBackend_HandleWiFiChange_AccessPoints(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
changes := map[string]dbus.Variant{
|
||||
"AccessPoints": dbus.MakeVariant([]interface{}{}),
|
||||
"AccessPoints": dbus.MakeVariant([]any{}),
|
||||
}
|
||||
|
||||
assert.NotPanics(t, func() {
|
||||
|
||||
@@ -114,7 +114,7 @@ func (b *NetworkManagerBackend) getDeviceStateReason(dev gonetworkmanager.Device
|
||||
return 0
|
||||
}
|
||||
|
||||
if stateReasonStruct, ok := variant.Value().([]interface{}); ok && len(stateReasonStruct) >= 2 {
|
||||
if stateReasonStruct, ok := variant.Value().([]any); ok && len(stateReasonStruct) >= 2 {
|
||||
if reason, ok := stateReasonStruct[1].(uint32); ok {
|
||||
return reason
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ func (b *NetworkManagerBackend) ClearVPNCredentials(uuidOrName string) error {
|
||||
vpnSettings["password-flags"] = uint32(1)
|
||||
}
|
||||
|
||||
settings["vpn-secrets"] = make(map[string]interface{})
|
||||
settings["vpn-secrets"] = make(map[string]any)
|
||||
}
|
||||
|
||||
if err := conn.Update(settings); err != nil {
|
||||
@@ -1057,7 +1057,7 @@ func (b *NetworkManagerBackend) GetVPNConfig(uuidOrName string) (*VPNConfig, err
|
||||
return nil, fmt.Errorf("VPN connection not found: %s", uuidOrName)
|
||||
}
|
||||
|
||||
func (b *NetworkManagerBackend) UpdateVPNConfig(connUUID string, updates map[string]interface{}) error {
|
||||
func (b *NetworkManagerBackend) UpdateVPNConfig(connUUID string, updates map[string]any) error {
|
||||
s := b.settings
|
||||
if s == nil {
|
||||
var err error
|
||||
@@ -1103,7 +1103,7 @@ func (b *NetworkManagerBackend) UpdateVPNConfig(connUUID string, updates map[str
|
||||
connMeta["autoconnect"] = autoconnect
|
||||
}
|
||||
|
||||
if data, ok := updates["data"].(map[string]interface{}); ok {
|
||||
if data, ok := updates["data"].(map[string]any); ok {
|
||||
if vpnSettings, ok := settings["vpn"]; ok {
|
||||
existingData, _ := vpnSettings["data"].(map[string]string)
|
||||
if existingData == nil {
|
||||
@@ -1185,7 +1185,7 @@ func (b *NetworkManagerBackend) SetVPNCredentials(connUUID string, username stri
|
||||
|
||||
vpnSettings, ok := settings["vpn"]
|
||||
if !ok {
|
||||
vpnSettings = make(map[string]interface{})
|
||||
vpnSettings = make(map[string]any)
|
||||
settings["vpn"] = vpnSettings
|
||||
}
|
||||
|
||||
|
||||
@@ -555,19 +555,19 @@ func (b *NetworkManagerBackend) createAndConnectWiFiOnDevice(req ConnectionReque
|
||||
req.SSID, req.Interactive)
|
||||
}
|
||||
|
||||
settings := make(map[string]map[string]interface{})
|
||||
settings := make(map[string]map[string]any)
|
||||
|
||||
settings["connection"] = map[string]interface{}{
|
||||
settings["connection"] = map[string]any{
|
||||
"id": req.SSID,
|
||||
"type": "802-11-wireless",
|
||||
"autoconnect": true,
|
||||
}
|
||||
|
||||
settings["ipv4"] = map[string]interface{}{"method": "auto"}
|
||||
settings["ipv6"] = map[string]interface{}{"method": "auto"}
|
||||
settings["ipv4"] = map[string]any{"method": "auto"}
|
||||
settings["ipv6"] = map[string]any{"method": "auto"}
|
||||
|
||||
if secured {
|
||||
settings["802-11-wireless"] = map[string]interface{}{
|
||||
settings["802-11-wireless"] = map[string]any{
|
||||
"ssid": []byte(req.SSID),
|
||||
"mode": "infrastructure",
|
||||
"security": "802-11-wireless-security",
|
||||
@@ -575,7 +575,7 @@ func (b *NetworkManagerBackend) createAndConnectWiFiOnDevice(req ConnectionReque
|
||||
|
||||
switch {
|
||||
case isEnterprise || req.Username != "":
|
||||
settings["802-11-wireless-security"] = map[string]interface{}{
|
||||
settings["802-11-wireless-security"] = map[string]any{
|
||||
"key-mgmt": "wpa-eap",
|
||||
}
|
||||
|
||||
@@ -594,7 +594,7 @@ func (b *NetworkManagerBackend) createAndConnectWiFiOnDevice(req ConnectionReque
|
||||
useSystemCACerts = *req.UseSystemCACerts
|
||||
}
|
||||
|
||||
x := map[string]interface{}{
|
||||
x := map[string]any{
|
||||
"eap": []string{eapMethod},
|
||||
"system-ca-certs": useSystemCACerts,
|
||||
"password-flags": uint32(0),
|
||||
@@ -634,7 +634,7 @@ func (b *NetworkManagerBackend) createAndConnectWiFiOnDevice(req ConnectionReque
|
||||
eapMethod, phase2Auth, req.Username, req.Interactive, useSystemCACerts, req.DomainSuffixMatch)
|
||||
|
||||
case isPsk:
|
||||
sec := map[string]interface{}{
|
||||
sec := map[string]any{
|
||||
"key-mgmt": "wpa-psk",
|
||||
"psk-flags": uint32(0),
|
||||
}
|
||||
@@ -644,7 +644,7 @@ func (b *NetworkManagerBackend) createAndConnectWiFiOnDevice(req ConnectionReque
|
||||
settings["802-11-wireless-security"] = sec
|
||||
|
||||
case isSae:
|
||||
sec := map[string]interface{}{
|
||||
sec := map[string]any{
|
||||
"key-mgmt": "sae",
|
||||
"pmf": int32(3),
|
||||
"psk-flags": uint32(0),
|
||||
@@ -658,7 +658,7 @@ func (b *NetworkManagerBackend) createAndConnectWiFiOnDevice(req ConnectionReque
|
||||
return fmt.Errorf("secured network but not SAE/PSK/802.1X (rsn=0x%x wpa=0x%x)", rsnFlags, wpaFlags)
|
||||
}
|
||||
} else {
|
||||
settings["802-11-wireless"] = map[string]interface{}{
|
||||
settings["802-11-wireless"] = map[string]any{
|
||||
"ssid": []byte(req.SSID),
|
||||
"mode": "infrastructure",
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
type SuccessResult struct {
|
||||
@@ -97,7 +97,7 @@ func handleCredentialsSubmit(conn net.Conn, req Request, manager *Manager) {
|
||||
return
|
||||
}
|
||||
|
||||
secretsRaw, ok := req.Params["secrets"].(map[string]interface{})
|
||||
secretsRaw, ok := req.Params["secrets"].(map[string]any)
|
||||
if !ok {
|
||||
log.Warnf("handleCredentialsSubmit: missing or invalid secrets parameter")
|
||||
models.RespondError(conn, req.ID, "missing or invalid 'secrets' parameter")
|
||||
@@ -603,7 +603,7 @@ func handleUpdateVPNConfig(conn net.Conn, req Request, manager *Manager) {
|
||||
return
|
||||
}
|
||||
|
||||
updates := make(map[string]interface{})
|
||||
updates := make(map[string]any)
|
||||
|
||||
if name, ok := req.Params["name"].(string); ok {
|
||||
updates["name"] = name
|
||||
@@ -611,7 +611,7 @@ func handleUpdateVPNConfig(conn net.Conn, req Request, manager *Manager) {
|
||||
if autoconnect, ok := req.Params["autoconnect"].(bool); ok {
|
||||
updates["autoconnect"] = autoconnect
|
||||
}
|
||||
if data, ok := req.Params["data"].(map[string]interface{}); ok {
|
||||
if data, ok := req.Params["data"].(map[string]any); ok {
|
||||
updates["data"] = data
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ func TestHandleConnectWiFi(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "network.wifi.connect",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleConnectWiFi(conn, req, manager)
|
||||
@@ -152,7 +152,7 @@ func TestHandleSetPreference(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "network.preference.set",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleSetPreference(conn, req, manager)
|
||||
@@ -176,7 +176,7 @@ func TestHandleGetNetworkInfo(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 123,
|
||||
Method: "network.info",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleGetNetworkInfo(conn, req, manager)
|
||||
|
||||
@@ -554,7 +554,7 @@ func (m *Manager) GetVPNConfig(uuidOrName string) (*VPNConfig, error) {
|
||||
return m.backend.GetVPNConfig(uuidOrName)
|
||||
}
|
||||
|
||||
func (m *Manager) UpdateVPNConfig(uuid string, updates map[string]interface{}) error {
|
||||
func (m *Manager) UpdateVPNConfig(uuid string, updates map[string]any) error {
|
||||
return m.backend.UpdateVPNConfig(uuid, updates)
|
||||
}
|
||||
|
||||
|
||||
@@ -94,14 +94,14 @@ func (m *Manager) setConnectionMetrics(connType string, metric uint32) error {
|
||||
if connMeta, ok := connSettings["connection"]; ok {
|
||||
if cType, ok := connMeta["type"].(string); ok && cType == connType {
|
||||
if connSettings["ipv4"] == nil {
|
||||
connSettings["ipv4"] = make(map[string]interface{})
|
||||
connSettings["ipv4"] = make(map[string]any)
|
||||
}
|
||||
if ipv4Map := connSettings["ipv4"]; ipv4Map != nil {
|
||||
ipv4Map["route-metric"] = int64(metric)
|
||||
}
|
||||
|
||||
if connSettings["ipv6"] == nil {
|
||||
connSettings["ipv6"] = make(map[string]interface{})
|
||||
connSettings["ipv6"] = make(map[string]any)
|
||||
}
|
||||
if ipv6Map := connSettings["ipv6"]; ipv6Map != nil {
|
||||
ipv6Map["route-metric"] = int64(metric)
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestHandleList(t *testing.T) {
|
||||
req := models.Request{
|
||||
ID: 123,
|
||||
Method: "plugins.list",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
HandleList(conn, req)
|
||||
@@ -30,7 +30,7 @@ func TestHandleListInstalled(t *testing.T) {
|
||||
req := models.Request{
|
||||
ID: 123,
|
||||
Method: "plugins.listInstalled",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
HandleListInstalled(conn, req)
|
||||
@@ -47,7 +47,7 @@ func TestHandleInstallMissingName(t *testing.T) {
|
||||
req := models.Request{
|
||||
ID: 123,
|
||||
Method: "plugins.install",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
HandleInstall(conn, req)
|
||||
@@ -70,7 +70,7 @@ func TestHandleInstallInvalidName(t *testing.T) {
|
||||
req := models.Request{
|
||||
ID: 123,
|
||||
Method: "plugins.install",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"name": 123,
|
||||
},
|
||||
}
|
||||
@@ -94,7 +94,7 @@ func TestHandleUninstallMissingName(t *testing.T) {
|
||||
req := models.Request{
|
||||
ID: 123,
|
||||
Method: "plugins.uninstall",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
HandleUninstall(conn, req)
|
||||
@@ -116,7 +116,7 @@ func TestHandleUpdateMissingName(t *testing.T) {
|
||||
req := models.Request{
|
||||
ID: 123,
|
||||
Method: "plugins.update",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
HandleUpdate(conn, req)
|
||||
@@ -138,7 +138,7 @@ func TestHandleSearchMissingQuery(t *testing.T) {
|
||||
req := models.Request{
|
||||
ID: 123,
|
||||
Method: "plugins.search",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
HandleSearch(conn, req)
|
||||
|
||||
@@ -47,8 +47,8 @@ type ServerInfo struct {
|
||||
}
|
||||
|
||||
type ServiceEvent struct {
|
||||
Service string `json:"service"`
|
||||
Data interface{} `json:"data"`
|
||||
Service string `json:"service"`
|
||||
Data any `json:"data"`
|
||||
}
|
||||
|
||||
var networkManager *network.Manager
|
||||
@@ -485,7 +485,7 @@ func handleSubscribe(conn net.Conn, req models.Request) {
|
||||
clientID := fmt.Sprintf("meta-client-%p", conn)
|
||||
|
||||
var services []string
|
||||
if servicesParam, ok := req.Params["services"].([]interface{}); ok {
|
||||
if servicesParam, ok := req.Params["services"].([]any); ok {
|
||||
for _, s := range servicesParam {
|
||||
if str, ok := s.(string); ok {
|
||||
services = append(services, str)
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
type SuccessResult struct {
|
||||
|
||||
@@ -47,7 +47,7 @@ type Manager struct {
|
||||
display *wlclient.Display
|
||||
ctx *wlclient.Context
|
||||
registry *wlclient.Registry
|
||||
gammaControl interface{}
|
||||
gammaControl any
|
||||
availableOutputs []*wlclient.Output
|
||||
outputRegNames syncmap.Map[uint32, uint32]
|
||||
outputs syncmap.Map[uint32, *outputState]
|
||||
@@ -83,7 +83,7 @@ type outputState struct {
|
||||
name string
|
||||
registryName uint32
|
||||
output *wlclient.Output
|
||||
gammaControl interface{}
|
||||
gammaControl any
|
||||
rampSize uint32
|
||||
failed bool
|
||||
isVirtual bool
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
type SuccessResult struct {
|
||||
|
||||
Reference in New Issue
Block a user