Documentation
¶
Overview ¶
*
- Copyright 2022 Comcast Cable Communications Management, LLC *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. *
- SPDX-License-Identifier: Apache-2.0
*
- Copyright 2022 Comcast Cable Communications Management, LLC *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. *
- SPDX-License-Identifier: Apache-2.0
*
- Copyright 2022 Comcast Cable Communications Management, LLC *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. *
- SPDX-License-Identifier: Apache-2.0
*
- Copyright 2022 Comcast Cable Communications Management, LLC *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. *
- SPDX-License-Identifier: Apache-2.0
*
- Copyright 2022 Comcast Cable Communications Management, LLC *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. *
- SPDX-License-Identifier: Apache-2.0
*
- Copyright 2022 Comcast Cable Communications Management, LLC *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. *
- SPDX-License-Identifier: Apache-2.0
*
- Copyright 2022 Comcast Cable Communications Management, LLC *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. *
- SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- func AlphaNumericMacAddress(macAddress string) string
- func ApiVersionGreaterOrEqual(version string, value float32) bool
- func CalculateHash(plainText string) string
- func CaseInsensitiveContains(data []string, x string) bool
- func Contains(collection interface{}, element interface{}) bool
- func ContainsAny(collection1 []string, collection2 []string) bool
- func ContainsInt(data []int, x int) bool
- func ConvertIpBytesToString(bbytes []byte) string
- func Copy(obj interface{}) (interface{}, error)
- func CreateConfigMapStringBool(conf *configuration.Config, s string) map[string]bool
- func CreateConfigMapStringString(conf *configuration.Config, s string) map[string]string
- func CreateKeyValuePairsFromMap(m map[string]string) string
- func GenerateRandomCpeMac() string
- func GetAuditId() string
- func GetCRC32HashValue(text string) string
- func GetEcmMacAddress(mac string) string
- func GetEstbMacAddress(mac string) string
- func GetIpAddress(r *http.Request, ipAddress string, fields log.Fields) string
- func GetIpAddressWithoutQueryParam(r *http.Request) (string, bool, bool)
- func GetTelemetryQueryString(header http.Header, mac string) string
- func GetTimestamp(args ...time.Time) int64
- func GetURLQueryParameterString(kvs [][]string) (string, error)
- func Ipv4NetworkMask(prefixLength int) net.IPMask
- func Ipv6NetworkMask(prefixLength int) net.IPMask
- func IsBlank(str string) bool
- func IsIPv4(ip net.IP) bool
- func IsIPv4LiteralAddress(src string) bool
- func IsInSameNetwork(ip1Str, ip2Str string, mask net.IPMask) (bool, error)
- func IsUnknownValue(param string) bool
- func IsValidAppSetting(key string) bool
- func IsValidMacAddress(macaddr string) bool
- func IsValidMacAddressForAdminService(macaddr string) bool
- func IsVersionGreaterOrEqual(version string, value float64) bool
- func JSONMarshal(t interface{}) ([]byte, error)
- func MACAddressValidator(macAddress string) (bool, error)
- func MACAddressValidatorForAS(macAddress string) (bool, error)
- func MacAddrComplexFormat(macaddr string) (string, error)
- func NewStringSet(collection []string) map[string]struct{}
- func NormalizeMacAddress(macAddress string) string
- func PrettyJson(input interface{}) string
- func PutIfValuePresent(m map[string]interface{}, k string, v interface{})
- func RandomDouble() float64
- func RandomPercentage() int
- func RemoveNonAlphabeticSymbols(macAddress string) string
- func StringAppendIfMissing(collection []string, s string) []string
- func StringElementsMatch(a, b []string) bool
- func StringSliceEqual(a, b []string) bool
- func TextToNumericFormatV4(src string) []byte
- func ToAlphaNumericString(str string) string
- func ToColonMac(d string) string
- func ToInt(itf interface{}) int
- func UUIDFromTime(timestamp int64, node int64, clockSeq uint32) (gocql.UUID, error)
- func UtcCurrentTimestamp() time.Time
- func UtcOffsetTimestamp(sec int) time.Time
- func UtcTimeInNano() int64
- func ValidateAndNormalizeMacAddress(macaddr string) (string, error)
- func ValidateMac(mac string) bool
- func XConfJSONMarshal(v interface{}, safeEncoding bool) ([]byte, error)
- type Dict
- type Set
Constants ¶
const (
INADDR4SZ = 4
)
Variables ¶
var (
TZ, _ = time.LoadLocation("UTC")
)
Functions ¶
func AlphaNumericMacAddress ¶
AlphaNumericMacAddress is converting MAC address to only alphanumeric
func CalculateHash ¶
func CaseInsensitiveContains ¶
func ContainsAny ¶
func ContainsInt ¶
TODO keep it for backward compatibility in "webconfig" for now
plan to remove it later
func ConvertIpBytesToString ¶
func CreateConfigMapStringBool ¶
func CreateConfigMapStringBool(conf *configuration.Config, s string) map[string]bool
func CreateConfigMapStringString ¶
func CreateConfigMapStringString(conf *configuration.Config, s string) map[string]string
func GenerateRandomCpeMac ¶
func GenerateRandomCpeMac() string
func GetAuditId ¶
func GetAuditId() string
func GetCRC32HashValue ¶
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 Ipv4NetworkMask ¶
func Ipv6NetworkMask ¶
generate Ipv6 network mask string
func IsIPv4LiteralAddress ¶
*
- @param src a String representing an IPv4 address in textual format
- @return a boolean indicating whether src is an IPv4 literal address
func IsUnknownValue ¶
func IsValidAppSetting ¶
func IsValidMacAddress ¶
func IsVersionGreaterOrEqual ¶
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 11:11:11:11:11:11 11111111111
:param value: A String :return: A String, upper case mac address, AABBCCDDEEFF ”'
func MacAddrComplexFormat ¶
MacAddrComplexFormat is to convert mac address from XXXXXXXXXXX to XX:XX:XX:XX:// XXX
func NewStringSet ¶
func NormalizeMacAddress ¶
func PrettyJson ¶
func PrettyJson(input interface{}) string
func PutIfValuePresent ¶
func RandomDouble ¶
func RandomDouble() float64
func RandomPercentage ¶
func RandomPercentage() int
RandomPercentage returns a random integer between 0 and 99 (inclusive). WARNING: This function uses math/rand which is NOT cryptographically secure. It should ONLY be used for non-security critical operations like load balancing or gradual feature rollouts, never for security purposes, authentication, or encryption.
func StringAppendIfMissing ¶
func StringElementsMatch ¶
func StringSliceEqual ¶
func TextToNumericFormatV4 ¶
* Converts IPv4 address in its textual presentation form * into its numeric binary form. * * @param src a String representing an IPv4 address in standard format * @return a byte array representing the IPv4 numeric address
func ToAlphaNumericString ¶
func ToColonMac ¶
func UUIDFromTime ¶
UUIDFromTime gocql method implementation
func UtcCurrentTimestamp ¶
UtcCurrentTimestamp - return current timestamp in UTC timezone
func UtcOffsetTimestamp ¶
UtcOffsetTimestamp currect timestamp
func UtcTimeInNano ¶
func UtcTimeInNano() int64
UtcTimeInNano - return current time in nano in UTC timezone
func ValidateMac ¶
func XConfJSONMarshal ¶
Types ¶
type Dict ¶
type Dict map[string]interface{}