github.com/yandex/pandora@v0.5.32/components/guns/http_scenario/new.go (about) 1 package httpscenario 2 3 import ( 4 "errors" 5 6 phttp "github.com/yandex/pandora/components/guns/http" 7 "go.uber.org/zap" 8 ) 9 10 func NewHTTPGun(conf phttp.GunConfig, answLog *zap.Logger) *ScenarioGun { 11 return newScenarioGun(phttp.HTTP1ClientConstructor, conf, answLog) 12 } 13 14 // NewHTTP2Gun return simple HTTP/2 gun that can shoot sequentially through one connection. 15 func NewHTTP2Gun(conf phttp.GunConfig, answLog *zap.Logger) (*ScenarioGun, error) { 16 if !conf.SSL { 17 // Open issue on github if you really need this feature. 18 return nil, errors.New("HTTP/2.0 over TCP is not supported. Please leave SSL option true by default") 19 } 20 return newScenarioGun(phttp.HTTP2ClientConstructor, conf, answLog), nil 21 } 22 23 func newScenarioGun(clientConstructor phttp.ClientConstructor, cfg phttp.GunConfig, answLog *zap.Logger) *ScenarioGun { 24 return &ScenarioGun{ 25 base: phttp.NewBaseGun(clientConstructor, cfg, answLog), 26 } 27 }