mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Make internal SSH server host key path configurable (#14918)
* Make SSH server host key path configurable * make it possible to have multiple keys * Make gitea.rsa the default key * Add some more logging Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		@@ -9,8 +9,8 @@ import (
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func newHTTPServer(network, address string, handler http.Handler) (*Server, ServeFunction) {
 | 
			
		||||
	server := NewServer(network, address)
 | 
			
		||||
func newHTTPServer(network, address, name string, handler http.Handler) (*Server, ServeFunction) {
 | 
			
		||||
	server := NewServer(network, address, name)
 | 
			
		||||
	httpServer := http.Server{
 | 
			
		||||
		ReadTimeout:    DefaultReadTimeOut,
 | 
			
		||||
		WriteTimeout:   DefaultWriteTimeOut,
 | 
			
		||||
@@ -25,21 +25,21 @@ func newHTTPServer(network, address string, handler http.Handler) (*Server, Serv
 | 
			
		||||
 | 
			
		||||
// HTTPListenAndServe listens on the provided network address and then calls Serve
 | 
			
		||||
// to handle requests on incoming connections.
 | 
			
		||||
func HTTPListenAndServe(network, address string, handler http.Handler) error {
 | 
			
		||||
	server, lHandler := newHTTPServer(network, address, handler)
 | 
			
		||||
func HTTPListenAndServe(network, address, name string, handler http.Handler) error {
 | 
			
		||||
	server, lHandler := newHTTPServer(network, address, name, handler)
 | 
			
		||||
	return server.ListenAndServe(lHandler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// HTTPListenAndServeTLS listens on the provided network address and then calls Serve
 | 
			
		||||
// to handle requests on incoming connections.
 | 
			
		||||
func HTTPListenAndServeTLS(network, address, certFile, keyFile string, handler http.Handler) error {
 | 
			
		||||
	server, lHandler := newHTTPServer(network, address, handler)
 | 
			
		||||
func HTTPListenAndServeTLS(network, address, name, certFile, keyFile string, handler http.Handler) error {
 | 
			
		||||
	server, lHandler := newHTTPServer(network, address, name, handler)
 | 
			
		||||
	return server.ListenAndServeTLS(certFile, keyFile, lHandler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// HTTPListenAndServeTLSConfig listens on the provided network address and then calls Serve
 | 
			
		||||
// to handle requests on incoming connections.
 | 
			
		||||
func HTTPListenAndServeTLSConfig(network, address string, tlsConfig *tls.Config, handler http.Handler) error {
 | 
			
		||||
	server, lHandler := newHTTPServer(network, address, handler)
 | 
			
		||||
func HTTPListenAndServeTLSConfig(network, address, name string, tlsConfig *tls.Config, handler http.Handler) error {
 | 
			
		||||
	server, lHandler := newHTTPServer(network, address, name, handler)
 | 
			
		||||
	return server.ListenAndServeTLSConfig(tlsConfig, lHandler)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user