forked from m-kostrzewa/docker-windows-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
103 lines (82 loc) · 2.68 KB
/
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Implemented according to
// https://github.com/docker/libnetwork/blob/master/docs/remote.md
package main
import (
"fmt"
"github.com/docker/go-plugins-helpers/network"
"github.com/docker/go-plugins-helpers/sdk"
)
type dummyNetworkDriver struct{}
func main() {
d := dummyNetworkDriver{}
h := network.NewHandler(d)
config := sdk.WindowsPipeConfig{
// This will set permissions for Everyone user allowing him to open, write, read the pipe
SecurityDescriptor: "S:(ML;;NW;;;LW)D:(A;;0x12019f;;;WD)",
InBufferSize: 4096,
OutBufferSize: 4096,
}
h.ServeWindows("//./pipe/testpipe", "testpipe", &config)
}
func (dummyNetworkDriver) GetCapabilities() (*network.CapabilitiesResponse, error) {
fmt.Println("GetCapabilities")
r := &network.CapabilitiesResponse{}
r.Scope = network.LocalScope
return r, nil
}
func (dummyNetworkDriver) CreateNetwork(*network.CreateNetworkRequest) error {
fmt.Println("CreateNetwork")
return nil
}
func (dummyNetworkDriver) AllocateNetwork(*network.AllocateNetworkRequest) (*network.AllocateNetworkResponse, error) {
fmt.Println("AllocateNetwork")
r := &network.AllocateNetworkResponse{}
return r, nil
}
func (dummyNetworkDriver) DeleteNetwork(*network.DeleteNetworkRequest) error {
fmt.Println("DeleteNetwork")
return nil
}
func (dummyNetworkDriver) FreeNetwork(*network.FreeNetworkRequest) error {
fmt.Println("FreeNetwork")
return nil
}
func (dummyNetworkDriver) CreateEndpoint(*network.CreateEndpointRequest) (*network.CreateEndpointResponse, error) {
fmt.Println("CreateEndpoint")
r := &network.CreateEndpointResponse{}
return r, nil
}
func (dummyNetworkDriver) DeleteEndpoint(*network.DeleteEndpointRequest) error {
fmt.Println("DeleteEndpoint")
return nil
}
func (dummyNetworkDriver) EndpointInfo(*network.InfoRequest) (*network.InfoResponse, error) {
fmt.Println("EndpointInfo")
r := &network.InfoResponse{}
return r, nil
}
func (dummyNetworkDriver) Join(*network.JoinRequest) (*network.JoinResponse, error) {
fmt.Println("Join")
r := &network.JoinResponse{}
return r, nil
}
func (dummyNetworkDriver) Leave(*network.LeaveRequest) error {
fmt.Println("Leave")
return nil
}
func (dummyNetworkDriver) DiscoverNew(*network.DiscoveryNotification) error {
fmt.Println("DiscoverNew")
return nil
}
func (dummyNetworkDriver) DiscoverDelete(*network.DiscoveryNotification) error {
fmt.Println("DiscoverDelete")
return nil
}
func (dummyNetworkDriver) ProgramExternalConnectivity(*network.ProgramExternalConnectivityRequest) error {
fmt.Println("ProgramExternalConnectivity")
return nil
}
func (dummyNetworkDriver) RevokeExternalConnectivity(*network.RevokeExternalConnectivityRequest) error {
fmt.Println("RevokeExternalConnectivity")
return nil
}