Sha256: 07fbb65cbb990c0fca3ae610e1518cb633c8daa8386ed0ba511e5c09ea1bc4cf

Contents?: true

Size: 797 Bytes

Versions: 16

Compression:

Stored size: 797 Bytes

Contents

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)
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/godbus/dbus/transport_tcp.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/godbus/dbus/transport_tcp.go