Documentation
¶
Overview ¶
Copyright 2019 HAProxy Technologies
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.
Copyright 2019 HAProxy Technologies ¶
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.
Index ¶
- Variables
- func BoolP(b bool) *bool
- func CamelCase(fieldName string, initCase bool) string
- func CheckOrCreateWritableDirectory(dirname string) (string, error)
- func CreateTempDir(config string, createFile bool, extension ...string) (string, string, error)
- func CreateTypeAssertError(msg string) error
- func DashCase(input string) string
- func GetObjByField(l []any, identifier string, value string) any
- func GetServerAdminState(state string) (string, error)
- func Int64P(i int) *int64
- func IsZeroValue(v reflect.Value) bool
- func ObjInArray(value string, y []any, identifier string) bool
- func ParseBindAddress(path string) (string, string, error)
- func ParseMetadata(comment string) map[string]any
- func ParseSize(size string) *int64
- func ParseTimeout(tOut string) *int64
- func ParseTimeoutDefaultSeconds(tOut string) *int64
- func Ptr[V any](v V) *V
- func RandomString(n int) string
- func SanitizeFilename(name string) string
- func SanitizeIPv6Address(addr string) string
- func SerializeMetadata(metadata map[string]any) (string, error)
- func SerializeSize(n int64) string
- func SerializeTime(ms int64, preferredSuffix string) string
- func SnakeCase(fieldName string) string
- func StringInSlice(a string, list []string) bool
- func StringP(s string) *string
- type Bits
- type TimeSuffix
Constants ¶
This section is empty.
Variables ¶
var ErrTypeAssert = errors.New("type assert error")
Functions ¶
func CreateTempDir ¶
CreateTempDir will create a new temporary dir. If config is provided it will create a file with its content
func CreateTypeAssertError ¶
func GetObjByField ¶
GetObjByField returns struct from list l if it has field named identifier with value value
func GetServerAdminState ¶
GetServerAdminState parses srv_admin_state, srv_admin_state is a mask
func IsZeroValue ¶
IsZeroValue is a helper method for reflect, checks if reflect.Value has zero value
func ObjInArray ¶
ObjInArray returns true if struct in list y has field named identifier with value value
func ParseMetadata ¶ added in v6.3.0
func ParseTimeout ¶
ParseTimeout returns the number of milliseconds in a timeout string.
func RandomString ¶
func SanitizeFilename ¶
SanitizeFilename collapses paths and replaces most non-alphanumeric characters with underscores
func SanitizeIPv6Address ¶
func SerializeMetadata ¶ added in v6.3.0
func SerializeSize ¶
Serialize a number of bytes as per "Size format" in HAProxy.
func SerializeTime ¶
Serialize a number of milliseconds as per HAProxy's Time format.
func StringInSlice ¶
StringInSlice checks if a string is in a list of strings
Types ¶
type TimeSuffix ¶
type TimeSuffix string
HAProxy's Time suffixes
const ( None TimeSuffix = "none" Milli TimeSuffix = "ms" Sec TimeSuffix = "s" Min TimeSuffix = "m" Hour TimeSuffix = "h" Day TimeSuffix = "d" Nearest TimeSuffix = Day )