Migrate to go-acme/lego.

This commit is contained in:
Ludovic Fernandez 2019-03-14 11:04:04 +01:00 committed by Traefiker Bot
parent 4a68d29ce2
commit 87da7520de
286 changed files with 14021 additions and 2501 deletions

View file

@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"
"github.com/satori/go.uuid"
uuid "github.com/satori/go.uuid"
)
// UUID holds a UUID v4
@ -12,12 +12,36 @@ type UUID struct {
uuid.UUID
}
// Equal returns true if itself is equal to other
// DeepCopy create a true copy of the receiver.
func (u *UUID) DeepCopy() *UUID {
if u == nil {
return nil
}
out := [uuid.Size]byte{}
copy(out[:], u.Bytes())
return &UUID{
(uuid.UUID)(out),
}
}
// DeepCopyInto copies the receiver into out.
//
// In must be non nil.
func (u *UUID) DeepCopyInto(out *UUID) {
o := [uuid.Size]byte{}
copy(o[:], u.Bytes())
out.UUID = (uuid.UUID)(o)
}
// Equal returns true if itself is equal to other.
func (u UUID) Equal(other UUID) bool {
return uuid.Equal(u.UUID, other.UUID)
}
// UnmarshalJSON unmarshals the raw JSON into the MAC address
// UnmarshalJSON unmarshals the raw JSON into the UUID.
func (u *UUID) UnmarshalJSON(b []byte) error {
var s string
if err := json.Unmarshal(b, &s); err != nil {
@ -31,12 +55,12 @@ func (u *UUID) UnmarshalJSON(b []byte) error {
return err
}
// MarshalJSON converts the UUID to a string representation
// MarshalJSON converts the UUID to a string representation.
func (u UUID) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf("%q", u.String())), nil
}
// ParseUUID parses a string into a UUID
// ParseUUID parses a string into a UUID.
func ParseUUID(s string) (*UUID, error) {
u, err := uuid.FromString(s)
if err != nil {
@ -45,7 +69,7 @@ func ParseUUID(s string) (*UUID, error) {
return &UUID{u}, nil
}
// MustParseUUID acts like ParseUUID but panic in case of a failure
// MustParseUUID acts like ParseUUID but panic in case of a failure.
func MustParseUUID(s string) *UUID {
u, e := ParseUUID(s)
if e != nil {