-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplugins.go
138 lines (110 loc) · 4.23 KB
/
plugins.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package main
import (
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/cmd"
"github.com/micro/go-micro/v2/config"
"github.com/micro/go-micro/v2/debug/profile/http"
"github.com/micro/go-micro/v2/debug/profile/pprof"
"github.com/micro/go-micro/v2/debug/trace"
"github.com/micro/go-micro/v2/server"
"github.com/micro/go-micro/v2/store"
// clients
gcli "github.com/micro/go-micro/v2/client/grpc"
cmucp "github.com/micro/go-micro/v2/client/mucp"
gsrv "github.com/micro/go-micro/v2/server/grpc"
smucp "github.com/micro/go-micro/v2/server/mucp"
// brokers
brokerHttp "github.com/micro/go-micro/v2/broker/http"
"github.com/micro/go-micro/v2/broker/memory"
"github.com/micro/go-micro/v2/broker/nats"
brokerSrv "github.com/micro/go-micro/v2/broker/service"
// registries
"github.com/micro/go-micro/v2/registry/etcd"
"github.com/micro/go-micro/v2/registry/mdns"
rmem "github.com/micro/go-micro/v2/registry/memory"
regSrv "github.com/micro/go-micro/v2/registry/service"
// routers
dnsRouter "github.com/micro/go-micro/v2/router/dns"
regRouter "github.com/micro/go-micro/v2/router/registry"
srvRouter "github.com/micro/go-micro/v2/router/service"
staticRouter "github.com/micro/go-micro/v2/router/static"
// runtimes
kRuntime "github.com/micro/go-micro/v2/runtime/kubernetes"
lRuntime "github.com/micro/go-micro/v2/runtime/local"
srvRuntime "github.com/micro/go-micro/v2/runtime/service"
// selectors
randSelector "github.com/micro/go-micro/v2/selector/random"
roundSelector "github.com/micro/go-micro/v2/selector/roundrobin"
// transports
thttp "github.com/micro/go-micro/v2/transport/http"
tmem "github.com/micro/go-micro/v2/transport/memory"
// stores
ckStore "github.com/micro/go-micro/v2/store/cockroach"
fileStore "github.com/micro/go-micro/v2/store/file"
memStore "github.com/micro/go-micro/v2/store/memory"
svcStore "github.com/micro/go-micro/v2/store/service"
// tracers
// jTracer "github.com/micro/go-micro/v2/debug/trace/jaeger"
memTracer "github.com/micro/go-micro/v2/debug/trace/memory"
// auth
jwtAuth "github.com/micro/go-micro/v2/auth/jwt"
svcAuth "github.com/micro/go-micro/v2/auth/service"
)
func init() {
// set defaults
// default client
client.DefaultClient = gcli.NewClient()
// default server
server.DefaultServer = gsrv.NewServer()
// default store
store.DefaultStore = memStore.NewStore()
// set default trace
trace.DefaultTracer = memTracer.NewTracer()
// import all the plugins
// auth
cmd.DefaultAuths["service"] = svcAuth.NewAuth
cmd.DefaultAuths["jwt"] = jwtAuth.NewAuth
// broker
cmd.DefaultBrokers["service"] = brokerSrv.NewBroker
cmd.DefaultBrokers["memory"] = memory.NewBroker
cmd.DefaultBrokers["nats"] = nats.NewBroker
cmd.DefaultBrokers["http"] = brokerHttp.NewBroker
// config
cmd.DefaultConfigs["service"] = config.NewConfig
// client
cmd.DefaultClients["mucp"] = cmucp.NewClient
cmd.DefaultClients["grpc"] = gcli.NewClient
// profiler
cmd.DefaultProfiles["http"] = http.NewProfile
cmd.DefaultProfiles["pprof"] = pprof.NewProfile
// registry
cmd.DefaultRegistries["service"] = regSrv.NewRegistry
cmd.DefaultRegistries["etcd"] = etcd.NewRegistry
cmd.DefaultRegistries["mdns"] = mdns.NewRegistry
cmd.DefaultRegistries["memory"] = rmem.NewRegistry
// runtime
cmd.DefaultRuntimes["local"] = lRuntime.NewRuntime
cmd.DefaultRuntimes["service"] = srvRuntime.NewRuntime
cmd.DefaultRuntimes["kubernetes"] = kRuntime.NewRuntime
// router
cmd.DefaultRouters["dns"] = dnsRouter.NewRouter
cmd.DefaultRouters["registry"] = regRouter.NewRouter
cmd.DefaultRouters["static"] = staticRouter.NewRouter
cmd.DefaultRouters["service"] = srvRouter.NewRouter
// selector
cmd.DefaultSelectors["random"] = randSelector.NewSelector
cmd.DefaultSelectors["roundrobin"] = roundSelector.NewSelector
// server
cmd.DefaultServers["mucp"] = smucp.NewServer
cmd.DefaultServers["grpc"] = gsrv.NewServer
// store
cmd.DefaultStores["memory"] = memStore.NewStore
cmd.DefaultStores["service"] = svcStore.NewStore
cmd.DefaultStores["cockroach"] = ckStore.NewStore
cmd.DefaultStores["file"] = fileStore.NewStore
// trace
cmd.DefaultTracers["memory"] = memTracer.NewTracer
// transport
cmd.DefaultTransports["memory"] = tmem.NewTransport
cmd.DefaultTransports["http"] = thttp.NewTransport
}