add configurable VRF interface and user-timeout (#17108)

This commit is contained in:
Harshavardhana
2023-05-03 14:12:25 -07:00
committed by GitHub
parent 90e2cc3d4c
commit 9571b0825e
16 changed files with 258 additions and 152 deletions

View File

@@ -61,6 +61,7 @@ const (
type Server struct {
http.Server
Addrs []string // addresses on which the server listens for new connection.
TCPOptions TCPOptions // all the configurable TCP conn specific configurable options.
ShutdownTimeout time.Duration // timeout used for graceful server shutdown.
listenerMutex sync.Mutex // to guard 'listener' field.
listener *httpListener // HTTP listener for all 'Addrs' field.
@@ -87,6 +88,7 @@ func (srv *Server) Start(ctx context.Context) (err error) {
listener, err = newHTTPListener(
ctx,
srv.Addrs,
srv.TCPOptions,
)
if err != nil {
return err
@@ -213,6 +215,12 @@ func (srv *Server) UseCustomLogger(l *log.Logger) *Server {
return srv
}
// UseTCPOptions use custom TCP options on raw socket
func (srv *Server) UseTCPOptions(opts TCPOptions) *Server {
srv.TCPOptions = opts
return srv
}
// NewServer - creates new HTTP server using given arguments.
func NewServer(addrs []string) *Server {
httpServer := &Server{