MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / serveWeb

Method serveWeb

pkg/component/web.go:128–144  ·  view source on GitHub ↗
(lis net.Listener)

Source from the content-addressed store, hash-verified

126}
127
128func (c *Component) serveWeb(lis net.Listener) error {
129 var handler http.Handler = c
130 if _, isTCP := lis.(*net.TCPListener); isTCP {
131 handler = h2c.NewHandler(c, &http2.Server{})
132 }
133 srv := http.Server{
134 Handler: handler,
135 ReadTimeout: 120 * time.Second,
136 ReadHeaderTimeout: 5 * time.Second,
137 ErrorLog: log.New(io.Discard, "", 0),
138 }
139 go func() {
140 <-c.Context().Done()
141 srv.Close()
142 }()
143 return srv.Serve(lis)
144}
145
146func (c *Component) webEndpoints() []Endpoint {
147 return []Endpoint{

Callers

nothing calls this directly

Implementers 1

Componentpkg/component/component.go

Calls 5

ContextMethod · 0.95
DoneMethod · 0.80
ServeMethod · 0.80
NewMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected