cli

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCLI

func NewCLI(super *supernet.Supernet)

Types

type CIDR

type CIDR struct {
	*supernet.Metadata
	// contains filtered or unexported fields
}

type CidrParser added in v0.0.4

type CidrParser interface {
	Parse(cmd *ResolveCmd, filepath string, onEachCidr func(cidr *CIDR) error) error
}

type Context

type Context struct {
	// contains filtered or unexported fields
}

ResolveCmd represents the command to resolve CIDR conflicts.

type CsvCidrParser added in v0.0.4

type CsvCidrParser struct {
	// contains filtered or unexported fields
}

func (CsvCidrParser) Parse added in v0.0.4

func (p CsvCidrParser) Parse(cmd *ResolveCmd, filePath string, onEachCidr func(cidr *CIDR) error) error

type CsvWriter added in v0.0.4

type CsvWriter struct {
	IPv6  bool
	Stats *Stats
	// contains filtered or unexported fields
}

func (*CsvWriter) IsIpV6 added in v0.0.4

func (w *CsvWriter) IsIpV6(isIpV6 bool) Writer

func (CsvWriter) Write added in v0.0.4

func (w CsvWriter) Write(super *supernet.Supernet, directory string, cidrCol string, dropKeys []string) error

writeResults writes the results of CIDR resolution to a CSV file.

type JsonParser added in v0.0.4

type JsonParser struct{}

func (JsonParser) Parse added in v0.0.4

func (_ JsonParser) Parse(cmd *ResolveCmd, filepath string, onEachCidr func(cidr *CIDR) error) error

type JsonWriter added in v0.0.4

type JsonWriter struct {
	IPv6  bool
	Stats *Stats
	// contains filtered or unexported fields
}

func (*JsonWriter) IsIpV6 added in v0.0.4

func (w *JsonWriter) IsIpV6(isIpV6 bool) Writer

func (JsonWriter) Write added in v0.0.4

func (w JsonWriter) Write(super *supernet.Supernet, directory string, cidrCol string, dropKeys []string) error

type Record

type Record map[string]string

type ResolveCmd

type ResolveCmd struct {
	Files             []string `arg:"" type:"existingfile" help:"Input file containing CIDRs in CSV or JSON format"`
	CidrKey           string   `help:"Key/Colum of the CIDRs in the file" default:"cidr"`
	PriorityKeys      []string `help:"Keys/Columns to be used as CIDRs priorities" default:""`
	FillEmptyPriority bool     `help:"Replace empty/null priority with zero value" default:"true"`
	FlipRankPriority  bool     `help:"Make low value priority mean higher priority" default:"false"`
	Report            bool     `help:"Report only conflicted CIDRs"`

	OutputFormat    string   `enum:"json,csv,tsv" default:"csv" help:"Output file format" default:"csv"`
	DropKeys        []string `help:"Keys/Columns to be dropped" default:""`
	SplitIpVersions bool     `help:"Split the results in to separate files based on the CIDR IP version" default:"false"`
	Stats           Stats    `kong:"-"`
}

func (*ResolveCmd) Run

func (cmd *ResolveCmd) Run(ctx *Context) error

Run executes the resolve command.

type Stats added in v0.0.4

type Stats struct {
	Input           int
	Output          int
	Conflicted      int
	StartInsertTime time.Time
	EndInsertTime   time.Time
	StartOutputTime time.Time
	EndOutputTime   time.Time
}

type Writer added in v0.0.4

type Writer interface {
	Write(super *supernet.Supernet, directory string, cidrKey string, dropKeys []string) error
	IsIpV6(isIPv6 bool) Writer
}

Jump to

Keyboard shortcuts

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