DiameterAgent config skel

This commit is contained in:
DanB
2015-11-13 19:11:38 +01:00
parent cc6f614aee
commit 04c8c10877
8 changed files with 236 additions and 1 deletions

View File

@@ -239,6 +239,7 @@ const (
EXTRA_FIELDS = "ExtraFields"
META_SURETAX = "*sure_tax"
SURETAX = "suretax"
DIAMETER_AGENT = "diameter_agent"
COUNTER_EVENT = "*event"
COUNTER_BALANCE = "*balance"
EVENT_NAME = "EventName"

View File

@@ -20,9 +20,10 @@ package utils
import (
"archive/zip"
"bytes"
"crypto/rand"
"crypto/sha1"
"encoding/gob"
"encoding/json"
"errors"
"fmt"
@@ -406,3 +407,17 @@ func ConvertIfaceToString(fld interface{}) (string, bool) {
}
return strVal, converted
}
// Simple object cloner, b should be a pointer towards a value into which we want to decode
func Clone(a, b interface{}) error {
buff := new(bytes.Buffer)
enc := gob.NewEncoder(buff)
dec := gob.NewDecoder(buff)
if err := enc.Encode(a); err != nil {
return err
}
if err := dec.Decode(b); err != nil {
return err
}
return nil
}