Documentation ¶
Overview ¶
Package templates [provides utility functions to enable templating in app configuration]
Index ¶
- func Execute(logger *zap.Logger, tpl *template.Template, data any) 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 any) string
- func ParseAndExecuteMapStruct(logger *zap.Logger, input map[string]any, data any) map[string]any
- 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 ¶ added in v0.8.0
func LocalIPV4() string
LocalIPV4 returns the first non loopback local ipv4 of the host
func LocalIPV6 ¶ added in v0.8.0
func LocalIPV6() string
LocalIPV6 returns the first non loopback local ipv4 of the host
func LocalMacAddres ¶ added in v0.8.0
func LocalMacAddres() string
LocalMacAddres returns first valid mac address
func ParseAndExecute ¶
ParseAndExecute template, returns input string in case of errors. Expensive operation.
func ParseAndExecuteMapStruct ¶
ParseAndExecuteMapStruct is like ParseAndExecute but takes mapstructure as input
func RandomIP ¶ added in v0.8.0
func RandomIP() string
RandomIP returns a random ip to spoof packets.
func RandomMacAddr ¶ added in v0.8.0
func RandomMacAddr() net.HardwareAddr
RandomMacAddr returns a random MAC address to spoof packets.
func RandomPayload ¶ added in v0.8.0
RandomPayload returns a string to spoof ip packets with random payload in specified length.
func RandomPayloadByte ¶ added in v0.8.3
RandomPayloadByte returns a byte slice to spoof ip packets with random payload in specified length.
func RandomPort ¶ added in v0.8.0
func RandomPort() int
RandomPort returns a random port to spoof packets.
func ResolveHostIPV4 ¶ added in v0.8.0
ResolveHostIPV4 function gets a string and returns the ipv4 address
func ResolveHostIPV6 ¶ added in v0.8.0
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