forked from wayne0019/docker-ovs-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
46 lines (39 loc) · 756 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"os"
log "github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/gopher-net/dknet"
"github.com/gopher-net/docker-ovs-plugin/ovs"
)
const (
version = "0.2"
)
func main() {
var flagDebug = cli.BoolFlag{
Name: "debug, d",
Usage: "enable debugging",
}
app := cli.NewApp()
app.Name = "don"
app.Usage = "Docker Open vSwitch Networking"
app.Version = version
app.Flags = []cli.Flag{
flagDebug,
}
app.Action = Run
app.Run(os.Args)
}
// Run initializes the driver
func Run(ctx *cli.Context) {
if ctx.Bool("debug") {
log.SetLevel(log.DebugLevel)
}
d, err := ovs.NewDriver()
if err != nil {
panic(err)
}
h := dknet.NewHandler(d)
errs:=h.ServeUnix("root", "ovs")
log.Debugln(errs)
}