dataplane

package
v1.4.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ANY string
	ANY string = "ANY"
	// MinUnsortedIPSetLength indicates the minimum length of an unsorted IP set's origin (i.e dst,dst)
	MinUnsortedIPSetLength int = 3
	// Base indicate the base for ParseInt
	Base int = 10
	// Bitsize indicate the bitsize for ParseInt
	Bitsize int = 32
)

Variables

View Source
var AzureNPMChains = []string{
	"AZURE-NPM-INGRESS-DROPS",
	"AZURE-NPM-INGRESS-FROM",
	"AZURE-NPM-INGRESS-PORT",
	"AZURE-NPM-EGRESS-DROPS",
	"AZURE-NPM-EGRESS-PORT",
	"AZURE-NPM-EGRESS-TO",
}

AzureNPMChains contains names of chain that will be include in the result of the converter

View Source
var MembersBytes = []byte("Members")

MembersBytes is the string "Members" in bytes array

Functions

This section is empty.

Types

type Converter

type Converter struct {
	ListMap        map[string]string // key: hash(value), value: one of namespace, label of namespace, multiple values
	SetMap         map[string]string // key: hash(value), value: one of label of pods, cidr, namedport
	AzureNPMChains map[string]bool
	NPMCache       *cache.NPMCache
}

Converter struct

func (*Converter) GetJSONRulesFromIptableFile

func (c *Converter) GetJSONRulesFromIptableFile(
	tableName string,
	npmCacheFile string,
	iptableSaveFile string,
) ([][]byte, error)

GetJSONRulesFromIptableFile returns a list of json rules from npmCache and iptable-save files.

func (*Converter) GetJSONRulesFromIptables

func (c *Converter) GetJSONRulesFromIptables(tableName string) ([][]byte, error)

GetJSONRulesFromIptables returns a list of json rules from node

func (*Converter) GetProtobufRulesFromIptable

func (c *Converter) GetProtobufRulesFromIptable(tableName string) ([]*pb.RuleResponse, error)

GetProtobufRulesFromIptable returns a list of protobuf rules from node.

func (*Converter) GetProtobufRulesFromIptableFile

func (c *Converter) GetProtobufRulesFromIptableFile(
	tableName string,
	npmCacheFile string,
	iptableSaveFile string,
) ([]*pb.RuleResponse, error)

GetProtobufRulesFromIptableFile returns a list of protobuf rules from npmCache and iptable-save files.

func (*Converter) NpmCache

func (c *Converter) NpmCache() error

NpmCache initialize NPM cache from node.

func (*Converter) NpmCacheFromFile

func (c *Converter) NpmCacheFromFile(npmCacheJSONFile string) error

NpmCacheFromFile initialize NPM cache from file.

type Input

type Input struct {
	Content string
	Type    InputType
}

Input struct

type InputType

type InputType int32

InputType indicates allowed typle for source and destination input

const (
	// IPADDRS indicates the IP Address input type
	IPADDRS InputType = 0
	// PODNAME indicates the podname input type
	PODNAME InputType = 1
	// EXTERNAL indicates the external input type
	EXTERNAL InputType = 2
)

func GetInputType

func GetInputType(input string) InputType

GetInputType returns the type of the input for GetNetworkTuple.

type Tuple

type Tuple struct {
	RuleType  string `json:"ruleType"`
	Direction string `json:"direction"`
	SrcIP     string `json:"srcIP"`
	SrcPort   string `json:"srcPort"`
	DstIP     string `json:"dstIP"`
	DstPort   string `json:"dstPort"`
	Protocol  string `json:"protocol"`
}

Tuple struct

func GetNetworkTuple

func GetNetworkTuple(src, dst *Input) ([][]byte, []*Tuple, error)

GetNetworkTuple read from node's NPM cache and iptables-save and returns a list of hit rules between the source and the destination in JSON format and a list of tuples from those rules.

func GetNetworkTupleFile

func GetNetworkTupleFile(
	src, dst *Input,
	npmCacheFile string,
	iptableSaveFile string,
) ([][]byte, []*Tuple, error)

GetNetworkTupleFile read from NPM cache and iptables-save files and returns a list of hit rules between the source and the destination in JSON format and a list of tuples from those rules.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL