mirror of
https://github.com/speatzle/nfsense.git
synced 2025-09-13 15:19:08 +00:00
Add dbus Test
This commit is contained in:
parent
a737ac4d9d
commit
f01ea3fdb7
7 changed files with 106 additions and 56 deletions
|
@ -5,8 +5,23 @@ import (
|
|||
"fmt"
|
||||
|
||||
"nfsense.net/nfsense/internal/definitions"
|
||||
"nfsense.net/nfsense/internal/networkd/dbus"
|
||||
)
|
||||
|
||||
type GetLinksResult struct {
|
||||
Links []dbus.Link
|
||||
}
|
||||
|
||||
func (f *Network) GetLinks(ctx context.Context, params struct{}) (GetLinksResult, error) {
|
||||
links, err := dbus.GetLinks(*f.DbusConn)
|
||||
if err != nil {
|
||||
return GetLinksResult{}, fmt.Errorf("Getting Links: %w", err)
|
||||
}
|
||||
return GetLinksResult{
|
||||
Links: links,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type GetInterfacesResult struct {
|
||||
Interfaces map[string]definitions.Interface
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package network
|
||||
|
||||
import "nfsense.net/nfsense/internal/config"
|
||||
import (
|
||||
"github.com/godbus/dbus/v5"
|
||||
"nfsense.net/nfsense/internal/config"
|
||||
)
|
||||
|
||||
type Network struct {
|
||||
ConfigManager *config.ConfigManager
|
||||
DbusConn *dbus.Conn
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue