Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
github.com/luisguillenc/serverd
Package serverd provides a component to create server-type applications, helping to manage the life cycle of services and operating system signals.
It allows:
See this simple example:
package main
import (
"context"
"log"
"net"
"net/http"
"github.com/luisguillenc/serverd"
"github.com/sirupsen/logrus"
)
func main() {
// init logger
logger := logrus.New()
logger.SetLevel(logrus.DebugLevel)
// creates serverd manager
srv := serverd.New(serverd.SetLogger(logger))
// creates first service
lis1, err := net.Listen("tcp", "127.0.0.1:8111")
if err != nil {
log.Fatalf("listening: %v", err)
}
http1 := &http.Server{}
// register first service
srv.Register(serverd.Service{
Name: "http1",
Start: func() error {
go http1.Serve(lis1)
return nil
},
Shutdown: func() { http1.Shutdown(context.Background()) },
})
// creates second service
lis2, err := net.Listen("tcp", "127.0.0.1:8112")
if err != nil {
log.Fatalf("listening: %v", err)
}
http2 := &http.Server{}
// register second service
srv.Register(serverd.Service{
Name: "http2",
Start: func() error {
go http2.Serve(lis2)
return nil
},
Shutdown: func() { http2.Shutdown(context.Background()) },
})
// run server
err = srv.Run()
if err != nil {
logger.Fatal(err)
}
}
Output with ctr+c:
$ go run main.go
INFO[0000] starting services
DEBU[0000] starting service http1
DEBU[0000] starting service http2
^CINFO[0003] shutting down services
DEBU[0003] shutting down service http2
DEBU[0003] shutting down service http1
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.