2
// gosdc - Go library to interact with the Joyent CloudAPI
4
// Double testing service
6
// Copyright (c) 2013 Joyent Inc.
8
// Written by Daniele Stroppa <daniele.stroppa@joyent.com>
19
"github.com/joyent/gosdc/localservices/hook"
22
// An HttpService provides the HTTP API for a service double.
23
type HttpService interface {
24
SetupHTTP(mux *http.ServeMux)
27
// A ServiceInstance is an Joyent Cloud service.
28
type ServiceInstance struct {
35
// NewUUID generates a random UUID according to RFC 4122
36
func NewUUID() (string, error) {
37
uuid := make([]byte, 16)
38
n, err := io.ReadFull(rand.Reader, uuid)
39
if n != len(uuid) || err != nil {
42
uuid[8] = uuid[8]&^0xc0 | 0x80
43
uuid[6] = uuid[6]&^0xf0 | 0x40
44
return fmt.Sprintf("%x-%x-%x-%x-%x", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]), nil