gcp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RECV_WINDOW  = -1 * 5 * 60 * time.Second
	GCP_VPC_TYPE = "GCP_VPC"
)

Variables

View Source
var (
	ProjectID  = flag.String("gcp.project", "", "Google ProjectID to listen for flows on")
	SourceSub  = flag.String("gcp.sub", "", "Google Sub to listen for flows on")
	SampleRate = flag.Float64("gcp.sample", 1, "Sample rate of the vpc export (as defined in the VPC setup)")

	ERROR_SLEEP_TIME = 20 * time.Second
)

Functions

This section is empty.

Types

type Connection

type Connection struct {
	DestIP   string `json:"dest_ip"`
	DestPort int    `json:"dest_port"`
	Protocol int    `json:"protocol"`
	SrcIP    string `json:"src_ip"`
	SrcPort  int    `json:"src_port"`
}

func (*Connection) Save

func (c *Connection) Save(in *kt.JCHF)

type GCELogLine

type GCELogLine struct {
	InsertID  string    `json:"insertId"`
	Payload   *Payload  `json:"jsonPayload"`
	LogName   string    `json:"logName"`
	RecvTs    time.Time `json:"receiveTimestamp"`
	Resource  *Resource `json:"resource"`
	Timestamp time.Time `json:"timestamp"`
	BytesRaw  int64     `json:"bytesRaw"`
}

func (*GCELogLine) GetVMName

func (m *GCELogLine) GetVMName() (host string, err error)

func (*GCELogLine) IsIn

func (m *GCELogLine) IsIn() bool

func (*GCELogLine) IsInternal

func (m *GCELogLine) IsInternal() bool

func (*GCELogLine) IsValid

func (m *GCELogLine) IsValid() bool

func (*GCELogLine) ToFlow

func (m *GCELogLine) ToFlow(log logger.ContextL, flowSample uint32) (in *kt.JCHF, err error)

func (*GCELogLine) ToJson

func (m *GCELogLine) ToJson() []byte

type GcpMetric

type GcpMetric struct {
	FlowsIn     go_metrics.Meter
	RateInvalid go_metrics.Meter
	RateError   go_metrics.Meter
}

type GcpVpc

type GcpVpc struct {
	logger.ContextL
	// contains filtered or unexported fields
}

func NewVpc

func NewVpc(ctx context.Context, log logger.Underlying, registry go_metrics.Registry, jchfChan chan []*kt.JCHF, apic *api.KentikApi, maxBatchSize int) (*GcpVpc, error)

func (*GcpVpc) Close

func (vpc *GcpVpc) Close()

func (*GcpVpc) HttpInfo

func (vpc *GcpVpc) HttpInfo() map[string]float64

type Instance

type Instance struct {
	ProjectID string `json:"project_id"`
	Region    string `json:"region"`
	VMName    string `json:"vm_name"`
	Zone      string `json:"zone"`
}

func (*Instance) Save

func (i *Instance) Save(in *kt.JCHF, direction string)

type Label

type Label struct {
	Location       string `json:"location"`
	ProjectID      string `json:"project_id"`
	SubnetworkID   string `json:"subnetwork_id"`
	SubnetworkName string `json:"subnetwork_name"`
}

func (*Label) Save

func (l *Label) Save(in *kt.JCHF)

type Location

type Location struct {
	City      string `json:"city"`
	Continent string `json:"continent"`
	Country   string `json:"country"`
	Region    string `json:"region"`
}

func (*Location) Save

func (l *Location) Save(in *kt.JCHF, direction string)

type Payload

type Payload struct {
	Bytes        string      `json:"bytes_sent"`
	Connection   *Connection `json:"connection"`
	DestInstance *Instance   `json:"dest_instance"`
	SrcInstance  *Instance   `json:"src_instance"`
	DestVPC      *VPC        `json:"dest_vpc"`
	SrcVPC       *VPC        `json:"src_vpc"`
	EndTime      time.Time   `json:"end_time"`
	Pkts         string      `json:"packets_sent"`
	Reporter     string      `json:"reporter"`
	RTT          string      `json:"rtt_msec"`
	SrcLocation  *Location   `json:"src_location"`
	DstLocation  *Location   `json:"dest_location"`
	StartTime    time.Time   `json:"start_time"`
}

func (*Payload) Save

func (p *Payload) Save(in *kt.JCHF)

type Resource

type Resource struct {
	Labels *Label `json:"labels"`
	Type   string `json:"type"`
}

func (*Resource) Save

func (r *Resource) Save(in *kt.JCHF)

type VPC

type VPC struct {
	ProjectID      string `json:"project_id"`
	SubnetworkName string `json:"subnetwork_name"`
	Name           string `json:"vpc_name"`
}

func (*VPC) Save

func (v *VPC) Save(in *kt.JCHF, direction string)

Jump to

Keyboard shortcuts

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