testMain.go 571 B

12345678910111213141516171819202122232425262728
  1. package main
  2. import (
  3. "log"
  4. "os"
  5. "github.com/docker/libnetwork/cmd/networkdb-test/dbclient"
  6. "github.com/docker/libnetwork/cmd/networkdb-test/dbserver"
  7. "github.com/sirupsen/logrus"
  8. )
  9. func main() {
  10. formatter := &logrus.TextFormatter{
  11. FullTimestamp: true,
  12. }
  13. logrus.SetFormatter(formatter)
  14. logrus.Infof("Starting the image with these args: %v", os.Args)
  15. if len(os.Args) < 1 {
  16. log.Fatal("You need at least 1 argument [client/server]")
  17. }
  18. switch os.Args[1] {
  19. case "server":
  20. dbserver.Server(os.Args[2:])
  21. case "client":
  22. dbclient.Client(os.Args[2:])
  23. }
  24. }