version 2.0.0
This commit is contained in:
parent
108583814e
commit
de6a48c088
10 changed files with 84 additions and 108 deletions
|
|
@ -2,28 +2,27 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"git.giftfish.de/ston1th/godrop"
|
||||
"git.giftfish.de/ston1th/godrop/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cfg := godrop.Config{
|
||||
User: "nobody",
|
||||
Group: "nobody",
|
||||
Foreground: true,
|
||||
User: "nobody",
|
||||
Group: "nobody",
|
||||
}
|
||||
err := godrop.Drop(cfg, func() (net.Listener, error) { return net.Listen("tcp", ":80") })
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
l, err := godrop.GetListener()
|
||||
if err != nil {
|
||||
fmt.Println("Failed to listen on FD 3:", err)
|
||||
os.Exit(1)
|
||||
log.Fatal("Failed to listen on FD 3:", err)
|
||||
}
|
||||
_, port, _ := net.SplitHostPort(l.Addr().String())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue