Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrStatusNotOK = fmt.Errorf("status code not OK")
Functions ¶
func Start ¶
func Start(appName string, handler interface{})
Start is a replacement to lambda.Start that configures the proxy from environment variables and SSM. It will start the proxy if the application is running in a Lambda, or start the receiver if it is running locally. The handler is the handler that will be invoked when a request is received. It is subject to the same restrictions as the handler for the underlying serverless function provider (such as lambda.Start). See NewConfig for the environment variables that are used. The application name is an arbitrary identifier to uniquely identify this application in order to route messages.
func StartWithConfig ¶
func StartWithConfig(config FuncieConfig, logger *slog.Logger, handler interface{})
StartWithConfig is a replacement to lambda.Start that configures the proxy from the given config. See `Start` for more information.
Types ¶
type BastionClient ¶
type BastionClient interface { // SendRequest sends a request to the bastion. SendRequest(ctx context.Context, request *funcie.Message) (*funcie.Response, error) }
BastionClient is a client that can send requests to a server bastion.
func NewHTTPBastionClient ¶
func NewHTTPBastionClient(endpoint url.URL, logger *slog.Logger) BastionClient
NewHTTPBastionClient creates a new BastionClient that uses HTTP to communicate with the bastion.
type BastionReceiver ¶
type BastionReceiver interface { // Start starts the tunnel. This function never returns unless Stop is called by another goroutine. Start() // Stop stops the tunnel. Stop() }
BastionReceiver represents a receiver that can be used to receive requests from a bastion.
func NewLambdaBastionReceiver ¶
func NewLambdaBastionReceiver( applicationId string, listenAddress string, bastionEndpoint url.URL, handler interface{}, logger *slog.Logger, ) BastionReceiver
NewLambdaBastionReceiver creates a new BastionReceiver for AWS Lambda operations. The handler is the handler that will be invoked when a request is received. It is subject to the same restrictions as the handler for the underlying serverless function provider (such as lambda.Start).
type FuncieConfig ¶
type FuncieConfig struct { // ClientBastionEndpoint is the endpoint of the bastion running on the client machine. ClientBastionEndpoint url.URL `json:"clientBastionEndpoint"` // ServerBastionEndpoint is the endpoint of the bastion running in the cloud, often private. ServerBastionEndpoint url.URL `json:"serverBastionEndpoint"` // ListenAddress is the address that the local server will listen on. ListenAddress string `json:"listenAddress"` // ApplicationId is the ID of the application that the tunnel is for. ApplicationId string `json:"applicationId"` }
FuncieConfig is the basic configuration for both the local and Lambda versions of the Funcie tunnel.
func NewConfig ¶ added in v0.5.0
NewConfig creates a new Config from a combination of environment variables and SSM parameters. The following variables are used:
FUNCIE_CLIENT_BASTION_ENDPOINT (optional; for client, defaults to port 24193 on localhost) FUNCIE_SERVER_BASTION_ENDPOINT -> /funcie/<env>/bastion_host (required) FUNCIE_LISTEN_ADDRESS (optional; defaults to localhost on a random port)
func NewConfigFromEnvironment ¶
func NewConfigFromEnvironment() *FuncieConfig
NewConfigFromEnvironment creates a new Config from environment variables. The following environment variables are used:
FUNCIE_APPLICATION_ID (required) FUNCIE_CLIENT_BASTION_ENDPOINT (optional; for client, defaults to port 24193 on localhost) FUNCIE_SERVER_BASTION_ENDPOINT (required for server) FUNCIE_LISTEN_ADDRESS (optional; defaults to localhost on a random port)
type FunctionProxy ¶
type FunctionProxy interface {
// Start starts the tunnel. This function never returns unless Stop is called by another goroutine.
Start()
}
FunctionProxy represents a proxy that can be used to wrap the invocation of a function, such as a Lambda.
func NewLambdaFunctionProxy ¶
func NewLambdaFunctionProxy( applicationId string, client BastionClient, handler interface{}, logger *slog.Logger, ) FunctionProxy
NewLambdaFunctionProxy creates a new FunctionProxy for AWS Lambda operations. The handler is the handler that will be invoked when a request is received. It is subject to the same restrictions as the handler for the underlying serverless function provider (such as lambda.Start).
type SsmParameterStoreClient ¶ added in v0.5.0
type SsmParameterStoreClient interface {
GetParameter(ctx context.Context, params *ssm.GetParameterInput, optFns ...func(options *ssm.Options)) (*ssm.GetParameterOutput, error)
}
SsmParameterStoreClient is a minimal interface for the SSM client.