forked from gopher-net/macvlan-docker-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
45 lines (38 loc) · 772 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
package main
import (
"os"
log "github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/docker/go-plugins-helpers/network"
"github.com/gopher-net/macvlan-docker-plugin/macvlan"
)
const (
version = "0.4.0"
)
func main() {
var flagDebug = cli.BoolFlag{
Name: "debug, d",
Usage: "enable debugging",
}
app := cli.NewApp()
app.Name = "macvlan"
app.Usage = "Docker Macvlan 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 := macvlan.NewDriver(version, ctx)
if err != nil {
panic(err)
}
h := network.NewHandler(d)
h.ServeUnix("root", "macvlan")
}