All Downloads are FREE. Search and download functionalities are using the official Maven repository.

distinctcounter.counter.go Maven / Gradle / Ivy

There is a newer version: 2.9.1
Show newest version
package main

import (
	"flag"
	"fmt"
	"log"
	"os"
	"time"

	"git.torproject.org/pluggable-transports/snowflake.git/v2/common/ipsetsink/sinkcluster"
)

func main() {
	inputFile := flag.String("in", "", "")
	start := flag.String("from", "", "")
	end := flag.String("to", "", "")
	flag.Parse()
	startTime, err := time.Parse(time.RFC3339, *start)
	if err != nil {
		log.Fatal("unable to parse start time:", err)
	}
	endTime, err := time.Parse(time.RFC3339, *end)
	if err != nil {
		log.Fatal("unable to parse end time:", err)
	}
	fd, err := os.Open(*inputFile)
	if err != nil {
		log.Fatal("unable to open input file:", err)
	}
	counter := sinkcluster.NewClusterCounter(startTime, endTime)
	result, err := counter.Count(fd)
	if err != nil {
		log.Fatal("unable to count:", err)
	}
	fmt.Printf("sum = %v\n", result.Sum)
	fmt.Printf("chunkIncluded = %v\n", result.ChunkIncluded)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy