Utilities for Go
go-utls
is a small Go repository where I put all the useful stuff I regularly need in my projects.
Feel free to use at your discretion with the appropriate license mentions.
NB: I've developed the same kind of libraries for TypeScript and Python.
go get github.com/cyrildever/go-utls
This repository contains the following modules:
crypto
: a proxy to Go-Ethereum's ECIES library and to myecies-geth
JavaScript library (including thePath
type) as well as a smallSSHPublicKey2String()
utility;io
: a light REST client utility on top offasthttp
withDelete
,Get
,Patch
,Post
andPut
methods;model
: a list of types I frequently use in my projects (such asBase64
orHash
types) all implementing myModel
interface;normalizer
: the adaptation of my Empreinte Sociométrique™ patented work for normalizing contact data (see its specific README or use its TypeScript equivalent on NPM:es-normalizer
);- a few utility sub-modules:
caller
: to get information about the location of the calling function (file name and line number);concurrent
: to handle concurrent maps and slices (with faster slice appending when its length is set at instantiation through theconcurrent.NewSlice
function);email
: my "quick-and-dirty" SMTP client (including examples in tests for use with AWS SES or Gmail);env
: to know if an environment variable is set and cast it as either a boolean, an integer or a string (potentially setting it with a default value);event
: a simple event bus manager;file
: to find, truncate, know existence, delete, get line count or read all lines from a file;logger
: a wrapper to thelog
package to output logs to stderr and optionally a file;ntp
: another small wrapper to handle time with NTP;packer
: to marshal/unmarshal data (JSON, MessagePack, MongoDB's Bson, …);utils
: a bunch of useful utility functions (Capitalize()
,Chunk()
,DateFormat()
from Java notation,EuclideanDivision()
,Flatten()
,FromHex()
/ToHex()
, back-and-forth conversions of byte arrays (to string, number, etc.),IsPointer()
/IsValue()
test methods,PrettyPrintJSON()
,Reverse()
for strings,ToUTF8()
string formatting, …);xor
: to apply XOR operation to strings or byte arrays.
These modules are distributed under a MIT license.
See the LICENSE file.
© 2020-2024 Cyril Dever. All rights reserved.