Ok forget http/3
Signed-off-by: arzumify <jliwin98@danwin1210.de>
This commit is contained in:
parent
dac060cee5
commit
3114dd556e
50
main.go
50
main.go
|
@ -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,8 +49,7 @@ 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"`
|
||||||
} `yaml:"logging"`
|
} `yaml:"logging"`
|
||||||
|
@ -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\"; ma=3600")
|
||||||
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")
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
switch config.Global.Stealth.Server {
|
switch config.Global.Stealth.Server {
|
||||||
case "nginx":
|
case "nginx":
|
||||||
|
@ -1192,35 +1186,19 @@ 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
|
||||||
// Create the TLS server
|
server := &http.Server{
|
||||||
server := &http3.Server{
|
Addr: config.Global.IP + ":" + config.Global.HTTPSPort,
|
||||||
Handler: http.HandlerFunc(hostRouter),
|
Handler: http.HandlerFunc(hostRouter),
|
||||||
Addr: config.Global.IP + ":" + config.Global.HTTPSPort,
|
TLSConfig: &tls.Config{
|
||||||
TLSConfig: &tls.Config{
|
GetCertificate: getTLSCertificate,
|
||||||
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
|
|
||||||
server := &http.Server{
|
|
||||||
Addr: config.Global.IP + ":" + config.Global.HTTPSPort,
|
|
||||||
Handler: http.HandlerFunc(hostRouter),
|
|
||||||
TLSConfig: &tls.Config{
|
|
||||||
GetCertificate: getTLSCertificate,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start the TLS server
|
|
||||||
err = server.ListenAndServeTLS("", "")
|
|
||||||
slog.Error("Error starting HTTPS server: " + err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start the TLS server
|
||||||
|
err = server.ListenAndServeTLS("", "")
|
||||||
|
slog.Error("Error starting HTTPS server: " + err.Error())
|
||||||
|
os.Exit(1)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Start the HTTP server
|
// Start the HTTP server
|
||||||
|
|
Loading…
Reference in New Issue