github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/juju/sockets/sockets_windows.go (about) 1 // Copyright 2014 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package sockets 5 6 import ( 7 "net" 8 "net/rpc" 9 10 "github.com/juju/errors" 11 "gopkg.in/natefinch/npipe.v2" 12 ) 13 14 func Dial(socketPath string) (*rpc.Client, error) { 15 conn, err := npipe.Dial(socketPath) 16 return rpc.NewClient(conn), errors.Trace(err) 17 } 18 19 func Listen(socketPath string) (net.Listener, error) { 20 listener, err := npipe.Listen(socketPath) 21 return listener, errors.Trace(err) 22 }