2 Commits
v0.5.0 ... main

Author SHA1 Message Date
80808310ce Make sure the library compiles for windows
systemd sockets are not applicable for windows. However compilation
should not fail on windows
2025-07-17 20:53:10 -04:00
97b73fb442 remove binary from git 2025-02-03 11:35:06 -05:00
4 changed files with 29 additions and 11 deletions

View File

@@ -13,7 +13,6 @@ import (
"strconv"
"strings"
"sync"
"syscall"
"time"
"go.balki.me/anyhttp/idle"
@@ -150,16 +149,6 @@ func (u *UnixSocketConfig) GetListener() (net.Listener, error) {
// StartFD is the starting file descriptor number
const StartFD = 3
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
}
// GetListener returns the FileListener created with socketed activated fd
func (s *SysdConfig) GetListener() (net.Listener, error) {

Binary file not shown.

19
fd_unix.go Normal file
View File

@@ -0,0 +1,19 @@
//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
}

10
fd_windows.go Normal file
View File

@@ -0,0 +1,10 @@
package anyhttp
import (
"errors"
"net"
)
func makeFdListener(fd int, name string) (net.Listener, error) {
return nil, errors.New("windows not supported")
}