mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 06:10:54 +03:00
httpd: allow to use proxy protocol
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -589,7 +589,10 @@ func GenerateUniqueID() string {
|
||||
|
||||
// HTTPListenAndServe is a wrapper for ListenAndServe that support both tcp
|
||||
// and Unix-domain sockets
|
||||
func HTTPListenAndServe(srv *http.Server, address string, port int, isTLS bool, logSender string) error {
|
||||
func HTTPListenAndServe(srv *http.Server, address string, port int, isTLS bool,
|
||||
listenerWrapper func(net.Listener) (net.Listener, error),
|
||||
logSender string,
|
||||
) error {
|
||||
var listener net.Listener
|
||||
var err error
|
||||
|
||||
@@ -617,7 +620,12 @@ func HTTPListenAndServe(srv *http.Server, address string, port int, isTLS bool,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if listenerWrapper != nil {
|
||||
listener, err = listenerWrapper(listener)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
logger.Info(logSender, "", "server listener registered, address: %s TLS enabled: %t", listener.Addr().String(), isTLS)
|
||||
|
||||
defer listener.Close()
|
||||
|
||||
Reference in New Issue
Block a user