Documentation
¶
Overview ¶
Package proxy serves the Temporal WorkflowService on a local unix socket, forwarding every request to an upstream Temporal frontend over gRPC. The socket path is derived from the upstream host:port, so local workers connect without TLS while the upstream hop stays secured.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Options(fx.Invoke(func(p ProxyParams) error { for i := range p.Config.Upstreams { upstream := &p.Config.Upstreams[i] if err := upstream.Validate(); err != nil { return fmt.Errorf("invalid upstream configuration: %w", err) } if upstream.IsTemplated() { return fmt.Errorf( "upstream %q has a templated hostPort %q: templated upstreams are not yet supported", upstream.Name, upstream.Listen.HostPort, ) } opts := []Option{WithCredentials(upstreamCreds(upstream))} if p.Logger != nil { opts = append(opts, WithLogger(p.Logger)) } svr, err := New(upstream.Listen.HostPort, opts...) if err != nil { return fmt.Errorf("failed to create proxy for upstream %q: %w", upstream.Name, err) } p.Lifecycle.Append(fx.Hook{ OnStart: func(context.Context) error { go func() { if err := svr.Start(p.Context); err != nil { _ = p.Shutdowner.Shutdown(fx.ExitCode(1)) } }() return nil }, OnStop: svr.Stop, }) } return nil }))
Module is the fx module that constructs the proxy Server from ProxyParams and binds its lifecycle to the application.
Functions ¶
This section is empty.
Types ¶
type Credentials ¶
type Credentials interface {
DialOption() (grpc.DialOption, error)
}
Credentials produces the grpc.DialOption used to secure the outbound connection to the upstream Temporal frontend.
type Option ¶
type Option func(*Options)
Option configures a Server via New.
func WithCredentials ¶
func WithCredentials(creds Credentials) Option
WithCredentials sets the transport credentials used to dial the upstream frontend.
func WithLogger ¶
WithLogger sets the logger used by the proxy.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options configures a Server at construction time.
type ProxyParams ¶
type ProxyParams struct {
fx.In
Lifecycle fx.Lifecycle
Shutdowner fx.Shutdowner
// Required values
Context context.Context
Config *config.Config
// Optional values
Logger logger.Logger `optional:"true"`
}
ProxyParams collects the fx-provided dependencies needed to construct and run the proxy Server. Context and Config are required; Logger is optional and falls back to the default used by New when not supplied.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server proxies the Temporal WorkflowService. It dials an upstream frontend and re-serves it on a local unix socket, letting local workers connect without TLS while the upstream hop stays secured.
func New ¶
New constructs a Server that forwards WorkflowService traffic to the upstream frontend at hostPort. The local listener is a unix socket whose path is derived from hostPort (see Server.Start). With no options it dials the upstream with insecure credentials and logs via a CLI logger.