vendor: Add github.com/godbus/dbus

Signed-off-by: Michal Rostecki <mrostecki@suse.com>
This commit is contained in:
Michal Rostecki
2018-02-06 17:27:38 +01:00
committed by Michael Cambria
parent d096a4df48
commit eb66fc201c
37 changed files with 5753 additions and 0 deletions

43
vendor/github.com/godbus/dbus/transport_tcp.go generated vendored Normal file
View File

@ -0,0 +1,43 @@
//+build !windows
package dbus
import (
"errors"
"net"
)
func init() {
transports["tcp"] = newTcpTransport
}
func tcpFamily(keys string) (string, error) {
switch getKey(keys, "family") {
case "":
return "tcp", nil
case "ipv4":
return "tcp4", nil
case "ipv6":
return "tcp6", nil
default:
return "", errors.New("dbus: invalid tcp family (must be ipv4 or ipv6)")
}
}
func newTcpTransport(keys string) (transport, error) {
host := getKey(keys, "host")
port := getKey(keys, "port")
if host == "" || port == "" {
return nil, errors.New("dbus: unsupported address (must set host and port)")
}
protocol, err := tcpFamily(keys)
if err != nil {
return nil, err
}
socket, err := net.Dial(protocol, net.JoinHostPort(host, port))
if err != nil {
return nil, err
}
return NewConn(socket)
}