remove transport options
This commit is contained in:
@@ -9,8 +9,6 @@ import (
|
|||||||
"github.com/micro/go-micro/v3/client"
|
"github.com/micro/go-micro/v3/client"
|
||||||
mucpClient "github.com/micro/go-micro/v3/client/mucp"
|
mucpClient "github.com/micro/go-micro/v3/client/mucp"
|
||||||
"github.com/micro/go-micro/v3/model"
|
"github.com/micro/go-micro/v3/model"
|
||||||
"github.com/micro/go-micro/v3/network/transport"
|
|
||||||
thttp "github.com/micro/go-micro/v3/network/transport/http"
|
|
||||||
"github.com/micro/go-micro/v3/registry"
|
"github.com/micro/go-micro/v3/registry"
|
||||||
"github.com/micro/go-micro/v3/registry/mdns"
|
"github.com/micro/go-micro/v3/registry/mdns"
|
||||||
"github.com/micro/go-micro/v3/server"
|
"github.com/micro/go-micro/v3/server"
|
||||||
@@ -18,12 +16,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Broker broker.Broker
|
Broker broker.Broker
|
||||||
Client client.Client
|
Client client.Client
|
||||||
Server server.Server
|
Server server.Server
|
||||||
Model model.Model
|
Model model.Model
|
||||||
Registry registry.Registry
|
Registry registry.Registry
|
||||||
Transport transport.Transport
|
|
||||||
|
|
||||||
// Before and After funcs
|
// Before and After funcs
|
||||||
BeforeStart []func() error
|
BeforeStart []func() error
|
||||||
@@ -40,12 +37,11 @@ type Option func(*Options)
|
|||||||
|
|
||||||
func NewOptions(opts ...Option) Options {
|
func NewOptions(opts ...Option) Options {
|
||||||
opt := Options{
|
opt := Options{
|
||||||
Broker: http.NewBroker(),
|
Broker: http.NewBroker(),
|
||||||
Client: mucpClient.NewClient(),
|
Client: mucpClient.NewClient(),
|
||||||
Server: mucpServer.NewServer(),
|
Server: mucpServer.NewServer(),
|
||||||
Registry: mdns.NewRegistry(),
|
Registry: mdns.NewRegistry(),
|
||||||
Transport: thttp.NewTransport(),
|
Context: context.Background(),
|
||||||
Context: context.Background(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
@@ -107,17 +103,6 @@ func Registry(r registry.Registry) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transport sets the transport for the service
|
|
||||||
// and the underlying components
|
|
||||||
func Transport(t transport.Transport) Option {
|
|
||||||
return func(o *Options) {
|
|
||||||
o.Transport = t
|
|
||||||
// Update Client and Server
|
|
||||||
o.Client.Init(client.Transport(t))
|
|
||||||
o.Server.Init(server.Transport(t))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convenience options
|
// Convenience options
|
||||||
|
|
||||||
// Address sets the address of the server
|
// Address sets the address of the server
|
||||||
|
Reference in New Issue
Block a user