Documentation ¶
Index ¶
- func SetRoutingMetadata(md metadata.MD, agentID int64) metadata.MD
- type AgentFinder
- type AggregatingQuerier
- type Handler
- type Plugin
- func (p *Plugin) FindReadyGateway(ctx context.Context, log *slog.Logger, method string) (tunserver.ReadyGateway, *slog.Logger, int64, error)
- func (p *Plugin) FindTunnel(stream grpc.ServerStream, rpcAPI modshared.RPCAPI) (bool, *slog.Logger, tunserver.FindHandle, error)
- func (p *Plugin) PrepareStreamForForwarding(stream grpc.ServerStream) (grpc.ServerStream, error)
- type Querier
- type RedisTracker
- type Registerer
- type RegistrationBuilder
- type Registry
- func (r *Registry) FindTunnel(ctx context.Context, agentID int64, service, method string) (bool, tunserver.FindHandle)
- func (r *Registry) HandleTunnel(ageCtx context.Context, agentInfo *api.AgentInfo, ...) error
- func (r *Registry) KASURLsByAgentID(ctx context.Context, agentID int64) ([]string, error)
- func (r *Registry) Run(ctx context.Context) error
- type Tracker
- type TunnelFinder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentFinder ¶ added in v17.1.0
type AggregatingQuerier ¶
type AggregatingQuerier struct {
// contains filtered or unexported fields
}
AggregatingQuerier groups polling requests.
func NewAggregatingQuerier ¶
func (*AggregatingQuerier) CachedGatewayURLs ¶
func (q *AggregatingQuerier) CachedGatewayURLs(agentID int64) []string
func (*AggregatingQuerier) PollGatewayURLs ¶
func (q *AggregatingQuerier) PollGatewayURLs(ctx context.Context, agentID int64, cb tunserver.PollGatewayURLsCallback)
type Handler ¶
type Handler interface { // HandleTunnel is called with server-side interface of the reverse tunnel. // It registers the tunnel and blocks, waiting for a request to proxy through the tunnel. // The method returns the error value to return to gRPC framework. // ageCtx can be used to unblock the method if the tunnel is not being used already. HandleTunnel(ageCtx context.Context, agentInfo *api.AgentInfo, server grpc.BidiStreamingServer[rpc.ConnectRequest, rpc.ConnectResponse]) error }
type Plugin ¶ added in v17.1.0
type Plugin struct {
// contains filtered or unexported fields
}
func NewPlugin ¶ added in v17.1.0
func NewPlugin( api modshared.API, kasPool grpctool.PoolInterface, gatewayQuerier tunserver.PollingGatewayURLQuerier, agentFinder AgentFinder, tunnelRegistry TunnelFinder, tracer trace.Tracer, meter otelmetric.Meter, ownPrivateAPIURL string, pollConfig retry.PollConfigFactory, tryNewGatewayInterval time.Duration, tunnelFindTimeout time.Duration, ) (*Plugin, error)
func (*Plugin) FindReadyGateway ¶ added in v17.1.0
func (*Plugin) FindTunnel ¶ added in v17.1.0
func (*Plugin) PrepareStreamForForwarding ¶ added in v17.1.0
func (p *Plugin) PrepareStreamForForwarding(stream grpc.ServerStream) (grpc.ServerStream, error)
type RedisTracker ¶
type RedisTracker struct {
// contains filtered or unexported fields
}
func NewRedisTracker ¶
func NewRedisTracker(client rueidis.Client, agentKeyPrefix string, ownPrivateAPIURL string, m otelmetric.Meter) (*RedisTracker, error)
func (*RedisTracker) KASURLsByAgentID ¶
func (*RedisTracker) RegistrationBuilder ¶ added in v17.4.0
func (t *RedisTracker) RegistrationBuilder() RegistrationBuilder
type Registerer ¶
type Registerer interface { RegistrationBuilder() RegistrationBuilder // GC deletes expired tunnels from the underlying storage. GC(ctx context.Context, agentIDs []int64) (int, error) }
Registerer allows to register and unregister tunnels. Caller is responsible for periodically calling GC() and Refresh(). Not safe for concurrent use.
type RegistrationBuilder ¶ added in v17.4.0
type RegistrationBuilder interface { // Register registers tunnels for the given agent ids with the tracker. Register(ttl time.Duration, agentIDs ...int64) // Unregister unregisters tunnels for the given agent ids with the tracker. Unregister(agentIDs ...int64) // Refresh refreshes registered tunnels in the underlying storage. Refresh(ttl time.Duration, agentIDs ...int64) // Do executes the enqueued operations. Do(context.Context) error }
RegistrationBuilder allows batching tunnel (un)registrations. Can be reused after Do is called.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func (*Registry) FindTunnel ¶
func (*Registry) HandleTunnel ¶
func (r *Registry) HandleTunnel(ageCtx context.Context, agentInfo *api.AgentInfo, server grpc.BidiStreamingServer[rpc.ConnectRequest, rpc.ConnectResponse]) error
func (*Registry) KASURLsByAgentID ¶
type Tracker ¶
type Tracker interface { Registerer Querier }
type TunnelFinder ¶ added in v17.1.0
Click to show internal directories.
Click to hide internal directories.