34 lines
593 B
Go
34 lines
593 B
Go
package ksrv
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"kumoly.io/core/log"
|
|
)
|
|
|
|
type kserver struct {
|
|
http.Server
|
|
l *log.Logger
|
|
}
|
|
|
|
// Listen to addr
|
|
func (s *kserver) Listen(addr string) *kserver {
|
|
s.Addr = addr
|
|
return s
|
|
}
|
|
|
|
// Serve alias to ListenAndServe
|
|
func (s *kserver) Serve() error {
|
|
return s.ListenAndServe()
|
|
}
|
|
|
|
func (s *kserver) ListenAndServe() error {
|
|
s.Handler = s.Middleware(s.Handler)
|
|
return s.Server.ListenAndServe()
|
|
}
|
|
|
|
func (s *kserver) ListenAndServeTLS(certFile string, keyFile string) error {
|
|
s.Handler = s.Middleware(s.Handler)
|
|
return s.Server.ListenAndServeTLS(certFile, keyFile)
|
|
}
|