Help us shape the future of Go! Take the 2026 Go Developer Survey

debug

package
v1.7.20 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 26 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 (
	ErrUnknownSetType = fmt.Errorf("unknown set type")
	EgressChain       = "AZURE-NPM-EGRESS"
	EgressChainPrefix = EgressChain + "-"

	IngressChain       = "AZURE-NPM-INGRESS"
	IngressChainPrefix = IngressChain + "-"
)
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

func PrettyPrintTuples

func PrettyPrintTuples(tuples []*TupleAndRule, srcList map[string]*pb.RuleResponse_SetInfo, dstList map[string]*pb.RuleResponse_SetInfo)

Types

type Converter

type Converter struct {
	NPMDebugEndpointHost string
	NPMDebugEndpointPort string
	Parser               parse.IPTablesParser
	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             npmcommon.GenericCache
	EnableV2NPM          bool
}

Converter struct

func (*Converter) GetNetworkTuple

func (c *Converter) GetNetworkTuple(src, dst *common.Input, config *npmconfig.Config) ([][]byte, []*TupleAndRule, map[string]*pb.RuleResponse_SetInfo, map[string]*pb.RuleResponse_SetInfo, 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 (*Converter) GetNetworkTupleFile

func (c *Converter) GetNetworkTupleFile(
	src, dst *common.Input,
	npmCacheFile string,
	iptableSaveFile string,
) ([][]byte, []*TupleAndRule, map[string]*pb.RuleResponse_SetInfo, map[string]*pb.RuleResponse_SetInfo, 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.

func (*Converter) GetProtobufRulesFromIptable

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

GetProtobufRulesFromIptable returns a list of protobuf rules from node.

func (*Converter) GetProtobufRulesFromIptableFile

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

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

func (*Converter) InitConverter

func (c *Converter) InitConverter() error

Initialize converter from node.

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 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

type TupleAndRule

type TupleAndRule struct {
	Tuple *Tuple
	Rule  *pb.RuleResponse
}

Jump to

Keyboard shortcuts

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