mirror of
https://github.com/hacdias/webdav.git
synced 2026-09-25 20:51:53 +08:00
feat: add support for unix sockets (#58)
This commit is contained in:
+11
-3
@@ -53,9 +53,17 @@ set WD_CERT.`,
|
|||||||
|
|
||||||
cfg := readConfig(flags)
|
cfg := readConfig(flags)
|
||||||
|
|
||||||
// Builds the address and a listener.
|
// Build address and listener
|
||||||
laddr := getOpt(flags, "address") + ":" + getOpt(flags, "port")
|
laddr := getOpt(flags, "address")
|
||||||
listener, err := net.Listen("tcp", laddr)
|
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 {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user