Documentation ¶
Overview ¶
Package templates [provides utility functions to enable templating in app configuration]
Index ¶
- func Execute(logger *zap.Logger, tpl *template.Template, data interface{}) string
- func LocalIPV4() string
- func LocalIPV6() string
- func LocalMacAddres() string
- func Parse(input string) (*template.Template, error)
- func ParseAndExecute(logger *zap.Logger, input string, data interface{}) string
- func ParseAndExecuteMapStruct(logger *zap.Logger, input map[string]interface{}, data interface{}) map[string]interface{}
- func RandomIP() string
- func RandomMacAddr() net.HardwareAddr
- func RandomPayload(length int) string
- func RandomPayloadByte(length int) []byte
- func RandomPort() int
- func ResolveHostIPV4(host string) (string, error)
- func ResolveHostIPV6(host string) (string, error)
- type ContextKey
- type MapStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LocalIPV4 ¶
func LocalIPV4() string
LocalIPV4 returns the first non loopback local ipv4 of the host
func LocalIPV6 ¶
func LocalIPV6() string
LocalIPV6 returns the first non loopback local ipv4 of the host
func ParseAndExecute ¶
ParseAndExecute template, returns input string in case of errors. Expensive operation.
func ParseAndExecuteMapStruct ¶
func ParseAndExecuteMapStruct(logger *zap.Logger, input map[string]interface{}, data interface{}) map[string]interface{}
ParseAndExecuteMapStruct is like ParseAndExecute but takes mapstructure as input
func RandomMacAddr ¶
func RandomMacAddr() net.HardwareAddr
RandomMacAddr returns a random mac address to spoof packets
func RandomPayload ¶
RandomPayload returns a byte slice to spoof ip packets with random payload in specified length
func RandomPayloadByte ¶
RandomPayloadByte returns a byte slice to spoof ip packets with random payload in specified length
func ResolveHostIPV4 ¶
ResolveHostIPV4 function gets a string and returns the ipv4 address
func ResolveHostIPV6 ¶
ResolveHostIPV6 function gets a string and returns the ipv4 address
Types ¶
type ContextKey ¶
type ContextKey string
ContextKey used to work with context and not trigger linter
type MapStruct ¶
type MapStruct struct {
// contains filtered or unexported fields
}
MapStruct is a helper structure to parse configs in a format accepted by mapstructure package
func ParseMapStruct ¶
ParseMapStruct is like Parse but takes mapstructure as input