xnet_unix.go 503 B

123456789101112131415161718192021
  1. //go:build !windows
  2. // +build !windows
  3. package xnet
  4. import (
  5. "net"
  6. "time"
  7. )
  8. // ListenLocal opens a local socket for control communication
  9. func ListenLocal(socket string) (net.Listener, error) {
  10. // on unix it's just a unix socket
  11. return net.Listen("unix", socket)
  12. }
  13. // DialTimeoutLocal is a DialTimeout function for local sockets
  14. func DialTimeoutLocal(socket string, timeout time.Duration) (net.Conn, error) {
  15. // on unix, we dial a unix socket
  16. return net.DialTimeout("unix", socket, timeout)
  17. }