mirror of
https://github.com/dcarrillo/whatismyip.git
synced 2025-07-01 13:59:27 +00:00
Add experimental support for HTTP/3 (#8)
* Wait for service in integration tests instead of watching for a string * Add http3 experimental support
This commit is contained in:
@ -29,6 +29,7 @@ type settings struct {
|
||||
TrustedHeader string
|
||||
TrustedPortHeader string
|
||||
EnableSecureHeaders bool
|
||||
EnableHTTP3 bool
|
||||
Server serverSettings
|
||||
version bool
|
||||
}
|
||||
@ -89,6 +90,12 @@ func Setup(args []string) (output string, err error) {
|
||||
false,
|
||||
"Add sane security-related headers to every response",
|
||||
)
|
||||
flags.BoolVar(
|
||||
&App.EnableHTTP3,
|
||||
"enable-http3",
|
||||
false,
|
||||
"Enable HTTP/3 protocol. HTTP/3 requires --tls-bind set, as HTTP/3 starts as a TLS connection that then gets upgraded to UDP. The UDP port is the same as the one used for the TLS server.",
|
||||
)
|
||||
|
||||
err = flags.Parse(args)
|
||||
if err != nil {
|
||||
@ -111,6 +118,10 @@ func Setup(args []string) (output string, err error) {
|
||||
return "", fmt.Errorf("in order to use TLS, the -tls-crt and -tls-key flags are mandatory")
|
||||
}
|
||||
|
||||
if App.EnableHTTP3 && App.TLSAddress == "" {
|
||||
return "", fmt.Errorf("in order to use HTTP3, the -tls-bind is mandatory")
|
||||
}
|
||||
|
||||
if App.TemplatePath != "" {
|
||||
info, err := os.Stat(App.TemplatePath)
|
||||
if os.IsNotExist(err) {
|
||||
|
@ -41,6 +41,11 @@ func TestParseMandatoryFlags(t *testing.T) {
|
||||
"-tls-key", "/key-path",
|
||||
},
|
||||
},
|
||||
{
|
||||
[]string{
|
||||
"-geoip2-city", "/city-path", "-geoip2-asn", "/asn-path", "-enable-http3",
|
||||
},
|
||||
},
|
||||
{
|
||||
[]string{
|
||||
"-geoip2-city", "/city-path", "-geoip2-asn", "/asn-path", "-bind", ":8000",
|
||||
|
Reference in New Issue
Block a user