github.com/searKing/golang/go@v1.2.117/net/mux/server.option.go (about)

     1  // Copyright 2020 The searKing Author. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package mux
     6  
     7  import "log"
     8  
     9  // WithMaxIdleConns controls the maximum number of idle (keep-alive)
    10  // connections across all hosts. Zero means no limit.
    11  func WithMaxIdleConns(maxIdleConns int) ServerOption {
    12  	return ServerOptionFunc(func(c *Server) {
    13  		c.maxIdleConns = maxIdleConns
    14  	})
    15  }
    16  
    17  // WithErrorLog specifies an optional logger for errors
    18  func WithErrorLog(errorLog *log.Logger) ServerOption {
    19  	return ServerOptionFunc(func(c *Server) {
    20  		c.errorLog = errorLog
    21  	})
    22  }