Ok forget http/3

Signed-off-by: arzumify <jliwin98@danwin1210.de>
This commit is contained in:
Tracker-Friendly 2024-11-03 15:33:12 +00:00
parent dac060cee5
commit 3114dd556e
1 changed files with 14 additions and 36 deletions

22
main.go
View File

@ -28,7 +28,6 @@ import (
"github.com/go-playground/validator/v10" "github.com/go-playground/validator/v10"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/klauspost/compress/zstd" "github.com/klauspost/compress/zstd"
"github.com/quic-go/quic-go/http3"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
_ "github.com/lib/pq" _ "github.com/lib/pq"
@ -50,7 +49,6 @@ type Config struct {
CertificatePath string `yaml:"certificate" validate:"required"` CertificatePath string `yaml:"certificate" validate:"required"`
KeyPath string `yaml:"key" validate:"required"` KeyPath string `yaml:"key" validate:"required"`
} `yaml:"https"` } `yaml:"https"`
EnableHTTP3 bool `yaml:"enableHTTP3"`
Logging struct { Logging struct {
Enabled bool `yaml:"enabled"` Enabled bool `yaml:"enabled"`
File string `yaml:"file" validate:"required_if=Enabled true"` File string `yaml:"file" validate:"required_if=Enabled true"`
@ -150,11 +148,7 @@ func serverChanger(next http.Handler) http.Handler {
if !config.Global.Stealth.Enabled { if !config.Global.Stealth.Enabled {
w.Header().Set("Server", "Fulgens HTTP Server") w.Header().Set("Server", "Fulgens HTTP Server")
w.Header().Set("X-Powered-By", "Go net/http") w.Header().Set("X-Powered-By", "Go net/http")
if config.Global.EnableHTTP3 {
w.Header().Set("Alt-Svc", "Alt-Svc: h2=\":443\"; h3=\":443\"; ma=3600")
} else {
w.Header().Set("Alt-Svc", "Alt-Svc: h2=\":443\"; ma=3600") w.Header().Set("Alt-Svc", "Alt-Svc: h2=\":443\"; ma=3600")
}
} else { } else {
switch config.Global.Stealth.Server { switch config.Global.Stealth.Server {
case "nginx": case "nginx":
@ -1192,21 +1186,6 @@ func main() {
// Start the server // Start the server
slog.Info("Starting server on " + config.Global.IP + " with ports " + config.Global.HTTPPort + " and " + config.Global.HTTPSPort) slog.Info("Starting server on " + config.Global.IP + " with ports " + config.Global.HTTPPort + " and " + config.Global.HTTPSPort)
go func() { go func() {
if config.Global.EnableHTTP3 {
// Create the TLS server
server := &http3.Server{
Handler: http.HandlerFunc(hostRouter),
Addr: config.Global.IP + ":" + config.Global.HTTPSPort,
TLSConfig: &tls.Config{
GetCertificate: getTLSCertificate,
},
}
// Start the TLS server
err = server.ListenAndServe()
slog.Error("Error starting HTTPS server: " + err.Error())
os.Exit(1)
} else {
// Create the TLS server // Create the TLS server
server := &http.Server{ server := &http.Server{
Addr: config.Global.IP + ":" + config.Global.HTTPSPort, Addr: config.Global.IP + ":" + config.Global.HTTPSPort,
@ -1220,7 +1199,6 @@ func main() {
err = server.ListenAndServeTLS("", "") err = server.ListenAndServeTLS("", "")
slog.Error("Error starting HTTPS server: " + err.Error()) slog.Error("Error starting HTTPS server: " + err.Error())
os.Exit(1) os.Exit(1)
}
}() }()
// Start the HTTP server // Start the HTTP server