Skip to content

Commit

Permalink
chore: add ip filter & compress options to tshark
Browse files Browse the repository at this point in the history
  • Loading branch information
mojtaba-esk committed Jun 20, 2024
1 parent a00e9d5 commit 9fdacd2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions pkg/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ type TsharkCollectorConfig struct {

// UploadInterval is the interval at which the tshark collector will upload the pcap file to the s3 server
UploadInterval time.Duration

// IpFilter is the ip filter to use for the tshark collector
// it trace the incoming/outgoing traffic from/to the specific ip
// If not set, it will trace all the traffic
IpFilter string

// CompressFiles is the flag to compress the pcap files before pushing them to s3
CompressFiles bool
}

// SecurityContext represents the security settings for a container
Expand Down
6 changes: 5 additions & 1 deletion pkg/instance/tshark.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

const (
tsharkCollectorName = "tshark-collector"
tsharkCollectorImage = "ghcr.io/celestiaorg/tshark-s3:pr-11"
tsharkCollectorImage = "ghcr.io/celestiaorg/tshark-s3:latest"
tsharkCollectorCPU = "100m"
tsharkCollectorMemory = "250Mi"
tsharkCollectorVolumePath = "/tshark"
Expand All @@ -23,6 +23,8 @@ const (
envStorageEndpoint = "STORAGE_ENDPOINT"
envCaptureFileName = "CAPTURE_FILE_NAME"
envUploadInterval = "UPLOAD_INTERVAL"
envCompressFiles = "COMPRESS_FILES"
envIpFilter = "IP_FILTER"
)

func (i *Instance) createTsharkCollectorInstance(ctx context.Context) (*Instance, error) {
Expand Down Expand Up @@ -60,6 +62,8 @@ func (i *Instance) createTsharkCollectorInstance(ctx context.Context) (*Instance
envStorageEndpoint: i.tsharkCollectorConfig.S3Endpoint,
envUploadInterval: fmt.Sprintf("%d", int64(i.tsharkCollectorConfig.UploadInterval.Seconds())),
envCreateBucket: fmt.Sprintf("%t", i.tsharkCollectorConfig.CreateBucket),
envCompressFiles: fmt.Sprintf("%t", i.tsharkCollectorConfig.CompressFiles),
envIpFilter: i.tsharkCollectorConfig.IpFilter,
}

for key, value := range envVars {
Expand Down

0 comments on commit 9fdacd2

Please sign in to comment.