Documentation
¶
Index ¶
- func GetFlowType(f *pb.Flow) string
- type Option
- type Options
- type Output
- type Printer
- func (p *Printer) Close() error
- func (p *Printer) GetHostNames(f *pb.Flow) (string, string)
- func (p *Printer) GetPorts(f *pb.Flow) (string, string)
- func (p *Printer) Hostname(ip, port string, ns, pod, svc string, names []string) (host string)
- func (p *Printer) WriteErr(msg string) error
- func (p *Printer) WriteGetFlowsResponse(res *observerpb.GetFlowsResponse) error
- func (p *Printer) WriteProtoAgentEvent(r *observerpb.GetAgentEventsResponse) error
- func (p *Printer) WriteProtoDebugEvent(r *observerpb.GetDebugEventsResponse) error
- func (p *Printer) WriteProtoFlow(res *observerpb.GetFlowsResponse) error
- func (p *Printer) WriteProtoNodeStatusEvent(r *observerpb.GetFlowsResponse) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFlowType ¶
GetFlowType returns the type of a flow as a string.
Types ¶
type Option ¶
type Option func(*Options)
Option ...
func JSONPB ¶ added in v0.7.0
func JSONPB() Option
JSONPB encodes GetFlowsResponse as JSON according to proto3's JSON mapping.
func WithIPTranslation ¶
func WithIPTranslation() Option
WithIPTranslation enables translation from IPs to pod names, FQDNs, and service names.
func WithNodeName ¶ added in v0.7.0
func WithNodeName() Option
WithNodeName enables printing the node name.
func WithTimeFormat ¶ added in v0.8.0
WithTimeFormat specifies the time format layout to use when printing out timestamps. This option has no effect if JSON or JSONPB option is used. The layout must be a time format layout as specified in the standard library's time package.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options for the printer.
type Output ¶
type Output int
Output enum of the printer.
const ( // TabOutput prints flows in even tab-aligned columns. TabOutput Output = iota // JSONOutput prints flows as json. JSONOutput // CompactOutput prints flows as compact as possible (similar to monitor). CompactOutput // DictOutput presents the same information as TabOutput, but each flow is // presented as a key:value dictionary, similar to \G output of mysql. DictOutput // JSONPBOutput prints GetFlowsResponse as JSON according to proto3's JSON mapping. JSONPBOutput )
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer for flows.
func (*Printer) GetHostNames ¶
GetHostNames returns source and destination hostnames of a flow.
func (*Printer) Hostname ¶
Hostname returns a "host:ip" formatted pair for the given ip and port. If port is empty, only the host is returned. The host part is either the pod or service name (if set), or a comma-separated list of domain names (if set), or just the ip address if EnableIPTranslation is false and/or there are no pod nor service name and domain names.
func (*Printer) WriteErr ¶
WriteErr returns the given msg into the err writer defined in the printer.
func (*Printer) WriteGetFlowsResponse ¶ added in v0.7.0
func (p *Printer) WriteGetFlowsResponse(res *observerpb.GetFlowsResponse) error
WriteGetFlowsResponse prints GetFlowsResponse according to the printer configuration.
func (*Printer) WriteProtoAgentEvent ¶ added in v0.8.0
func (p *Printer) WriteProtoAgentEvent(r *observerpb.GetAgentEventsResponse) error
WriteProtoAgentEvent writes v1.AgentEvent into the output writer.
func (*Printer) WriteProtoDebugEvent ¶ added in v0.8.0
func (p *Printer) WriteProtoDebugEvent(r *observerpb.GetDebugEventsResponse) error
WriteProtoDebugEvent writes a flowpb.DebugEvent into the output writer.
func (*Printer) WriteProtoFlow ¶
func (p *Printer) WriteProtoFlow(res *observerpb.GetFlowsResponse) error
WriteProtoFlow writes v1.Flow into the output writer.
func (*Printer) WriteProtoNodeStatusEvent ¶ added in v0.6.0
func (p *Printer) WriteProtoNodeStatusEvent(r *observerpb.GetFlowsResponse) error
WriteProtoNodeStatusEvent writes a node status event into the error stream