Documentation
¶
Index ¶
- func ConnectToService(ctx context.Context, brokerUrl, prefix, originName string) (conn net.Conn, err error)
- func InitializeBrokerClient(ctx context.Context, egrp *errgroup.Group, router *gin.Engine)
- func LaunchNamespaceKeyMaintenance(ctx context.Context, egrp *errgroup.Group)
- func LaunchRequestMonitor(ctx context.Context, egrp *errgroup.Group, sType server_structs.ServerType, ...) (err error)
- func RegisterBroker(ctx context.Context, router *gin.RouterGroup)
- func RegisterBrokerCallback(ctx context.Context, router *gin.RouterGroup)
- func Reset()
- func ResetState()
- type BrokerDialer
- type BrokerListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectToService ¶
func ConnectToService(ctx context.Context, brokerUrl, prefix, originName string) (conn net.Conn, err error)
Given an origin's broker URL, return a connected socket to the origin
func InitializeBrokerClient ¶
InitializeBrokerClient sets up everything needed for a service to use brokered connections (as the initiator, not as the broker itself).
func LaunchNamespaceKeyMaintenance ¶
Launches a background goroutine that periodically expires the namespace key cache
func LaunchRequestMonitor ¶
func LaunchRequestMonitor(ctx context.Context, egrp *errgroup.Group, sType server_structs.ServerType, privateName, registeredPrefix string, resultChan chan any) (err error)
Launch a goroutine that polls the broker endpoint for reversal requests The returned channel will produce listeners that are "one shot"; it's a TLS listener where you can invoke "Accept" once before it automatically closes itself. It is the result of a successful connection reversal to a cache.
The request monitor is used by the "private service" (the service behind the firewall) to know when to setup connections requested by the "public service" (e.g., a cache).
The registeredPrefix parameter, if non-empty, specifies the namespace prefix to use for token authentication. This should be the prefix that the service is registered under in the registry. If empty, the prefix is constructed from privateName. This is useful when polling for multiple addresses (e.g., both web URL and XRootD URL) but authenticating with a single registered namespace.
func RegisterBroker ¶
func RegisterBroker(ctx context.Context, router *gin.RouterGroup)
Register the central broker functionality with the gin router.
Typically, this is done by the director; two APIs are exposed:
- `retrieve`: Services needing connection brokering (e.g., origins behind a firewall) will long-poll this endpoint to retrieve any connection brokering requests from a public service (e.g., a cache).
- `reverse`: Invoked by a public service (e.g., a cache) that would like to connect to a service behind a firewall (e.g., an origin). Official request for the origin to make a connection.
func RegisterBrokerCallback ¶
func RegisterBrokerCallback(ctx context.Context, router *gin.RouterGroup)
Register the HTTP handlers for the callback to a cache
Types ¶
type BrokerDialer ¶
type BrokerDialer struct {
// contains filtered or unexported fields
}
BrokerDialer is a dialer that can use the broker functionality to connect to a remote service.
func NewBrokerDialer ¶
func NewBrokerDialer(ctx context.Context, egrp *errgroup.Group) *BrokerDialer
NewBrokerDialer creates a new BrokerDialer.
func (*BrokerDialer) DialContext ¶
DialContext dials a connection to the given network and address using the broker.
func (*BrokerDialer) HasBrokerEndpoint ¶
func (d *BrokerDialer) HasBrokerEndpoint(addr string) bool
HasBrokerEndpoint returns true if the dialer knows about a broker endpoint for the given address.
func (*BrokerDialer) UseBroker ¶
func (d *BrokerDialer) UseBroker(serverType server_structs.ServerType, name, brokerUrl, prefix string)
Set the dialer to use `brokerUrl` as the broker endpoint for the service `name`.
type BrokerListener ¶
BrokerListener wraps a net.Listener with broker connection metadata