Documentation
¶
Index ¶
- type AggregatingQuerier
- type DataCallback
- type FindHandle
- type Finder
- type Handler
- type PollKasUrlsByAgentIdCallback
- type PollingQuerier
- type Querier
- type RedisTracker
- func (t *RedisTracker) KasUrlsByAgentId(ctx context.Context, agentId int64) ([]string, error)
- func (t *RedisTracker) Refresh(ctx context.Context, ttl time.Duration, agentIds ...int64) error
- func (t *RedisTracker) RegisterTunnel(ctx context.Context, ttl time.Duration, agentId int64) error
- func (t *RedisTracker) UnregisterTunnel(ctx context.Context, agentId int64) error
- type Registerer
- type Registry
- func (r *Registry) FindTunnel(ctx context.Context, agentId int64, service, method string) (bool, 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 RpcApi
- type Tracker
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregatingQuerier ¶
type AggregatingQuerier struct {
// contains filtered or unexported fields
}
AggregatingQuerier groups polling requests.
func NewAggregatingQuerier ¶
func (*AggregatingQuerier) CachedKasUrlsByAgentId ¶
func (q *AggregatingQuerier) CachedKasUrlsByAgentId(agentId int64) []string
func (*AggregatingQuerier) PollKasUrlsByAgentId ¶
func (q *AggregatingQuerier) PollKasUrlsByAgentId(ctx context.Context, agentId int64, cb PollKasUrlsByAgentIdCallback)
type DataCallback ¶
type FindHandle ¶
type FindHandle interface {
// Get finds a tunnel to an agentk.
// It waits for a matching tunnel to proxy a connection through. When a matching tunnel is found, it is returned.
// It returns gRPC status errors only, ready to return from RPC handler.
Get(ctx context.Context) (Tunnel, error)
// Done must be called to free resources of this FindHandle instance.
// ctx is used for tracing only.
Done(ctx context.Context)
}
type Finder ¶
type Finder interface {
// FindTunnel starts searching for a tunnel to a matching agentk.
// Found tunnel is:
// - to an agent with provided id.
// - supports handling provided gRPC service and method.
// Tunnel found boolean indicates whether a suitable tunnel is immediately available from the
// returned FindHandle object.
FindTunnel(ctx context.Context, agentId int64, service, method string) (bool, FindHandle)
}
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 rpc.ReverseTunnel_ConnectServer) error
}
type PollKasUrlsByAgentIdCallback ¶
type PollKasUrlsByAgentIdCallback func(kasUrls []string)
PollKasUrlsByAgentIdCallback is called periodically with found kas URLs for a particular agent id.
type PollingQuerier ¶
type RedisTracker ¶
type RedisTracker struct {
// contains filtered or unexported fields
}
func NewRedisTracker ¶
func NewRedisTracker(client rueidis.Client, agentKeyPrefix string, ownPrivateApiUrl string) *RedisTracker
func (*RedisTracker) KasUrlsByAgentId ¶
func (*RedisTracker) RegisterTunnel ¶
func (*RedisTracker) UnregisterTunnel ¶
func (t *RedisTracker) UnregisterTunnel(ctx context.Context, agentId int64) error
type Registerer ¶
type Registerer interface {
// RegisterTunnel registers tunnel with the tracker.
RegisterTunnel(ctx context.Context, ttl time.Duration, agentId int64) error
// UnregisterTunnel unregisters tunnel with the tracker.
UnregisterTunnel(ctx context.Context, agentId int64) error
// Refresh refreshes registered tunnels in the underlying storage.
Refresh(ctx context.Context, ttl time.Duration, agentIds ...int64) error
}
Registerer allows to register and unregister tunnels. Caller is responsible for periodically calling GC() and Refresh(). Not safe for concurrent use.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func (*Registry) FindTunnel ¶
func (*Registry) HandleTunnel ¶
func (*Registry) KasUrlsByAgentId ¶
type Tracker ¶
type Tracker interface {
Registerer
Querier
}
type Tunnel ¶
type Tunnel interface {
// ForwardStream performs bi-directional message forwarding between incomingStream and the tunnel.
// cb is called with header, messages and trailer coming from the tunnel. It's the callers
// responsibility to forward them into the incomingStream.
ForwardStream(log *zap.Logger, rpcApi RpcApi, incomingStream grpc.ServerStream, cb DataCallback) error
// Done must be called when the caller is done with the Tunnel.
// ctx is used for tracing only.
Done(ctx context.Context)
}
Click to show internal directories.
Click to hide internal directories.