1
// Copyright 2014 Canonical Ltd.
2
// Copyright 2014 Cloudbase Solutions SRL
3
// Licensed under the AGPLv3, see LICENCE file for details.
14
"github.com/juju/errors"
17
func Dial(socketPath string) (*rpc.Client, error) {
18
return rpc.Dial("unix", socketPath)
21
func Listen(socketPath string) (net.Listener, error) {
22
// In case the unix socket is present, delete it.
23
if err := os.Remove(socketPath); err != nil {
24
logger.Tracef("ignoring error on removing %q: %v", socketPath, err)
26
listener, err := net.Listen("unix", socketPath)
27
return listener, errors.Trace(err)