0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00
schollz_croc/cmd/bench/cmd.go
2019-04-10 07:25:29 -07:00

38 lines
774 B
Go

package bench
import (
"github.com/schollz/croc/v5/src/webrtc/pkg/session/bench"
"github.com/schollz/croc/v5/src/webrtc/pkg/session/common"
log "github.com/sirupsen/logrus"
"gopkg.in/urfave/cli.v1"
)
func handler(c *cli.Context) error {
isMaster := c.Bool("master")
sess := bench.NewWith(bench.Config{
Master: isMaster,
Configuration: common.Configuration{
OnCompletion: func() {
},
},
})
return sess.Start()
}
// New creates the command
func New() cli.Command {
log.Traceln("Installing 'bench' command")
return cli.Command{
Name: "bench",
Aliases: []string{"b"},
Usage: "Benchmark the connexion",
Action: handler,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "master, m",
Usage: "Is creating the SDP offer?",
},
},
}
}