Skip to content

Commit

Permalink
feat: add support for unix sockets (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikitsu authored Dec 17, 2020
1 parent da6dd25 commit fca4e54
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,17 @@ set WD_CERT.`,

cfg := readConfig(flags)

// Builds the address and a listener.
laddr := getOpt(flags, "address") + ":" + getOpt(flags, "port")
listener, err := net.Listen("tcp", laddr)
// Build address and listener
laddr := getOpt(flags, "address")
var lnet string
if strings.HasPrefix(laddr, "unix:") {
laddr = laddr[5:]
lnet = "unix"
} else {
laddr = laddr + ":" + getOpt(flags, "port")
lnet = "tcp"
}
listener, err := net.Listen(lnet, laddr)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit fca4e54

Please sign in to comment.