Documentation
¶
Index ¶
- func CombinedContext(signals ...interface{}) (context.Context, context.CancelFunc)
- func ContextFromChan(chStop <-chan struct{}) (context.Context, context.CancelFunc)
- func DeepCopyJSValue(val interface{}) interface{}
- func DeviceIDFromX509Pubkey(pubkey interface{}) string
- func FilterEmptyStrings(s []string) []string
- func GetValue(x interface{}, keypath []string) (interface{}, bool)
- func GuessContentTypeFromFilename(filename string) string
- func IsLocalStateURI(stateURI string) bool
- func MakeSelfSignedX509Certificate() (*tls.Certificate, error)
- func ParseJWT(authHeader string, jwtSecret []byte) (jwt.MapClaims, bool, error)
- func PrettyJSON(x interface{}) string
- func RandomBytes(length int) []byte
- func RandomNumberString() string
- func RandomString(n int) string
- func RespondJSON(resp http.ResponseWriter, data interface{})
- func SniffContentType(filename string, data io.Reader) (string, error)
- func TrimStringToLen(s string, length int) string
- func UnmarshalHTTPRequest(into interface{}, r *http.Request) error
- func UnrestrictedCors(handler http.Handler) http.Handler
- type ChanContext
- type ExponentialBackoff
- type ExponentialBackoffTicker
- type HTTPClient
- type Mailbox
- type StaticTicker
- type Ticker
- type WaitGroupChan
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombinedContext ¶
func CombinedContext(signals ...interface{}) (context.Context, context.CancelFunc)
CombinedContext creates a context that finishes when any of the provided signals finish. A signal can be a `context.Context`, a `chan struct{}`, or a `time.Duration` (which is transformed into a `context.WithTimeout`).
func ContextFromChan ¶
func ContextFromChan(chStop <-chan struct{}) (context.Context, context.CancelFunc)
ContextFromChan creates a context that finishes when the provided channel receives or is closed.
func DeepCopyJSValue ¶
func DeepCopyJSValue(val interface{}) interface{}
@@TODO: everything about this is horrible
func DeviceIDFromX509Pubkey ¶
func DeviceIDFromX509Pubkey(pubkey interface{}) string
func FilterEmptyStrings ¶
func IsLocalStateURI ¶
func MakeSelfSignedX509Certificate ¶
func MakeSelfSignedX509Certificate() (*tls.Certificate, error)
func PrettyJSON ¶
func PrettyJSON(x interface{}) string
func RandomBytes ¶
func RandomNumberString ¶
func RandomNumberString() string
func RandomString ¶
func RespondJSON ¶
func RespondJSON(resp http.ResponseWriter, data interface{})
func TrimStringToLen ¶
func UnmarshalHTTPRequest ¶
Types ¶
type ChanContext ¶
type ChanContext chan struct{}
func (ChanContext) Done ¶
func (ch ChanContext) Done() <-chan struct{}
func (ChanContext) Err ¶
func (ch ChanContext) Err() error
func (ChanContext) Value ¶
func (ch ChanContext) Value(key interface{}) interface{}
type ExponentialBackoff ¶
type ExponentialBackoff struct {
Min time.Duration
Max time.Duration
// contains filtered or unexported fields
}
func (*ExponentialBackoff) Next ¶
func (eb *ExponentialBackoff) Next() time.Duration
func (*ExponentialBackoff) Ready ¶
func (eb *ExponentialBackoff) Ready() (ready bool, until time.Duration)
func (*ExponentialBackoff) Reset ¶
func (eb *ExponentialBackoff) Reset()
func (*ExponentialBackoff) Wait ¶
func (eb *ExponentialBackoff) Wait()
type ExponentialBackoffTicker ¶
type ExponentialBackoffTicker struct {
// contains filtered or unexported fields
}
func NewExponentialBackoffTicker ¶
func NewExponentialBackoffTicker(min, max time.Duration) *ExponentialBackoffTicker
func (*ExponentialBackoffTicker) Close ¶
func (t *ExponentialBackoffTicker) Close()
func (*ExponentialBackoffTicker) Notify ¶
func (t *ExponentialBackoffTicker) Notify() <-chan time.Time
func (*ExponentialBackoffTicker) Reset ¶
func (t *ExponentialBackoffTicker) Reset()
func (*ExponentialBackoffTicker) Start ¶
func (t *ExponentialBackoffTicker) Start()
type HTTPClient ¶
func MakeHTTPClient ¶
func MakeHTTPClient(requestTimeout, reapIdleConnsInterval time.Duration, cookieJar http.CookieJar, tlsCerts []tls.Certificate) *HTTPClient
func (HTTPClient) Close ¶
func (c HTTPClient) Close()
type Mailbox ¶
type Mailbox struct {
// contains filtered or unexported fields
}
func NewMailbox ¶
func (*Mailbox) RetrieveAll ¶
func (m *Mailbox) RetrieveAll() []interface{}
type StaticTicker ¶
type StaticTicker struct {
// contains filtered or unexported fields
}
func NewStaticTicker ¶
func NewStaticTicker(interval time.Duration) StaticTicker
func (StaticTicker) Close ¶
func (t StaticTicker) Close()
func (StaticTicker) Notify ¶
func (t StaticTicker) Notify() <-chan time.Time
func (StaticTicker) Start ¶
func (t StaticTicker) Start()
type WaitGroupChan ¶
type WaitGroupChan struct {
// contains filtered or unexported fields
}
WaitGroupChan creates a channel that closes when the provided sync.WaitGroup is done.
func NewWaitGroupChan ¶
func NewWaitGroupChan(ctx context.Context) *WaitGroupChan
func (*WaitGroupChan) Add ¶
func (wg *WaitGroupChan) Add(i int)
func (*WaitGroupChan) Close ¶
func (wg *WaitGroupChan) Close()
func (*WaitGroupChan) Done ¶
func (wg *WaitGroupChan) Done()
func (*WaitGroupChan) Wait ¶
func (wg *WaitGroupChan) Wait() <-chan struct{}
Click to show internal directories.
Click to hide internal directories.