Documentation
¶
Index ¶
- Constants
- Variables
- func FileExist(path string) bool
- func FilterField(field string) bool
- func GenerateTwoUniqueRandomStrings() (string, string, error)
- func GenerateVerboseReason(ruleId string, expressionReason string, customReason string) string
- func GetClientIp(r *http.Request) string
- func GetCurrentTime() string
- func GetHostname() string
- func GetIdFromOwnerAndName(owner string, name string) string
- func GetOwnerAndNameFromId(id string) (string, string)
- func GetOwnerAndNameFromId3(id string) (string, string, string)
- func GetOwnerAndNameFromId3New(id string) (string, string, string)
- func IndexAt(s, sep string, n int) int
- func InitSelfGuard()
- func IsIntranetIp(ip string) bool
- func JsonToStruct(data string, v interface{}) error
- func ListFiles(path string) []string
- func ParseFloat(s string) float64
- func ParseInt(s string) int
- func ParseIntWithError(s string) (int, error)
- func ReadBytesFromPath(path string) []byte
- func ReadStringFromPath(path string) string
- func SnakeString(s string) string
- func StopOldInstance(port int) error
- func StructToJson(v interface{}) string
- func StructToJsonNoIndent(v interface{}) string
- func WriteBytesToPath(b []byte, path string)
- func WriteStringToPath(s string, path string)
- type Stack
Constants ¶
View Source
const ( // EnvSupervisorKey is the environment variable key to detect if running under supervisor EnvSupervisorKey = "CASWAF_SUPERVISED" // MaxRestarts is the maximum number of restarts within the restart window MaxRestarts = 5 // RestartWindow is the time window for counting restarts RestartWindow = 5 * time.Minute // RestartDelay is the delay before restarting after a crash RestartDelay = 2 * time.Second )
Variables ¶
View Source
var ( ReWhiteSpace *regexp.Regexp ReFieldWhiteList *regexp.Regexp )
Functions ¶
func FilterField ¶ added in v1.21.0
func GenerateTwoUniqueRandomStrings ¶ added in v1.3.0
func GenerateVerboseReason ¶ added in v1.60.0
GenerateVerboseReason creates a detailed reason message for verbose mode
func GetClientIp ¶ added in v1.18.0
func GetCurrentTime ¶ added in v1.3.0
func GetCurrentTime() string
func GetHostname ¶
func GetHostname() string
func GetIdFromOwnerAndName ¶
func GetOwnerAndNameFromId ¶
func InitSelfGuard ¶ added in v1.61.0
func InitSelfGuard()
InitSelfGuard initializes the self-recovery mechanism If not already supervised, it starts a supervisor process and exits If already supervised, it does nothing and returns
func IsIntranetIp ¶ added in v1.58.0
func JsonToStruct ¶
func ParseFloat ¶
func ParseIntWithError ¶
func ReadBytesFromPath ¶
func ReadStringFromPath ¶
func SnakeString ¶ added in v1.21.0
func StopOldInstance ¶ added in v1.56.0
func StructToJson ¶
func StructToJson(v interface{}) string
func StructToJsonNoIndent ¶ added in v1.3.0
func StructToJsonNoIndent(v interface{}) string
func WriteBytesToPath ¶
func WriteStringToPath ¶
Types ¶
type Stack ¶ added in v1.33.0
type Stack struct {
// contains filtered or unexported fields
}
Stack is a stack data structure implemented using a slice
func (*Stack) Peek ¶ added in v1.33.0
func (s *Stack) Peek() interface{}
Peek returns the last item from the stack without removing it
Click to show internal directories.
Click to hide internal directories.