Documentation ¶
Index ¶
- Constants
- Variables
- func CheckHTTPMethod(method string) bool
- func CheckSpecHTTP(specs []string) bool
- func ClearDBTablesMySQL() error
- func Combinations(set []string, n int) (subsets [][]string)
- func ConnectInClusterAPIClient() *kubernetes.Clientset
- func ConnectK8sClient() *kubernetes.Clientset
- func ConnectLocalAPIClient() *kubernetes.Clientset
- func ConnectMongoDB() (*mongo.Client, *mongo.Database)
- func ConnectMySQL() (db *sql.DB)
- func ContainLabel(label, targetLabel string) bool
- func ContainsElement(slice interface{}, element interface{}) bool
- func ConvertArrayToString(arr []string) string
- func ConvertUnixTSToDateTime(ts int64) primitive.DateTime
- func CountLabelByCombinations(labelCount map[string]int, mergedLabels string)
- func CountPoliciesByName(col *mongo.Collection, name string) int
- func CreateTableNetworkLogsMySQL() error
- func CreateTableNetworkPolicyMySQL() error
- func GetCommandOutput(cmd string, args []string) string
- func GetDocsByFilter(col *mongo.Collection, filter primitive.M) ([]map[string]interface{}, error)
- func GetEndpoints() []types.Endpoint
- func GetEnv(key, fallback string) string
- func GetEnvInt(key string, fallback int) int
- func GetExternalIPAddr() string
- func GetExternalInterface() string
- func GetIPAddr(ifname string) string
- func GetNamespaces() []string
- func GetNetworkPolicies(namespace, status string) []types.KnoxNetworkPolicy
- func GetNetworkPoliciesBySelector(namespace, status string, selector map[string]string) ([]types.KnoxNetworkPolicy, error)
- func GetNetworkPoliciesFromMongo(namespace, status string) ([]types.KnoxNetworkPolicy, error)
- func GetNetworkPoliciesFromMySQL(namespace, status string) ([]types.KnoxNetworkPolicy, error)
- func GetOSSigChannel() chan os.Signal
- func GetPods() []types.Pod
- func GetProtocol(protocol int) string
- func GetProtocolInt(protocol string) int
- func GetServices() []types.Service
- func GetTrafficFlow() ([]map[string]interface{}, error)
- func GetTrafficFlowByIDTime(id, endTime int64) ([]map[string]interface{}, error)
- func GetTrafficFlowByTime(startTime, endTime int64) ([]map[string]interface{}, error)
- func GetTrafficFlowFromDB() []map[string]interface{}
- func GetTrafficFlowFromMongo(startTime, endTime int64) ([]map[string]interface{}, error)
- func InsertDiscoveredPolicies(policies []types.KnoxNetworkPolicy)
- func InsertDiscoveredPoliciesToMongoDB(policies []types.KnoxNetworkPolicy) error
- func InsertDiscoveredPoliciesToMySQL(policies []types.KnoxNetworkPolicy) error
- func InsertNetworkLogsMongoDB(netLogs []types.NetworkLogRaw) error
- func InsertNetworkLogsMySQL(netLogs []types.NetworkLogRaw) error
- func IsK8sEnv() bool
- func Prefix(strs []string) string
- func PrintKnoxPolicyJSON(data interface{}) (string, error)
- func RandSeq(n int) string
- func SetAnnotationsToPod(podName string, annotation map[string]string) error
- func SetAnnotationsToPodsInNamespace(namespace string, annotation map[string]string) error
- func Suffix(strs []string) string
- func TrimPrefix(strs []string)
- func TrimSuffix(strs []string)
- func UpdateOrInsertNetworkLogs(netLogs []types.NetworkLogRaw)
- func UpdateOutdatedPolicy(outdatedPolicy string, latestPolicy string)
- func UpdateOutdatedPolicyFromMongo(outdatedPolicy string, latestPolicy string) error
- func UpdateOutdatedPolicyFromMySQL(outdatedPolicy string, latestPolicy string) error
- func UpdateTimeFilters(filter primitive.M, tsStart, tsEnd int64)
- func WriteCiliumPolicyToYamlFile(namespace string, policies []types.CiliumNetworkPolicy)
- func WriteKnoxPolicyToJSONFile(namespace string, policies []types.KnoxNetworkPolicy)
- func WriteKnoxPolicyToYamlFile(namespace string, policies []types.KnoxNetworkPolicy)
Constants ¶
const ( STATUS = "Passed" LIMIT = " limit " BACK_SLASH = "\"" COMMA = "," QUOTATION = `"` INGRESS = "INGRESS" EGRESS = "EGRESS" FORWARDED = "FORWARDED" DROPPED = "DROPPED" ERROR = "ERROR" AUDIT = "AUDIT" L7 = "L7" L3_L4 = "L3_L4" )
Basic Constant
const ( TimeForm string = "2006-01-02T15:04:05.000000" TimeFormSimple string = "2006-01-02 15:04:05" TimeFormUTC string = "2006-01-02T15:04:05.000000Z" TimeFormHuman string = "2006-01-02 15:04:05.000000" TimeCilium string = "2006-01-02T15:04:05.000000000Z" )
Time Format
Variables ¶
var ( TableNetworkFlow string TableDiscoveredPolicy string DBDriver string DBHost string DBPort string DBUser string DBPass string DBName string )
env values
var QueryBaseSimple string = "select id,time,traffic_direction,verdict,policy_match_type,drop_reason,event_type,source,destination,ip,l4,l7 from "
QueryBaseSimple
Functions ¶
func ClearDBTablesMySQL ¶
func ClearDBTablesMySQL() error
func Combinations ¶
Combinations Function
func ConnectInClusterAPIClient ¶
func ConnectInClusterAPIClient() *kubernetes.Clientset
ConnectInClusterAPIClient Function
func ConnectLocalAPIClient ¶
func ConnectLocalAPIClient() *kubernetes.Clientset
ConnectLocalAPIClient Function
func ConnectMongoDB ¶
ConnectMongoDB function
func ContainsElement ¶
func ContainsElement(slice interface{}, element interface{}) bool
ContainsElement Function
func ConvertArrayToString ¶
ConvertArrayToString - Convert Array of string to String
func ConvertUnixTSToDateTime ¶
ConvertUnixTSToDateTime Function
func CountLabelByCombinations ¶
CountLabelByCombinations Function (combination!)
func CountPoliciesByName ¶
func CountPoliciesByName(col *mongo.Collection, name string) int
CountPoliciesByName Function
func CreateTableNetworkLogsMySQL ¶
func CreateTableNetworkLogsMySQL() error
func CreateTableNetworkPolicyMySQL ¶
func CreateTableNetworkPolicyMySQL() error
func GetCommandOutput ¶
GetCommandOutput Function
func GetDocsByFilter ¶
GetDocsByFilter Function
func GetNetworkPolicies ¶
func GetNetworkPolicies(namespace, status string) []types.KnoxNetworkPolicy
GetNetworkPolicies Function
func GetNetworkPoliciesBySelector ¶
func GetNetworkPoliciesBySelector(namespace, status string, selector map[string]string) ([]types.KnoxNetworkPolicy, error)
GetNetworkPoliciesBySelector Function
func GetNetworkPoliciesFromMongo ¶
func GetNetworkPoliciesFromMongo(namespace, status string) ([]types.KnoxNetworkPolicy, error)
GetNetworkPoliciesFromMongo Function
func GetNetworkPoliciesFromMySQL ¶
func GetNetworkPoliciesFromMySQL(namespace, status string) ([]types.KnoxNetworkPolicy, error)
GetNetworkPoliciesFromMySQL function
func GetTrafficFlow ¶
GetTrafficFlow function
func GetTrafficFlowByIDTime ¶
GetTrafficFlowByIDTime function
func GetTrafficFlowByTime ¶
GetTrafficFlowByTime function
func GetTrafficFlowFromDB ¶
func GetTrafficFlowFromDB() []map[string]interface{}
GetTrafficFlowFromDB function
func GetTrafficFlowFromMongo ¶
GetTrafficFlowFromMongo function
func InsertDiscoveredPolicies ¶
func InsertDiscoveredPolicies(policies []types.KnoxNetworkPolicy)
InsertDiscoveredPolicies function
func InsertDiscoveredPoliciesToMongoDB ¶
func InsertDiscoveredPoliciesToMongoDB(policies []types.KnoxNetworkPolicy) error
InsertDiscoveredPoliciesToMongoDB function
func InsertDiscoveredPoliciesToMySQL ¶
func InsertDiscoveredPoliciesToMySQL(policies []types.KnoxNetworkPolicy) error
InsertDiscoveredPoliciesToMySQL function
func InsertNetworkLogsMongoDB ¶
func InsertNetworkLogsMongoDB(netLogs []types.NetworkLogRaw) error
InsertNetworkLogsMongoDB
func InsertNetworkLogsMySQL ¶
func InsertNetworkLogsMySQL(netLogs []types.NetworkLogRaw) error
InsertNetworkLogsMySQL -- Update existing log with time and count
func PrintKnoxPolicyJSON ¶
PrintKnoxPolicyJSON function
func SetAnnotationsToPod ¶
SetAnnotationsToPod Function
func SetAnnotationsToPodsInNamespace ¶
SetAnnotationsToPodsInNamespace Function
func TrimPrefix ¶
func TrimPrefix(strs []string)
TrimPrefix removes the longest common prefix from all provided strings
func TrimSuffix ¶
func TrimSuffix(strs []string)
TrimSuffix removes the longest common suffix from all provided strings
func UpdateOrInsertNetworkLogs ¶
func UpdateOrInsertNetworkLogs(netLogs []types.NetworkLogRaw)
UpdateOrInsertNetworkLogs function
func UpdateOutdatedPolicy ¶
UpdateOutdatedPolicy function
func UpdateOutdatedPolicyFromMongo ¶
UpdateOutdatedPolicyFromMongo function
func UpdateOutdatedPolicyFromMySQL ¶
UpdateOutdatedPolicyFromMySQL ...
func UpdateTimeFilters ¶
UpdateTimeFilters function
func WriteCiliumPolicyToYamlFile ¶
func WriteCiliumPolicyToYamlFile(namespace string, policies []types.CiliumNetworkPolicy)
WriteCiliumPolicyToYamlFile Function
func WriteKnoxPolicyToJSONFile ¶
func WriteKnoxPolicyToJSONFile(namespace string, policies []types.KnoxNetworkPolicy)
WriteKnoxPolicyToJSONFile Function
func WriteKnoxPolicyToYamlFile ¶
func WriteKnoxPolicyToYamlFile(namespace string, policies []types.KnoxNetworkPolicy)
WriteKnoxPolicyToYamlFile Function
Types ¶
This section is empty.