Skip to content

jbrekelmans/go-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

A collection of Go libraries.

Index

  1. auth/google/compute: verification of Google Compute Engine identity JSON Web Tokens (see Google's documentation). This is useful for applications that want to accept such JWTs as an authentication mechanism.
  2. cache: a cache for values that need to be periodically re-evaluated where evaluations are expensive enough to justify ensuring only one Goroutine evaluates while other Goroutines wait for the evaluation. This is equivalent to using a Mutex, but this package supports a Context parameter. This primitive is useful for caching remote resources such as JWKS' and authentication tokens.
  3. http: primitives focused around RFC6750. This is useful for HTTP servers that want to implement the Bearer authentication scheme.
  4. test: logrus logging in tests. For example:
    import "github.com/jbrekelmans/go-lib/test"
    
    func Test_MyTest(t *testing.T) {
        defer test.RedirectLogs(t).Dispose()
        // Any calls that MyTest makes to logrus's standard logger are forwarded to t.Logf.
        MyTest()
    }
  5. url: url validation and normalization functions.