Documentation
¶
Index ¶
- Constants
- Variables
- func AddBodyParamsToContextMap(body string, contextMap map[string]string)
- func AddQueryParamsToContextMap(r *http.Request, contextMap map[string]string)
- func AlphaNumericMacAddress(macAddress string) string
- func CaseInsensitiveContains(data []string, x string) bool
- func Contains(collection interface{}, element interface{}) bool
- func ContainsAny(collection1 []string, collection2 []string) bool
- func ContainsIgnoreCase(s, substr string) bool
- func ContainsInt(data []int, x int) bool
- func Copy(obj interface{}) (interface{}, error)
- func FindEntryInContext(filterContext map[string]string, key string, exact bool) (value string, found bool)
- func FindValidIpAddress(req *http.Request, contextIpAddress string) string
- func GenerateRandomCpeMac() string
- func GetAuditId() string
- func GetEcmMacAddress(mac string) string
- func GetEstbMacAddress(mac string) string
- func GetTelemetryQueryString(header http.Header, mac string) string
- func GetTimestamp(args ...time.Time) int64
- func GetURLQueryParameterString(kvs [][]string) (string, error)
- func HelpfulJSONUnmarshalErr(jsonBytes []byte, tag string, err error) string
- func IsBlank(str string) bool
- func IsUnknownValue(param string) bool
- func IsValidMacAddress(macaddr string) bool
- func JSONMarshal(t interface{}) ([]byte, error)
- func MACAddressValidator(macAddress string) (bool, error)
- func NewStringSet(collection []string) map[string]struct{}
- func NormalizeMacAddress(macAddress string) string
- func PutIfValuePresent(m map[string]interface{}, k string, v interface{})
- func RandomDouble() float64
- func RandomPercentage() int
- func RemoveOneElementFromList(ids []string, idToRemove string) []string
- func StringAppendIfMissing(collection []string, s string) []string
- func StringArrayContains(collection []string, value string) bool
- func StringCopySlice(collection []string) []string
- func StringElementsMatch(a, b []string) bool
- func StringSliceContains(s []string, searchterm string) bool
- func ToAlphaNumericString(str string) string
- func ToColonMac(d string) string
- func UUIDFromTime(timestamp int64, node int64, clockSeq uint32) (gocql.UUID, error)
- func UtcCurrentTimestamp() time.Time
- func UtcOffsetPriorMinTimestamp(min int) int64
- func UtcOffsetTimestamp(sec int) time.Time
- func UtcTimeInNano() int64
- func ValidateAndNormalizeMacAddress(macaddr string) (string, error)
- func ValidateCronDayAndMonth(cronExpression string) error
- func ValidatePokeQuery(values url.Values) (string, error)
- func ValidateTelemetryTwoProfileJson(json string) error
- func ValidateTimeFormat(timeStr string) error
- func ValidateTimezoneList(timezoneList string) error
- func XConfJSONMarshal(v interface{}, safeEncoding bool) ([]byte, error)
- type Set
- type StringMap
Constants ¶
const ( HeaderAuthorization = "Authorization" HeaderUserAgent = "User-Agent" HeaderIfNoneMatch = "If-None-Match" HeaderFirmwareVersion = "X-System-Firmware-Version" HeaderSupportedDocs = "X-System-Supported-Docs" HeaderSupplementaryService = "X-System-SupplementaryService-Sync" HeaderModelName = "X-System-Model-Name" HeaderProfileVersion = "X-System-Telemetry-Profile-Version" HeaderPartnerID = "X-System-PartnerID" HeaderAccountID = "X-System-AccountID" HeaderXconfDataService = "XconfDataService" HeaderXconfAdminService = "XconfAdminService" )
const (
TelemetryTwoProfileJSONSchema = `` /* 19660-byte string literal not displayed */
)
Variables ¶
var (
SupportedPokeDocs = []string{"primary", "telemetry"}
)
var (
TZ, _ = time.LoadLocation("UTC")
)
var TelemetryTwoProfileSchema *gojsonschema.Schema
Functions ¶
func AlphaNumericMacAddress ¶
AlphaNumericMacAddress is converting MAC address to only alphanumeric
func CaseInsensitiveContains ¶
func ContainsAny ¶
func ContainsIgnoreCase ¶
func ContainsInt ¶
TODO keep it for backward compatibility in "webconfig" for now
plan to remove it later
func FindEntryInContext ¶
func FindValidIpAddress ¶
* * Most important is IP from 'X-Forwarded-For' or 'HA-Forwarded-For' header. If it's valid we use it. * If not then check value from context. If valid - use it. * If not then read remote address from request info. If valid - use it. * At edge case when nothing above is a correct IP address then we fallback to '0.0.0.0' * @param contextIpAddress ip address from request context * @param req http request meta info
func GenerateRandomCpeMac ¶
func GenerateRandomCpeMac() string
func GetAuditId ¶
func GetAuditId() string
func GetEcmMacAddress ¶
func GetEstbMacAddress ¶
func GetTimestamp ¶
GetTimestamp - return current timestamp in Millisecond in UTC timezone or convert specified time to Millisecond
func GetURLQueryParameterString ¶
REMINDER a 2-D slices/arrays of strings are chosen, instead of a map, to keep the params ordering
func HelpfulJSONUnmarshalErr ¶
HelpfulJSONUnmarshalErr just points near the location of json err when possible jsonStr is the string we tried to unmarshal tag is just a string identifying who ran into this err, will be part of the return string err is the original err got when unmarshalling return a string that contains the offset of the err location Copied from xap_proxy
func IsUnknownValue ¶
func IsValidMacAddress ¶
func JSONMarshal ¶
JSONMarshal is used to marshal struct to string Without escaping special character like &, <, > Note: JSONMarshal will terminate each value with a newline
func MACAddressValidator ¶
MACAddressValidator method is to validate MAC address Validate inputs are:
11-11-11-11-11-11 11:11:11:11:11:11 1111.1111.1111 11111111111
func NewStringSet ¶
func NormalizeMacAddress ¶
Use this function only if you know the mac address is valid
func PutIfValuePresent ¶
func RandomDouble ¶
func RandomDouble() float64
func RandomPercentage ¶
func RandomPercentage() int
func StringAppendIfMissing ¶
func StringArrayContains ¶
func StringCopySlice ¶
func StringElementsMatch ¶
func StringSliceContains ¶
func ToAlphaNumericString ¶
func ToColonMac ¶
func UUIDFromTime ¶
UUIDFromTime gocql method implementation
func UtcCurrentTimestamp ¶
UtcCurrentTimestamp - return current timestamp in UTC timezone
func UtcOffsetPriorMinTimestamp ¶
UtcOffsetPriorminTimestamp currect timestamp
func UtcOffsetTimestamp ¶
UtcOffsetTimestamp currect timestamp
func UtcTimeInNano ¶
func UtcTimeInNano() int64
UtcTimeInNano - return current time in nano in UTC timezone
func ValidateAndNormalizeMacAddress ¶
ValidateAndNormalizeMacAddress is to validate and convert MAC address to XX:XX:XX:XX:XX:XX
func ValidateCronDayAndMonth ¶
func ValidateTelemetryTwoProfileJson ¶
ValidateTelemetryTwoProfileJson validates JSON against the schema