type GoawayDecider … var randPool … // WithProbabilisticGoaway returns an http.Handler that send GOAWAY probabilistically // according to the given chance for HTTP2 requests. After client receive GOAWAY, // the in-flight long-running requests will not be influenced, and the new requests // will use a new TCP connection to re-balancing to another server behind the load balance. func WithProbabilisticGoaway(inner http.Handler, chance float64) http.Handler { … } type goaway … // ServeHTTP implement HTTP handler func (h *goaway) ServeHTTP(w http.ResponseWriter, r *http.Request) { … } type probabilisticGoawayDecider … // Goaway implement GoawayDecider func (p *probabilisticGoawayDecider) Goaway(r *http.Request) bool { … }