Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrStatusNotOK = fmt.Errorf("status code not OK")
Functions ¶
func Start ¶
func Start(handler interface{})
Start is a replacement to lambda.Start that configures the proxy from environment variables. 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 NewConfigFromEnvironment for the environment variables that are used.
func StartWithConfig ¶ added in v0.1.4
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 url.URL `json:"clientBastionEndpoint"` ServerBastionEndpoint url.URL `json:"serverBastionEndpoint"` ListenAddress string `json:"listenAddress"` ApplicationId string `json:"applicationId"` }
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 (required for client) 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).