add tls
All checks were successful
Build Multi-Platform Binaries / build (push) Successful in 11m8s

This commit is contained in:
Flik
2025-12-26 00:00:29 +08:00
parent f1038a132b
commit 1870b59214
6 changed files with 80 additions and 36 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/gotunnel/internal/server/config"
"github.com/gotunnel/internal/server/db"
"github.com/gotunnel/internal/server/tunnel"
"github.com/gotunnel/pkg/crypto"
)
func main() {
@@ -38,6 +39,16 @@ func main() {
cfg.Server.HeartbeatTimeout,
)
// 配置 TLS默认启用
if !cfg.Server.TLSDisabled {
tlsConfig, err := crypto.GenerateTLSConfig()
if err != nil {
log.Fatalf("Generate TLS config error: %v", err)
}
server.SetTLSConfig(tlsConfig)
log.Printf("[Server] TLS enabled")
}
// 启动 Web 控制台
if cfg.Web.Enabled {
ws := app.NewWebServer(clientStore, server, cfg, *configPath)