Documentation ¶
Overview ¶
Package bincommon is the common code and flag handling between the fortio (fortio_main.go) and fcurl (fcurl.go) executables.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // PayloadSizeFlag is the value of -payload-size. PayloadSizeFlag = flag.Int("payload-size", 0, "Additional random payload size, replaces -payload when set > 0,"+ " must be smaller than -maxpayloadsizekb. Setting this switches http to POST.") // PayloadFlag is the value of -payload. PayloadFlag = flag.String("payload", "", "Payload string to send along") // PayloadFileFlag is the value of -paylaod-file. PayloadFileFlag = flag.String("payload-file", "", "File `path` to be use as payload (POST for http), replaces -payload when set.") // PayloadStreamFlag for streaming payload from stdin (curl only). PayloadStreamFlag = flag.Bool("stream", false, "Stream payload from stdin (only for fortio curl mode)") // CertFlag is the flag for the path for the client custom certificate. CertFlag = flag.String("cert", "", "`Path` to the certificate file to be used for client or server TLS") // KeyFlag is the flag for the path for the key for the `cert`. KeyFlag = flag.String("key", "", "`Path` to the key file matching the -cert") // CACertFlag is the flag for the path of the custom CA to verify server certificates in client calls. CACertFlag = flag.String("cacert", "", "`Path` to a custom CA certificate file to be used for the TLS client connections, "+ "if empty, use https:// prefix for standard internet/system CAs") // LogErrorsFlag determines if the non ok http error codes get logged as they occur or not. LogErrorsFlag = flag.Bool("log-errors", true, "Log http non 2xx/418 error codes as they occur") // RunIDFlag is optional RunID to be present in json results (and default json result filename if not 0). RunIDFlag = flag.Int64("runid", 0, "Optional RunID to add to json result and auto save filename, to match server mode") // ConnectionReuseRange Dynamic string flag to set the max connection reuse range. ConnectionReuseRange = dflag.Flag("connection-reuse", dflag.New("", "Range `min:max` for the max number of connections to reuse for each thread, default to unlimited. "+ "e.g. 10:30 means randomly choose a max connection reuse threshold between 10 and 30 requests."). WithValidator(ConnectionReuseRangeValidator(&httpOpts))) // NoReResolveFlag is false if we want to resolve the DNS name for each new connection. NoReResolveFlag = flag.Bool("no-reresolve", false, "Keep the initial DNS resolution and "+ "don't re-resolve when making new connections (because of error or reuse limit reached)") MethodFlag = flag.String("X", "", "HTTP method to use instead of GET/POST depending on payload/content-type") )
Functions ¶
func ConnectionReuseRangeValidator ¶ added in v1.34.0
func ConnectionReuseRangeValidator(httpOpts *fhttp.HTTPOptions) func(string) error
ConnectionReuseRangeValidator returns a validator function that checks if the connection reuse range is valid and set in httpOpts.
func FetchURL ¶
func FetchURL(o *fhttp.HTTPOptions)
FetchURL is fetching url content and exiting with 1 upon error. common part between fortio_main and fcurl.
func SharedHTTPOptions ¶
func SharedHTTPOptions() *fhttp.HTTPOptions
SharedHTTPOptions is the flag->httpoptions transfer code shared between fortio_main and fcurl. It also sets fhttp.DefaultHTTPOptions.
func SharedMain ¶
func SharedMain()
SharedMain is the common part of main from fortio_main and fcurl. It sets up the common flags, the rest of usage/argument/flag handling is now moved to the fortio.org/cli and fortio.org/scli packages.
func TLSInsecure ¶ added in v1.12.2
func TLSInsecure() bool
TLSInsecure returns true if -k or -https-insecure was passed.
Types ¶
type FortioHook ¶ added in v1.39.0
type FortioHook func(*fhttp.HTTPOptions, *periodic.RunnerOptions)
FortioHook is used in cli and rapi to customize the run and introduce for instance clienttrace and otel access logger.