-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
53 lines (40 loc) · 834 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
47
48
49
50
51
52
53
package main
import (
"sync"
"github.com/mikefaille/docker-group-daemonizer/dockerGrp"
"github.com/mikefaille/docker-group-daemonizer/unixGrp"
"github.com/mikefaille/tenus"
)
type error interface {
Error() string
}
func main() {
var wg sync.WaitGroup
wg.Add(1)
chanGroup := unixGrp.TakeAllGroups()
for currentG := range chanGroup {
gDocker, err := dockerGrp.CatchDockerEqGroup(currentG)
if err == nil {
wg.Add(1)
go func() {
gDocker.GenerateDockerDaemon()
if ok, err := tenus.IsInterfaceExist(gDocker.Name); !ok || err != nil {
check(err)
gDocker.AddNewDockerBr()
} else {
err := tenus.DelBridgeWithName(gDocker.Name)
check(err)
gDocker.AddNewDockerBr()
}
wg.Done()
}()
}
}
wg.Done()
wg.Wait()
}
func check(e error) {
if e != nil {
panic(e)
}
}