Merge pull request #811 from HynoR/master

Add hysteria listening address logging output when starting up
This commit is contained in:
Toby 2023-11-10 18:05:46 -08:00 committed by GitHub
commit 9940ea9dd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,6 +29,10 @@ import (
"github.com/apernet/hysteria/extras/trafficlogger"
)
const (
defaultListenAddr = ":443"
)
var serverCmd = &cobra.Command{
Use: "server",
Short: "Server mode",
@ -208,7 +212,7 @@ type serverConfigMasquerade struct {
func (c *serverConfig) fillConn(hyConfig *server.Config) error {
listenAddr := c.Listen
if listenAddr == "" {
listenAddr = ":443"
listenAddr = defaultListenAddr
}
uAddr, err := net.ResolveUDPAddr("udp", listenAddr)
if err != nil {
@ -729,7 +733,11 @@ func runServer(cmd *cobra.Command, args []string) {
if err != nil {
logger.Fatal("failed to initialize server", zap.Error(err))
}
logger.Info("server up and running")
if config.Listen != "" {
logger.Info("server up and running", zap.String("listen", config.Listen))
} else {
logger.Info("server up and running", zap.String("listen", defaultListenAddr))
}
if !disableUpdateCheck {
go runCheckUpdateServer()