1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00

move router

This commit is contained in:
Asim Aslam 2020-12-12 19:04:19 +00:00
parent 43ff2a540d
commit 4977aca09c
21 changed files with 21 additions and 30 deletions

View File

@ -7,8 +7,8 @@ import (
"sync"
"github.com/micro/go-micro/v2/client/selector"
"github.com/micro/go-micro/v2/network/router"
"github.com/micro/go-micro/v2/registry"
"github.com/micro/go-micro/v2/router"
)
type routerSelector struct {

View File

@ -7,8 +7,8 @@ import (
"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2"
"github.com/micro/go-micro/v2/config"
"github.com/micro/go-micro/v2/cmd"
"github.com/micro/go-micro/v2/config"
"github.com/micro/go-micro/v2/config/source"
)

View File

@ -17,12 +17,12 @@ import (
rtr "github.com/micro/go-micro/v2/client/selector/router"
"github.com/micro/go-micro/v2/logger"
pbNet "github.com/micro/go-micro/v2/network/proto"
"github.com/micro/go-micro/v2/network/proxy"
"github.com/micro/go-micro/v2/network/resolver/dns"
"github.com/micro/go-micro/v2/network/router"
"github.com/micro/go-micro/v2/network/tunnel"
bun "github.com/micro/go-micro/v2/network/tunnel/broker"
tun "github.com/micro/go-micro/v2/network/tunnel/transport"
"github.com/micro/go-micro/v2/network/proxy"
"github.com/micro/go-micro/v2/router"
"github.com/micro/go-micro/v2/server"
smucp "github.com/micro/go-micro/v2/server/mucp"
"github.com/micro/go-micro/v2/transport"

View File

@ -2,12 +2,12 @@ package network
import (
"github.com/google/uuid"
"github.com/micro/go-micro/v2/network/resolver"
"github.com/micro/go-micro/v2/network/resolver/registry"
"github.com/micro/go-micro/v2/network/tunnel"
"github.com/micro/go-micro/v2/network/proxy"
"github.com/micro/go-micro/v2/network/proxy/mucp"
"github.com/micro/go-micro/v2/router"
"github.com/micro/go-micro/v2/network/resolver"
"github.com/micro/go-micro/v2/network/resolver/registry"
"github.com/micro/go-micro/v2/network/router"
"github.com/micro/go-micro/v2/network/tunnel"
)
type Option func(*Options)

View File

@ -18,7 +18,7 @@ import (
"github.com/micro/go-micro/v2/logger"
"github.com/micro/go-micro/v2/metadata"
"github.com/micro/go-micro/v2/network/proxy"
"github.com/micro/go-micro/v2/router"
"github.com/micro/go-micro/v2/network/router"
"github.com/micro/go-micro/v2/server"
)

View File

@ -3,7 +3,7 @@ package proxy
import (
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/router"
"github.com/micro/go-micro/v2/network/router"
)
type Options struct {

View File

@ -2,7 +2,7 @@ package network
import (
pbNet "github.com/micro/go-micro/v2/network/proto"
"github.com/micro/go-micro/v2/router"
"github.com/micro/go-micro/v2/network/router"
)
// routeToProto encodes route into protobuf and returns it

View File

@ -9,8 +9,8 @@ import (
"github.com/micro/go-micro/v2/broker"
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/client/selector"
"github.com/micro/go-micro/v2/config"
"github.com/micro/go-micro/v2/cmd"
"github.com/micro/go-micro/v2/config"
"github.com/micro/go-micro/v2/debug/profile"
"github.com/micro/go-micro/v2/debug/trace"
"github.com/micro/go-micro/v2/registry"
@ -155,7 +155,6 @@ func Tracer(t trace.Tracer) Option {
func Auth(a auth.Auth) Option {
return func(o *Options) {
o.Auth = a
o.Server.Init(server.Auth(a))
}
}

View File

@ -7,7 +7,6 @@ import (
"strings"
"sync"
"github.com/micro/go-micro/v2/auth"
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/cmd"
"github.com/micro/go-micro/v2/debug/service/handler"
@ -34,21 +33,14 @@ func newService(opts ...Option) Service {
// service name
serviceName := options.Server.Options().Name
// we pass functions to the wrappers since the values can change during initialisation
authFn := func() auth.Auth { return options.Server.Options().Auth }
cacheFn := func() *client.Cache { return options.Client.Options().Cache }
// wrap client to inject From-Service header on any calls
options.Client = wrapper.FromService(serviceName, options.Client)
options.Client = wrapper.TraceCall(serviceName, trace.DefaultTracer, options.Client)
options.Client = wrapper.CacheClient(cacheFn, options.Client)
options.Client = wrapper.AuthClient(authFn, options.Client)
// wrap the server to provide handler stats
options.Server.Init(
server.WrapHandler(wrapper.HandlerStats(stats.DefaultStats)),
server.WrapHandler(wrapper.TraceHandler(trace.DefaultTracer)),
server.WrapHandler(wrapper.AuthHandler(authFn)),
)
// set opts