This repository has been archived on 2025-03-19. You can view files and clone it, but cannot push or open issues or pull requests.
gonetworkmanager/VpnConnection.go
Christian Müller 41ad7838fe Add VpnConnection
Update ActivateConnection to support empty Device
Add ActivateConnection specific object (BREAKING CHANGE)
2020-07-31 16:13:01 +02:00

45 lines
1.1 KiB
Go

package gonetworkmanager
import (
"github.com/godbus/dbus/v5"
)
const (
VpnConnectionInterface = NetworkManagerInterface + ".VPN.Connection"
/* Properties */
VpnConnectionPropertyVpnState = VpnConnectionInterface + ".VpnState" // readable u
VpnConnectionPropertyBanner = VpnConnectionInterface + ".Banner" // readable s
)
type VpnConnection interface {
GetPath() dbus.ObjectPath
// The VPN-specific state of the connection.
GetPropertyVpnState() (NmVpnConnectionState, error)
// The banner string of the VPN connection.
GetPropertyBanner() (string, error)
}
func NewVpnConnection(objectPath dbus.ObjectPath) (VpnConnection, error) {
var a vpnConnection
return &a, a.init(NetworkManagerInterface, objectPath)
}
type vpnConnection struct {
dbusBase
}
func (a *vpnConnection) GetPath() dbus.ObjectPath {
return a.obj.Path()
}
func (a *vpnConnection) GetPropertyVpnState() (NmVpnConnectionState, error) {
v, err := a.getUint32Property(VpnConnectionPropertyVpnState)
return NmVpnConnectionState(v), err
}
func (a *vpnConnection) GetPropertyBanner() (string, error) {
return a.getStringProperty(VpnConnectionPropertyBanner)
}