Skip to content

Commit

Permalink
fix: http2 rename to h2c
Browse files Browse the repository at this point in the history
  • Loading branch information
m-yosefpor committed Oct 26, 2023
1 parent b22b677 commit 018c6f3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions prober/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 018c6f3

Please sign in to comment.