parallel

package
v0.0.0-...-bf23437 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConnPerHost   = 5
	DefaultParallelHosts = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	MaxConnPerHost   int
	MaxParallelHosts int
}

func New

func New() *Client

func (*Client) GetParallelHosts

func (c *Client) GetParallelHosts(targets []string) error

GetParallelHosts will retrieve each target on a separate connection This uses a simple fan-out fan-in concurrency model

func (*Client) GetPathDiffOnHost

func (c *Client) GetPathDiffOnHost(base string, targets []string, opts ...ParallelOption) error

GetPathDiffOnHost will send the targets to the base host on both a http2 and a h2c connection the results will be diffed this will use c.MaxConnPerHost to parallelize the paths This assumes that the host can be connected to over h2c. This will fail if attempted with a host that cannot be h2c smuggled TODO: minimize allocations here, since we explode out a lot

func (*Client) GetPathsOnHost

func (c *Client) GetPathsOnHost(base string, targets []string, opts ...ParallelOption) error

GetPathsOnHost will send the targets to the base host this will use c.MaxConnPerHost to parallelize the paths This assumes that the host can be connected to over h2c. This will fail if attempted with a host that cannot be h2c smuggled TODO: minimize allocations here, since we explode out a lot

type Diff

type Diff struct {
	HTTP2 *res
	H2C   *res
}

type Doer

type Doer interface {
	Do(req *http.Request) (*http.Response, error)
}

type ParallelOption

type ParallelOption func(o *ParallelOptions)

func RequestHeader

func RequestHeader(key string, value string) ParallelOption

func RequestMethod

func RequestMethod(method string) ParallelOption

type ParallelOptions

type ParallelOptions struct {
	RequestMutations []RequestMutation
}

type RequestMutation

type RequestMutation func(req *http.Request)

type ResponseDiff

type ResponseDiff struct {
	DeleteOnShow bool // if enabled, results will be cleared from the cache once shown
	// contains filtered or unexported fields
}

func NewDiffer

func NewDiffer(DeleteOnShow bool) *ResponseDiff

func (*ResponseDiff) ShowDiffH2C

func (r *ResponseDiff) ShowDiffH2C(http2res *res)

ShowDiffH2C will show if there's a diff between the http2 and h2c responses. if the corresponding response is not cached, this does nothing

func (*ResponseDiff) ShowDiffHTTP2

func (r *ResponseDiff) ShowDiffHTTP2(http2res *res)

ShowDiffHTTP2 will show if there's a diff between the http2 and h2c responses. if the corresponding response is not cached, this does nothing

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL