mirror of
				https://github.com/go-micro/go-micro.git
				synced 2025-10-30 23:27:41 +02:00 
			
		
		
		
	move router
This commit is contained in:
		| @@ -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 { | ||||
|   | ||||
							
								
								
									
										16
									
								
								cmd/cmd.go
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								cmd/cmd.go
									
									
									
									
									
								
							| @@ -321,9 +321,9 @@ var ( | ||||
| 	} | ||||
|  | ||||
| 	DefaultBrokers = map[string]func(...broker.Option) broker.Broker{ | ||||
| 		"memory":  memory.NewBroker, | ||||
| 		"nats":    nats.NewBroker, | ||||
| 		"http":    brokerHttp.NewBroker, | ||||
| 		"memory": memory.NewBroker, | ||||
| 		"nats":   nats.NewBroker, | ||||
| 		"http":   brokerHttp.NewBroker, | ||||
| 	} | ||||
|  | ||||
| 	DefaultClients = map[string]func(...client.Option) client.Client{ | ||||
| @@ -332,9 +332,9 @@ var ( | ||||
| 	} | ||||
|  | ||||
| 	DefaultRegistries = map[string]func(...registry.Option) registry.Registry{ | ||||
| 		"etcd":    etcd.NewRegistry, | ||||
| 		"mdns":    mdns.NewRegistry, | ||||
| 		"memory":  rmem.NewRegistry, | ||||
| 		"etcd":   etcd.NewRegistry, | ||||
| 		"mdns":   mdns.NewRegistry, | ||||
| 		"memory": rmem.NewRegistry, | ||||
| 	} | ||||
|  | ||||
| 	DefaultSelectors = map[string]func(...selector.Option) selector.Selector{ | ||||
| @@ -359,7 +359,7 @@ var ( | ||||
| 	} | ||||
|  | ||||
| 	DefaultStores = map[string]func(...store.Option) store.Store{ | ||||
| 		"memory":  memStore.NewStore, | ||||
| 		"memory": memStore.NewStore, | ||||
| 	} | ||||
|  | ||||
| 	DefaultTracers = map[string]func(...trace.Option) trace.Tracer{ | ||||
| @@ -368,7 +368,7 @@ var ( | ||||
| 	} | ||||
|  | ||||
| 	DefaultAuths = map[string]func(...auth.Option) auth.Auth{ | ||||
| 		"jwt":     jwtAuth.NewAuth, | ||||
| 		"jwt": jwtAuth.NewAuth, | ||||
| 	} | ||||
|  | ||||
| 	DefaultAuthProviders = map[string]func(...provider.Option) provider.Provider{ | ||||
|   | ||||
| @@ -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" | ||||
| ) | ||||
|  | ||||
|   | ||||
| @@ -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" | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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" | ||||
| ) | ||||
|  | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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)) | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -119,7 +119,7 @@ func (q *quicTransport) Dial(addr string, opts ...transport.DialOption) (transpo | ||||
| 	} | ||||
| 	s, err := quic.DialAddr(addr, config, &quic.Config{ | ||||
| 		MaxIdleTimeout: time.Minute * 2, | ||||
| 		KeepAlive:   true, | ||||
| 		KeepAlive:      true, | ||||
| 	}) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
|   | ||||
		Reference in New Issue
	
	Block a user