mirror of
https://github.com/0x1d/rcond.git
synced 2025-12-14 18:25:21 +01:00
feat: check if network connection already exists when adding a new one, update docs
This commit is contained in:
@@ -237,6 +237,12 @@ func AddStationConnection(conn *dbus.Conn, uuid uuid.UUID, ssid string, password
|
||||
// Returns the D-Bus object path of the new connection profile.
|
||||
// Returns an error if the connection creation fails.
|
||||
func AddConnectionWithConfig(conn *dbus.Conn, cfg *ConnectionConfig) (dbus.ObjectPath, error) {
|
||||
|
||||
// check of connection already exists and return existing connection path
|
||||
if existingObjectPath, err := GetConnectionPath(conn, cfg.UUID); err == nil {
|
||||
return existingObjectPath, nil
|
||||
}
|
||||
|
||||
settingsObj := conn.Object(
|
||||
"org.freedesktop.NetworkManager",
|
||||
"/org/freedesktop/NetworkManager/Settings",
|
||||
|
||||
Reference in New Issue
Block a user