Documentation
¶
Overview ¶
Package common provides shared utilities for katzenpost CLI tools.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorHandlerWithUsage ¶
func ErrorHandlerWithUsage(cmd *cobra.Command) fang.ErrorHandler
ErrorHandlerWithUsage creates a custom error handler that displays error messages followed by usage help for CLI argument errors. This provides better user experience by showing both the error and how to use the command correctly.
func ExecuteWithFang ¶
ExecuteWithFang executes a cobra command using fang with standard katzenpost options. This reduces boilerplate across all CLI tools by providing a common execution pattern.
func LambdaRateToMs ¶ added in v0.0.73
LambdaRateToMs converts a PKI lambda parameter (the rate of an Exp distribution, in events per millisecond) into the mean delay in milliseconds that ExpDist.UpdateRate expects. math.Ceil avoids the truncation-to-zero hazard of uint64(1.0 / lambda) when lambda > 1.
func TruncatePEMForLogging ¶ added in v0.0.58
TruncatePEMForLogging truncates a PEM string to first two lines only This is useful for logging PEM keys in a more concise format while preserving the header and first line of data for debugging purposes.
Types ¶
type ExpDist ¶ added in v0.0.72
ExpDist provides a pseudorandom ticker with an average and maximum delay The channel returned by OutCh() is written at an average rate specified with UpdateRate(average, max uint64), in units of milliseconds.
func NewExpDist ¶ added in v0.0.72
func NewExpDist() *ExpDist
NewExpDist returns an ExpDist with running worker routine.
func (*ExpDist) OutCh ¶ added in v0.0.72
func (e *ExpDist) OutCh() <-chan struct{}
OutCh returns channel that receives at the rate specified by UpdateRate
func (*ExpDist) UpdateConnectionStatus ¶ added in v0.0.72
UpdateConnectionStatus(true) starts sending to OutCh and UpdateConnectionStatus(false) stops sending to OutCh
func (*ExpDist) UpdateRate ¶ added in v0.0.72
UpdateRate is a value in milliseconds and specifies the average and maximum delay between writes to the channel returned by OutCh.