Documentation ¶
Index ¶
- func GetFlagSet(flagName string, cmd *cobra.Command) *pflag.FlagSet
- func GetFlagValues(flagName string, flag *pflag.FlagSet, Type any) (ret any, err error)
- func GetFlagValuesT[T any](flagName string, flag *pflag.FlagSet, Type T) (ret T, err error)
- func NewQueryParser(cmd string, argToSql map[string]string) *query
- func SetFlag(fl *pflag.FlagSet, p FlagParams, Type any) (err error)
- func SetFlagT[T any](fl *pflag.FlagSet, p FlagParams, Type T) (err error)
- func ValidateStringValue(val string) (err error)
- func ValidateStringValues(vals []string) error
- type FlagParams
- type Flags
- func (f *Flags) Action(cmd *cobra.Command) (err error)
- func (f *Flags) Attach(cmd *cobra.Command, opts ...attachOptions) (err error)
- func (f Flags) Clone(fn func(f *Flags))
- func (f *Flags) GetFieldFlagParams(fieldPtr any) FlagParams
- func (f *Flags) GetFlagParamsByGroup(group string) (ret []FlagParams)
- func (f *Flags) InitFromCmd(cmd *cobra.Command) (err error)
- func (f *Flags) NameFromTag(fieldPtr any) string
- func (f *Flags) ToTraceScopeModel() (md model.TraceScopeModel, err error)
- type QueryFlag
- type SliceT
- type WithDefValues
- type WithExcludeFlags
- type WithPersistentFlags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFlagValues ¶
GetFlagValues - return flag value by name
func GetFlagValuesT ¶
GetFlagValuesT - return typed flag value by name
func NewQueryParser ¶
func ValidateStringValue ¶
func ValidateStringValues ¶
Types ¶
type FlagParams ¶
type Flags ¶
type Flags struct { // path to config file ConfigPath string `name:"config" key:"c" usage:"app config file"` // output in json format JsonFormat bool `name:"json" key:"j" usage:"enable extended output in the json format"` // trace hub server url ServerUrl string `name:"host" key:"H" usage:"trace-hub service address (format: <IP>:<port>)" eg:"tcp://127.0.0.1:9000"` // level of log LogLevel string `name:"log-level" usage:"log level: INFO|DEBUG|WARN|ERROR|PANIC|FATAL"` // verbose output mode VerboseMode bool `name:"verbose" key:"v" usage:"verbose output mode"` // time filter TimeFrom *time.Time `name:"time-from" usage:"specifies the start time of the time interval in the format '2024-10-08T12:30:00Z'"` // time filter TimeTo *time.Time `name:"time-to" usage:"specifies the end time of the time interval in the format '2024-10-08T12:30:00Z'"` // time filter TimeDuration *time.Duration `` /* 135-byte string literal not displayed */ // follow mode on/off FollowMode bool `name:"follow" key:"f" usage:"follow or tail continuous output [Required --time Flag]"` // complex query filter parameter Query string `` /* 218-byte string literal not displayed */ // traces ids TrId []uint `` /* 180-byte string literal not displayed */ // nftables tables names Table []string `` /* 190-byte string literal not displayed */ // nftables chains names Chain []string `name:"chain" gr:"trace" usage:"set filter by chain name. Supported multiple values (see --table Flag)" eg:"chain1,chain2"` // nftables jump to a target names JumpTarget []string `` /* 126-byte string literal not displayed */ // nftables rules numbers RuleHandle []uint `name:"handle" gr:"trace" usage:"set filter by rule handle. Supported multiple values (see --trid Flag)" eg:"1,2,3,4,5"` // protocols family Family []string `` /* 130-byte string literal not displayed */ // input network interfaces Iifname []string `` /* 147-byte string literal not displayed */ // output network interfaces Oifname []string `` /* 146-byte string literal not displayed */ // source mac addresses SMacAddr []string `` /* 152-byte string literal not displayed */ // destination mac addresses DMacAddr []string `` /* 157-byte string literal not displayed */ // source ip addresses SAddr []string `` /* 139-byte string literal not displayed */ // destination ip addresses DAddr []string `` /* 144-byte string literal not displayed */ // source ports SPort []uint `name:"sport" gr:"trace" usage:"set filter by source port. Supported multiple values (see --trid Flag)" eg:"80,443"` // destination ports DPort []uint `name:"dport" gr:"trace" usage:"set filter by destination port. Supported multiple values (see --trid Flag)" eg:"80,443"` // names of the security group for src ip SSgName []string `` /* 132-byte string literal not displayed */ // names of the security group for dst ip DSgName []string `` /* 137-byte string literal not displayed */ // names of the network for src ip SSgNet []string `` /* 149-byte string literal not displayed */ // names of the network for dst ip DSgNet []string `` /* 154-byte string literal not displayed */ // lengths of packets Length []uint `name:"len" gr:"trace" usage:"set filter by network packet length. Supported multiple values (see --trid Flag)" eg:"20,80"` // ip protocols (tcp/udp/icmp/...) IpProto []string `` /* 140-byte string literal not displayed */ // verdicts of rules Verdict []string `` /* 155-byte string literal not displayed */ // visor agents identifier AgentsIds []string `name:"agent-id" usage:"set filter by visor agents id Supported multiple values (see --table Flag)" eg:"tracer1,tracer2"` }
func (*Flags) GetFieldFlagParams ¶
func (f *Flags) GetFieldFlagParams(fieldPtr any) FlagParams
func (*Flags) GetFlagParamsByGroup ¶
func (f *Flags) GetFlagParamsByGroup(group string) (ret []FlagParams)
func (*Flags) NameFromTag ¶
func (*Flags) ToTraceScopeModel ¶
func (f *Flags) ToTraceScopeModel() (md model.TraceScopeModel, err error)
type WithDefValues ¶
type WithExcludeFlags ¶
type WithExcludeFlags struct { ExcludeFlags []string // contains filtered or unexported fields }
type WithPersistentFlags ¶
Click to show internal directories.
Click to hide internal directories.