Skip to content

Commit

Permalink
Small idiomatic changes in comcast.go
Browse files Browse the repository at this point in the history
- Single var block for flags
- Pass Config directly, without an intermediate
  • Loading branch information
peterbourgon committed Nov 13, 2014
1 parent 878fa7b commit a0e4398
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions comcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import (
func main() {
// TODO: add support for specific host/port.
// Also support for other options like packet reordering, duplication, etc.
mode := flag.String("mode", throttler.Start, "start or stop packet controls")
latency := flag.Int("latency", -1, "latency to add in ms")
bandwidth := flag.Int("bandwidth", -1, "bandwidth limit in kb/s")
packetLoss := flag.Float64("packet-loss", 0, "packet-loss rate")
var (
mode = flag.String("mode", throttler.Start, "start or stop packet controls")
latency = flag.Int("latency", -1, "latency to add in ms")
bandwidth = flag.Int("bandwidth", -1, "bandwidth limit in kb/s")
packetLoss = flag.Float64("packet-loss", 0, "packet-loss rate")
)
flag.Parse()

config := &throttler.Config{
throttler.Run(&throttler.Config{
Mode: *mode,
Latency: *latency,
Bandwidth: *bandwidth,
PacketLoss: *packetLoss,
}

throttler.Run(config)
})
}

0 comments on commit a0e4398

Please sign in to comment.