|
|
@ -4,7 +4,6 @@ import (
|
|
|
|
"crypto/tls"
|
|
|
|
"crypto/tls"
|
|
|
|
"encoding/gob"
|
|
|
|
"encoding/gob"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"net"
|
|
|
|
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"path"
|
|
|
|
"path"
|
|
|
@ -71,16 +70,14 @@ func Start() {
|
|
|
|
server.TLSConfig = &tls.Config{
|
|
|
|
server.TLSConfig = &tls.Config{
|
|
|
|
Certificates: []tls.Certificate{cert},
|
|
|
|
Certificates: []tls.Certificate{cert},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.LOG.Infof("listen at https://%s:%s [%s]", global.CONF.System.BindAddress, global.CONF.System.Port, tcpItem)
|
|
|
|
global.LOG.Infof("listen at %s:%s [%s]", global.CONF.System.BindAddress, global.CONF.System.Port, tcpItem)
|
|
|
|
if err := server.ListenAndServeTLS("", ""); err != nil {
|
|
|
|
ln, err := net.Listen(tcpItem, global.CONF.System.BindAddress+":"+global.CONF.System.Port)
|
|
|
|
panic(err)
|
|
|
|
if err != nil {
|
|
|
|
}
|
|
|
|
panic(err)
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
global.LOG.Infof("listen at http://%s:%s [%s]", global.CONF.System.BindAddress, global.CONF.System.Port, tcpItem)
|
|
|
|
type tcpKeepAliveListener struct {
|
|
|
|
if err := server.ListenAndServe(); err != nil {
|
|
|
|
*net.TCPListener
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if err := server.Serve(tcpKeepAliveListener{ln.(*net.TCPListener)}); err != nil {
|
|
|
|
|
|
|
|
panic(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|