Exemplo n.º 1
0
func (c *client) transport() transport.Transport {
	// Callers must hold (at least) a read lock
	if c.trans != nil {
		return c.trans
	} else {
		return transport.DefaultTransport()
	}
}
Exemplo n.º 2
0
// New creates a new service with default middleware
func New(cfg Config) Service {
	if cfg.Transport == nil {
		cfg.Transport = transport.DefaultTransport()
	}

	srv := server.NewServer(cfg.Name)
	srv.SetMiddleware(DefaultServerMiddleware())

	return &svc{
		srv:    srv,
		config: cfg,
	}
}