systemd sockets are not applicable for windows. However compilation should not fail on windows
20 lines
292 B
Go
20 lines
292 B
Go
//go:build unix
|
|
|
|
package anyhttp
|
|
|
|
import (
|
|
"net"
|
|
"os"
|
|
"syscall"
|
|
)
|
|
|
|
func makeFdListener(fd int, name string) (net.Listener, error) {
|
|
fdFile := os.NewFile(uintptr(fd), name)
|
|
l, err := net.FileListener(fdFile)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
syscall.CloseOnExec(fd)
|
|
return l, nil
|
|
}
|