Documentation
¶
Index ¶
Constants ¶
View Source
const (
ModuleName = "reverse_tunnel"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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. Done() }
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 TunnelDataCallback) error // Done must be called when the caller is done with the Tunnel. Done() }
type TunnelDataCallback ¶
type TunnelFinder ¶
type TunnelFinder 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(agentId int64, service, method string) (bool, FindHandle) }
type TunnelHandler ¶
type TunnelHandler 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. // ctx can be used to unblock the method if the tunnel is not being used already. // ctx should be a child of the server's context. HandleTunnel(ctx context.Context, agentInfo *api.AgentInfo, server rpc.ReverseTunnel_ConnectServer) error }
type TunnelRegistry ¶
type TunnelRegistry struct {
// contains filtered or unexported fields
}
func NewTunnelRegistry ¶
func NewTunnelRegistry(log *zap.Logger, errRep errz.ErrReporter, tunnelRegisterer tracker.Registerer) (*TunnelRegistry, error)
func (*TunnelRegistry) FindTunnel ¶
func (r *TunnelRegistry) FindTunnel(agentId int64, service, method string) (bool, FindHandle)
func (*TunnelRegistry) HandleTunnel ¶
func (r *TunnelRegistry) HandleTunnel(ctx context.Context, agentInfo *api.AgentInfo, server rpc.ReverseTunnel_ConnectServer) error
func (*TunnelRegistry) Stop ¶
func (r *TunnelRegistry) Stop()
Stop aborts any open tunnels. It should not be necessary to abort tunnels when registry is used correctly i.e. this method is called after all tunnels have terminated gracefully.
Click to show internal directories.
Click to hide internal directories.