goutils

package module
v0.0.0-...-f73603f Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2014 License: MIT Imports: 22 Imported by: 0

README

hmac

warden-hmac-signer compatible hmac signer

synchronized

simple java like synchronized(obj){ ... } locking

uuid

generates a uuid from /dev/urandom

execute

executes external process with timeout, stdin, stderr and stdout support

Documentation

Index

Constants

View Source
const (
	ErrorTimeout     = "Execute: Timeout running command"
	ErrorTimeoutKill = "Execute: Could not kill process after timeout"
)
View Source
const (
	DATE   = "auth[date]="
	SIG    = "&auth[signature]="
	FORMAT = "Mon, _2 Jan 2006 15:04:05 GMT"
)

Variables

View Source
var ErrorRequestBody = errors.New("{\"error\":\"Could not read request body\"}")
View Source
var ErrorRequestJsonUnmarshal = errors.New("{\"error\":\"Could not generate struct vom json\"}")
View Source
var ErrorRestFunc = errors.New("{\"error\":\"Rest function must be func(struct, web.C) (struct, error)\"}")

Functions

func GojiRestJsonWrapper

func GojiRestJsonWrapper(f interface{}) func(c web.C, w http.ResponseWriter, r *http.Request)

func UUID

func UUID() string

func WriterError

func WriterError(w http.ResponseWriter, e error)

Types

type Bench

type Bench struct {
	// contains filtered or unexported fields
}

func (*Bench) Start

func (b *Bench) Start()

func (*Bench) Stop

func (b *Bench) Stop() int64

func (*Bench) Sum

func (b *Bench) Sum() int64

type ConcurrencyLimit

type ConcurrencyLimit struct {
	// contains filtered or unexported fields
}

func NewConcurrencyLimit

func NewConcurrencyLimit(limit int) ConcurrencyLimit

func NewConcurrencyLimitCPU

func NewConcurrencyLimitCPU() ConcurrencyLimit

func NewConcurrencyLimitCPUFactore

func NewConcurrencyLimitCPUFactore(f float64) ConcurrencyLimit

func NewConcurrencyLimitOne

func NewConcurrencyLimitOne() ConcurrencyLimit

func (*ConcurrencyLimit) Free

func (l *ConcurrencyLimit) Free()

func (*ConcurrencyLimit) Len

func (l *ConcurrencyLimit) Len() int

func (*ConcurrencyLimit) Limit

func (l *ConcurrencyLimit) Limit() func()

usage: defer x.Limit()()

^ ^ double ()

func (*ConcurrencyLimit) Size

func (l *ConcurrencyLimit) Size() int

func (*ConcurrencyLimit) Use

func (l *ConcurrencyLimit) Use()

type Hmac

type Hmac struct {
}
var HMAC Hmac

func (*Hmac) SignUrl

func (h *Hmac) SignUrl(url string, secret string, ttl int) string

func (*Hmac) Validate

func (h *Hmac) Validate(urlp string, secret string) bool

func (*Hmac) ValidateTime

func (h *Hmac) ValidateTime(urlp string, secret string) (bool, int)

type Processes

type Processes struct {
}
var Process Processes

func (*Processes) AppendProcTitle

func (c *Processes) AppendProcTitle(title string)

func (*Processes) Execute

func (c *Processes) Execute(timeout int, stdin []byte, parms ...string) ([]byte, []byte, error)

func (*Processes) SetProcTitle

func (c *Processes) SetProcTitle(title string)

type Synchronized

type Synchronized struct {
	// contains filtered or unexported fields
}
var Sync Synchronized

func (*Synchronized) Call

func (s *Synchronized) Call(lock interface{}, call func())

func (*Synchronized) Lock

func (s *Synchronized) Lock(key interface{})

func (*Synchronized) Unlock

func (s *Synchronized) Unlock(key interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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