socket_unix.go 355 B

12345678910111213141516
  1. // +build !windows
  2. package server
  3. import (
  4. "errors"
  5. "net"
  6. "strings"
  7. )
  8. func createLocalListener(address string) (net.Listener, error) {
  9. if !strings.HasPrefix(address, "unix://") {
  10. return nil, errors.New("Cannot parse address, must start with unix:// or tcp:// : " + address)
  11. }
  12. return net.Listen("unix", strings.TrimPrefix(address, "unix://"))
  13. }