reverse_tunnel

package
v15.11.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = "reverse_tunnel"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IOFunc added in v15.6.0

type IOFunc func()

IOFunc is a function that performs I/O. It should be called when not holding a mutex to avoid blocking other goroutines trying to acquire the mutex for the duration of the I/O.

type RpcApi

type RpcApi interface {
	HandleIoError(log *zap.Logger, msg string, err error) error
}

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 TunnelDataCallback interface {
	Header(map[string]*prototool.Values) error
	Message([]byte) error
	Trailer(map[string]*prototool.Values) error
	Error(*statuspb.Status) error
}

type TunnelFinder

type TunnelFinder interface {
	// FindTunnel finds a tunnel to a matching agentk.
	// It waits for a matching tunnel to proxy a connection through. When a matching tunnel is found, it is returned.
	// It only returns errors from the context or context.Canceled if the finder is shutting down.
	// service and method and gRPC service and method that the agent must support.
	FindTunnel(ctx context.Context, agentId int64, service, method string) (Tunnel, error)
}

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, ownPrivateApiUrl string) (*TunnelRegistry, error)

func (*TunnelRegistry) FindTunnel

func (r *TunnelRegistry) FindTunnel(ctx context.Context, agentId int64, service, method string) (Tunnel, error)

func (*TunnelRegistry) HandleTunnel

func (r *TunnelRegistry) HandleTunnel(ctx context.Context, agentInfo *api.AgentInfo, server rpc.ReverseTunnel_ConnectServer) error

func (*TunnelRegistry) Stop added in v15.6.0

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL