Go 1.22 -> Go 1.24 bump

This commit is contained in:
WeebDataHoarder
2025-04-11 07:50:02 +02:00
parent 87c2845952
commit f6f00a54da
10 changed files with 86 additions and 83 deletions

View File

@@ -1,5 +1,5 @@
module git.gammaspectra.live/git/go-away/utils/exp
go 1.22.0
go 1.24.0
toolchain go1.22.12
toolchain go1.24.2

View File

@@ -2,6 +2,7 @@ package utils
import (
"context"
"crypto/tls"
"errors"
"fmt"
"net"
@@ -11,6 +12,27 @@ import (
"strings"
)
func NewServer(handler http.Handler, tlsConfig *tls.Config) *http.Server {
if tlsConfig == nil {
proto := new(http.Protocols)
proto.SetHTTP1(true)
proto.SetUnencryptedHTTP2(true)
h1s := &http.Server{
Handler: handler,
Protocols: proto,
}
return h1s
} else {
server := &http.Server{
TLSConfig: tlsConfig,
Handler: handler,
}
return server
}
}
func EnsureNoOpenRedirect(redirect string) (string, error) {
uri, err := url.Parse(redirect)
if err != nil {