gokit

module
v0.0.0-...-f6c12a3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0

README

⬆️ For table of contents, click the above icon

Build GoDoc

Frequently needed, stupid simple, packages in Go.

Directory structure

Low-level packages

Directory structure follows Go's stdlib where there are equivalents. E.g. httputils is found in net/http/httputils/.

Higher-level, "app", packages

Go's stdlib (wisely) doesn't implement higher level/app-level concepts.

Higher-level concepts are in app/ like backoff/retry algorithms or external service related things like AWS wrappers or Prometheus helpers.

Deprecations

  • csrf/ - just use SameSite cookies
  • crypto/pkencryptedstream/ - provides confidentiality, but is malleable (ciphertext is not authenticated). Use Age instead.

Directories

Path Synopsis
app
appuptime
Enables fetching app's uptime by saving start time on initialization
Enables fetching app's uptime by saving start time on initialization
aws/dynamoutils
DynamoDB utils for hiding complexity
DynamoDB utils for hiding complexity
aws/lambdautils
Utils for making AWS Lambda & API Gateway usage easier
Utils for making AWS Lambda & API Gateway usage easier
aws/s3facade
Because AWS SDK has so much ceremony..
Because AWS SDK has so much ceremony..
backoff
Exponential backoff
Exponential backoff
byteshuman
Formats byte amounts into human readable format
Formats byte amounts into human readable format
cli
Cobra wrappers to wrap awkward API (no exit codes and no built-in "ctrl-c => cancel" support)
Cobra wrappers to wrap awkward API (no exit codes and no built-in "ctrl-c => cancel" support)
dynversion
Dynamically embed a build version at compile time, so you can statically access it at runtime.
Dynamically embed a build version at compile time, so you can statically access it at runtime.
dynversion/precompilationversion
Same as dynversion, but for pre-compilation stage (e.g.
Same as dynversion, but for pre-compilation stage (e.g.
evdev
Read input events from evdev (Linux input device subsystem)
Read input events from evdev (Linux input device subsystem)
promconstmetrics
Facade for hiding complexity of recording const metrics with explicit timestamp for Prometheus
Facade for hiding complexity of recording const metrics with explicit timestamp for Prometheus
retry
Battle-tested algorithm for retrying with timeout and exponential backoff
Battle-tested algorithm for retrying with timeout and exponential backoff
throttle
"This thing should happen 3 times a second at most"
"This thing should happen 3 times a second at most"
udocker
μDocker - super-lightweight Docker client.
μDocker - super-lightweight Docker client.
Helpers so generic & useful they "could/should be" language-level features.
Helpers so generic & useful they "could/should be" language-level features.
crypto
cryptoutil
Small helpers for common crypto needs
Small helpers for common crypto needs
envelopeenc
Envelope encryption - envelope contains secret content encrypted with NaCl secretbox symmetric key ("DEK"), and that key is separately encrypted for each RSA public key recipient ("KEK").
Envelope encryption - envelope contains secret content encrypted with NaCl secretbox symmetric key ("DEK"), and that key is separately encrypted for each RSA public key recipient ("KEK").
mac
Message Authentication Code - to make sure a message is not tampered with while in-transit by a malicious party.
Message Authentication Code - to make sure a message is not tampered with while in-transit by a malicious party.
pkencryptedstream
Use public key crypto to encrypt a data stream in a way, that the encrypting party can not necessarily decrypt the same data (unless she possesses the private key as well).
Use public key crypto to encrypt a data stream in a way, that the encrypting party can not necessarily decrypt the same data (unless she possesses the private key as well).
randompassword
Generate random passwords
Generate random passwords
storedpassword
API that tries to make it safe(r) to store user's passwords
API that tries to make it safe(r) to store user's passwords
encoding
hcl2json
Converts Hashicorp's HCL to JSON
Converts Hashicorp's HCL to JSON
jsonfile
I got tired of writing the same readConfigFile(), writeConfigFile() boilerplate over and over again..
I got tired of writing the same readConfigFile(), writeConfigFile() boilerplate over and over again..
io
bidipipe
Bi-directional pipe (for proxying use cases)
Bi-directional pipe (for proxying use cases)
hashverifyreader
If you know the hash of a stream beforehand, wrap it with this to get integrity-verified io.Reader
If you know the hash of a stream beforehand, wrap it with this to get integrity-verified io.Reader
log
logex
"Logging extensions" - https://joonas.fi/2018/12/04/an-idea-to-fix-gos-logging-mess/
"Logging extensions" - https://joonas.fi/2018/12/04/an-idea-to-fix-gos-logging-mess/
MIME (Content Type) database.
MIME (Content Type) database.
net
http/csrf
CSRF protection
CSRF protection
http/ezhttp
This package aims to wrap Go HTTP Client's request-response with sane defaults:
This package aims to wrap Go HTTP Client's request-response with sane defaults:
http/httputils
Small HTTP related utils
Small HTTP related utils
netutil
Net utilities - there's quite a lot of ceremony setting up a unix socket in a robust way.
Net utilities - there's quite a lot of ceremony setting up a unix socket in a robust way.
os
osutil
OS-related utilities
OS-related utilities
systemdcli
creates an CLI entrypoint for managing a systemd-based service.
creates an CLI entrypoint for managing a systemd-based service.
systemdinstaller
Util for programmatically writing systemd unit file so your service can be autostarted
Util for programmatically writing systemd unit file so your service can be autostarted
Common utils (Contains()/Filter()/..) for common types of slices
Common utils (Contains()/Filter()/..) for common types of slices
strings
stringutils
Things that missing from Go's "strings" package
Things that missing from Go's "strings" package
sync
syncutil
sync-related utils
sync-related utils
taskrunner
Supports starting many cancellable goroutines whose exit and their error codes we can wait on.
Supports starting many cancellable goroutines whose exit and their error codes we can wait on.
testing
assert
Assertion helpers
Assertion helpers
time
timeutil
Time-related utilities
Time-related utilities

Jump to

Keyboard shortcuts

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