diff --git a/config.example.yaml b/config.example.yaml index 1c29eca..a0f11fd 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -19,7 +19,7 @@ targets: url: http://172.21.88.1:8080 rps: 2.0 timeout: '3s' - http2_enabled: true + h2c_enabled: true dns: - name: 'google' domain: 'google.com' diff --git a/config/config.go b/config/config.go index c50b2c7..622eaa2 100644 --- a/config/config.go +++ b/config/config.go @@ -50,7 +50,7 @@ type HTTP struct { Timeout time.Duration `mapstructure:"timeout"` TLSSkipVerify bool `mapstructure:"tls_skip_verify"` DisableKeepAlives bool `mapstructure:"disable_keepalives"` - Http2Enabled bool `mapstructure:"http2_enabled"` + H2cEnabled bool `mapstructure:"h2c_enabled"` Host string `mapstructure:"host"` } diff --git a/main.go b/main.go index 1ef617b..a417a8f 100644 --- a/main.go +++ b/main.go @@ -33,10 +33,10 @@ func main() { ctx, cancel := context.WithCancel(context.Background()) for _, ht := range config.Get().Targets.HTTP { - httpProber := prober.NewHttp(ht.Name, ht.URL, ht.RPS, ht.Timeout, ht.TLSSkipVerify, ht.DisableKeepAlives, ht.Http2Enabled, ht.Host) + httpProber := prober.NewHttp(ht.Name, ht.URL, ht.RPS, ht.Timeout, ht.TLSSkipVerify, ht.DisableKeepAlives, ht.H2cEnabled, ht.Host) - klog.Infof("Probing HTTP target '%s' with url '%s', RPS: %.2f, timeout: %s, TLS_skip_verify: %v, disableKeepAlives: %v, http2Enabled: %v ...\n", - ht.Name, ht.URL, ht.RPS, ht.Timeout, ht.TLSSkipVerify, ht.DisableKeepAlives, ht.Http2Enabled) + klog.Infof("Probing HTTP target '%s' with url '%s', RPS: %.2f, timeout: %s, TLS_skip_verify: %v, disableKeepAlives: %v, h2cEnabled: %v ...\n", + ht.Name, ht.URL, ht.RPS, ht.Timeout, ht.TLSSkipVerify, ht.DisableKeepAlives, ht.H2cEnabled) go httpProber.Start(ctx) } diff --git a/prober/http.go b/prober/http.go index 8dae12c..43bde6b 100644 --- a/prober/http.go +++ b/prober/http.go @@ -49,12 +49,12 @@ func init() { } -func NewHttp(name string, url string, rps float64, timeout time.Duration, tlsSkipVerify, disableKeepAlives, http2Enabled bool, host string) HTTP { +func NewHttp(name string, url string, rps float64, timeout time.Duration, tlsSkipVerify, disableKeepAlives, h2cEnabled bool, host string) HTTP { client := &http.Client{ Timeout: timeout, } - if http2Enabled { + if h2cEnabled { customTransport := &http2.Transport{ AllowHTTP: true, DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {