Documentation ¶
Overview ¶
Package webhookrelay provides a client library to configure Webhook Relay tunnels, manage serverless functions and set up webhook forwarding routing.
Index ¶
- Constants
- Variables
- func IsName(s string) bool
- func IsUUID(s string) bool
- type API
- func (api *API) CreateAccessToken(options *AccessTokenCreateOptions) (*AccessTokenCreateResponse, error)
- func (api *API) CreateBucket(options *BucketCreateOptions) (*Bucket, error)
- func (api *API) CreateFunction(opts *CreateFunctionRequest) (*Function, error)
- func (api *API) CreateInput(options *Input) (*Input, error)
- func (api *API) CreateOutput(options *Output) (*Output, error)
- func (api *API) CreateTunnel(options *Tunnel) (*Tunnel, error)
- func (api *API) DeleteAccessToken(options *AccessTokenDeleteOptions) error
- func (api *API) DeleteBucket(options *BucketDeleteOptions) error
- func (api *API) DeleteDomainReservation(options *DomainDeleteOptions) error
- func (api *API) DeleteFunction(options *FunctionDeleteOptions) error
- func (api *API) DeleteFunctionConfigurationVariable(options *FunctionConfigurationVariableDeleteOptions) error
- func (api *API) DeleteInput(options *InputDeleteOptions) error
- func (api *API) DeleteOutput(options *OutputDeleteOptions) error
- func (api *API) DeleteTunnel(options *TunnelDeleteOptions) error
- func (api *API) GetBucket(ref string) (*Bucket, error)
- func (api *API) GetFunction(ref string) (*Function, error)
- func (api *API) GetTunnel(ref string) (*Tunnel, error)
- func (api *API) GetWebhookLog(id string) (*Log, error)
- func (api *API) InvokeFunction(options *InvokeOpts) (*ExecuteResponse, error)
- func (api *API) ListAccessTokens(options *AccessTokenListOptions) ([]*AccessToken, error)
- func (api *API) ListBuckets(options *BucketListOptions) ([]*Bucket, error)
- func (api *API) ListDomainReservations(options *DomainListOptions) ([]*Domain, error)
- func (api *API) ListFunctionConfigurationVariables(options *FunctionConfigurationVariablesListOptions) ([]*Variable, error)
- func (api *API) ListFunctions(options *FunctionListOptions) ([]*Function, error)
- func (api *API) ListInputs(options *InputListOptions) ([]*Input, error)
- func (api *API) ListOutputs(options *OutputListOptions) ([]*Output, error)
- func (api *API) ListRegions(options *RegionListOptions) ([]*Region, error)
- func (api *API) ListTunnels(options *TunnelListOptions) ([]*Tunnel, error)
- func (api *API) ListWebhookLogs(options *WebhookLogsListOptions) (*WebhookLogsResponse, error)
- func (api *API) ReserveDomain(options *Domain) (*Domain, error)
- func (api *API) ServerVersion(ctx context.Context) (*VersionInfo, error)
- func (api *API) SetFunctionConfigurationVariable(options *SetFunctionConfigRequest) (*Variable, error)
- func (api *API) UpdateAccessToken(options *AccessToken) (*AccessToken, error)
- func (api *API) UpdateBucket(options *Bucket) (*Bucket, error)
- func (api *API) UpdateFunction(options *UpdateFunctionRequest) (*Function, error)
- func (api *API) UpdateInput(options *Input) (*Input, error)
- func (api *API) UpdateOutput(options *Output) (*Output, error)
- func (api *API) UpdateTunnel(options *Tunnel) (*Tunnel, error)
- func (api *API) UpdateWebhookLog(updateRequest *WebhookLogsUpdateRequest) error
- type AccessToken
- type AccessTokenAPIAccess
- type AccessTokenCreateOptions
- type AccessTokenCreateResponse
- type AccessTokenDeleteOptions
- type AccessTokenListOptions
- type AccessTokenScopes
- type AuthType
- type Bucket
- type BucketAuth
- type BucketCreateOptions
- type BucketDeleteOptions
- type BucketListOptions
- type CreateFunctionRequest
- type Domain
- type DomainDeleteOptions
- type DomainListOptions
- type Endpoint
- type ExecuteResponse
- type Features
- type Function
- type FunctionConfigurationVariableDeleteOptions
- type FunctionConfigurationVariablesListOptions
- type FunctionDeleteOptions
- type FunctionListOptions
- type FunctionRequest
- type Headers
- type IngressRule
- type IngressRules
- type Input
- type InputDeleteOptions
- type InputListOptions
- type InvokeFunctionRequest
- type InvokeOpts
- type ListConfigResponse
- type Log
- type Logger
- type Option
- type Output
- type OutputDeleteOptions
- type OutputListOptions
- type Region
- type RegionListOptions
- type RequestStatus
- type RetryPolicy
- type SetFunctionConfigRequest
- type Tunnel
- type TunnelAuth
- type TunnelDeleteOptions
- type TunnelListOptions
- type TunnelMode
- type UpdateFunctionRequest
- type Variable
- type VersionInfo
- type WebhookLogsListOptions
- type WebhookLogsResponse
- type WebhookLogsUpdateRequest
Constants ¶
const ( CryptoOff = "off" CryptoFlexible = "flexible" CryptoFull = "full" CryptoFullStrict = "full-strict" CryptoTLSPassThrough = "tls-pass-through" )
tunnel crypto types
const ( // IDFormat are the characters allowed to represent an ID. IDFormat = `[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}` // NameFormat are the characters allowed to represent a name. NameFormat = `[a-zA-Z0-9][a-zA-Z0-9~_.-]+` )
const AnyResponseFromOutput = "anyOutput"
AnyResponseFromOutput indicates that the input should return response from whichever output responds first.
const ( // AuthToken specifies that we should authenticate with an API key & secret AuthToken = 1 << iota )
Variables ¶
var ( // IDPattern is a regular expression to validate a unique id against the // collection of restricted characters. IDPattern = regexp.MustCompile(`^` + IDFormat + `$`) // NamePattern is a regular expression to validate names against the // collection of restricted characters. NamePattern = regexp.MustCompile(`^` + NameFormat + `$`) // ErrNoRef returned when ref is incorrect ErrNoRef = errors.New("no ref provided or incorrect format") )
var (
ErrEmptyCredentials = errors.New("invalid credentials: key & secret must not be empty")
)
Errors
var ( // ErrNoSuchInput is the error returned when the Input does not exist. ErrNoSuchInput = errors.New("no such input") )
var ( // ErrNoSuchOutput is the error returned when the Output does not exist. ErrNoSuchOutput = errors.New("no such output") )
Functions ¶
Types ¶
type API ¶
type API struct { APIKey string APISecret string BaseURL string UserAgent string // contains filtered or unexported fields }
API holds the configuration for the current API client. A client should not be modified concurrently.
func (*API) CreateAccessToken ¶
func (api *API) CreateAccessToken(options *AccessTokenCreateOptions) (*AccessTokenCreateResponse, error)
CreateAccessToken - create new access token. Returned Key and Secret pair should be saved on user's side. Server has already hashed the secret so it can't be recovered. If the secret is lost, just create a new access token.
func (*API) CreateBucket ¶
func (api *API) CreateBucket(options *BucketCreateOptions) (*Bucket, error)
CreateBucket creates a Bucket and returns the newly object.
func (*API) CreateFunction ¶
func (api *API) CreateFunction(opts *CreateFunctionRequest) (*Function, error)
CreateFunction - create new function
func (*API) CreateInput ¶
CreateInput creates an Input and returns the new object.
func (*API) CreateOutput ¶
CreateOutput creates an Output and returns the new object
func (*API) CreateTunnel ¶
CreateTunnel creates new tunnel
func (*API) DeleteAccessToken ¶
func (api *API) DeleteAccessToken(options *AccessTokenDeleteOptions) error
DeleteAccessToken deletes access token
func (*API) DeleteBucket ¶
func (api *API) DeleteBucket(options *BucketDeleteOptions) error
DeleteBucket removes a Bucket by its reference.
func (*API) DeleteDomainReservation ¶
func (api *API) DeleteDomainReservation(options *DomainDeleteOptions) error
DeleteDomainReservation deletes domain reservation. It can only be removed once no Input or Tunnel is using it.
func (*API) DeleteFunction ¶
func (api *API) DeleteFunction(options *FunctionDeleteOptions) error
DeleteFunction - delete function
func (*API) DeleteFunctionConfigurationVariable ¶ added in v0.3.0
func (api *API) DeleteFunctionConfigurationVariable(options *FunctionConfigurationVariableDeleteOptions) error
DeleteFunctionConfigurationVariable - delete function configuration variable
func (*API) DeleteInput ¶
func (api *API) DeleteInput(options *InputDeleteOptions) error
DeleteInput removes input. If public input is used by the UUID, beware that after deleting an input you will not be able to recreate another one with the same ID.
func (*API) DeleteOutput ¶
func (api *API) DeleteOutput(options *OutputDeleteOptions) error
DeleteOutput deletes output from the bucket
func (*API) DeleteTunnel ¶
func (api *API) DeleteTunnel(options *TunnelDeleteOptions) error
DeleteTunnel delete tunnel by ID or name
func (*API) GetFunction ¶
GetFunction - get function by ref
func (*API) GetWebhookLog ¶ added in v0.3.0
GetWebhookLog - returns webhook lgo
func (*API) InvokeFunction ¶
func (api *API) InvokeFunction(options *InvokeOpts) (*ExecuteResponse, error)
InvokeFunction invokes function and gets a response
func (*API) ListAccessTokens ¶
func (api *API) ListAccessTokens(options *AccessTokenListOptions) ([]*AccessToken, error)
ListAccessTokens lists access tokens for an account
func (*API) ListBuckets ¶
func (api *API) ListBuckets(options *BucketListOptions) ([]*Bucket, error)
ListBuckets lists buckets for an account
func (*API) ListDomainReservations ¶
func (api *API) ListDomainReservations(options *DomainListOptions) ([]*Domain, error)
ListDomainReservations lists domain reservations for an account
func (*API) ListFunctionConfigurationVariables ¶ added in v0.3.0
func (api *API) ListFunctionConfigurationVariables(options *FunctionConfigurationVariablesListOptions) ([]*Variable, error)
ListFunctionConfigurationVariables lists function configuration variables
func (*API) ListFunctions ¶
func (api *API) ListFunctions(options *FunctionListOptions) ([]*Function, error)
ListFunctions lists functions for an account
func (*API) ListInputs ¶
func (api *API) ListInputs(options *InputListOptions) ([]*Input, error)
ListInputs returns a list of inputs belonging to the bucket. If bucket reference not supplied, all account inputs will be returned
func (*API) ListOutputs ¶
func (api *API) ListOutputs(options *OutputListOptions) ([]*Output, error)
ListOutputs returns a list of outputs belonging to the bucket. If bucket reference not supplied, all account outputs will be returned
func (*API) ListRegions ¶
func (api *API) ListRegions(options *RegionListOptions) ([]*Region, error)
ListRegions lists available regions
func (*API) ListTunnels ¶
func (api *API) ListTunnels(options *TunnelListOptions) ([]*Tunnel, error)
ListTunnels lists tunnels for an account
func (*API) ListWebhookLogs ¶ added in v0.3.0
func (api *API) ListWebhookLogs(options *WebhookLogsListOptions) (*WebhookLogsResponse, error)
ListWebhookLogs lists webhook logs for an account
func (*API) ReserveDomain ¶
ReserveDomain - reserve domain
func (*API) ServerVersion ¶
func (api *API) ServerVersion(ctx context.Context) (*VersionInfo, error)
ServerVersion returns the server's version and runtime info.
func (*API) SetFunctionConfigurationVariable ¶ added in v0.3.0
func (api *API) SetFunctionConfigurationVariable(options *SetFunctionConfigRequest) (*Variable, error)
SetFunctionConfigurationVariable allows users to set config variables for a function. Function can then use special methods to retrieve those variables during runtime.
func (*API) UpdateAccessToken ¶ added in v0.2.0
func (api *API) UpdateAccessToken(options *AccessToken) (*AccessToken, error)
UpdateAccessToken updates access token scopes, description and enabled/disable API access
func (*API) UpdateBucket ¶
UpdateBucket updates a Bucket on the server and returns the updated object.
func (*API) UpdateFunction ¶
func (api *API) UpdateFunction(options *UpdateFunctionRequest) (*Function, error)
UpdateFunction - update function
func (*API) UpdateInput ¶
UpdateInput updates existing input
func (*API) UpdateOutput ¶
UpdateOutput updates output
func (*API) UpdateTunnel ¶
UpdateTunnel updates existing tunnel
func (*API) UpdateWebhookLog ¶ added in v0.3.0
func (api *API) UpdateWebhookLog(updateRequest *WebhookLogsUpdateRequest) error
UpdateWebhookLog - update webhook log response body, headers and status code.
type AccessToken ¶
type AccessToken struct { ID string `json:"id"` // read-only CreatedAt time.Time `json:"created_at"` // read-only UpdatedAt time.Time `json:"updated_at"` // read-only LastLogin string `json:"last_login"` // read-only Description string `json:"description"` Scopes AccessTokenScopes `json:"scopes"` // APIAccess allows to enable/disabled API access. Tokens that have disabled // access can be used to subscribe to webhooks or tunnel connections. // Defaults to "enabled" APIAccess AccessTokenAPIAccess `json:"api_access"` Active bool `json:"active"` }
AccessToken - auth tokens, can be created for the agents
func (*AccessToken) MarshalJSON ¶
func (t *AccessToken) MarshalJSON() ([]byte, error)
MarshalJSON helper to marshal unix time
func (*AccessToken) UnmarshalJSON ¶
func (t *AccessToken) UnmarshalJSON(data []byte) error
UnmarshalJSON helper to unmarshal unix time
type AccessTokenAPIAccess ¶ added in v0.2.0
type AccessTokenAPIAccess string
AccessTokenAPIAccess - enables/disables API access for the token
const ( AccessTokenAPIAccessEnabled AccessTokenAPIAccess = "enabled" AccessTokenAPIAccessDisabled AccessTokenAPIAccess = "disabled" )
Available API access token status
type AccessTokenCreateOptions ¶
type AccessTokenCreateOptions struct { Description string `json:"description"` Scopes AccessTokenScopes `json:"scopes"` APIAccess AccessTokenAPIAccess `json:"api_access"` }
AccessTokenCreateOptions - used to create an access token
type AccessTokenCreateResponse ¶
AccessTokenCreateResponse - response when creating a token
type AccessTokenDeleteOptions ¶
type AccessTokenDeleteOptions struct {
ID string `json:"id"` // ID/Key
}
AccessTokenDeleteOptions used to delete access token
type AccessTokenScopes ¶ added in v0.2.0
type AccessTokenScopes struct { Tunnels []string `json:"tunnels"` Buckets []string `json:"buckets"` }
AccessTokenScopes define optional limits for tokens
type AuthType ¶
type AuthType int
AuthType is a tunnel authentication type
Available tunnel authentication modes
func (AuthType) MarshalJSON ¶
MarshalJSON is generated so AuthType satisfies json.Marshaler.
func (*AuthType) UnmarshalJSON ¶
UnmarshalJSON is generated so AuthType satisfies json.Unmarshaler.
type Bucket ¶
type Bucket struct { ID string `json:"id"` // readonly CreatedAt time.Time `json:"created_at"` // readonly UpdatedAt time.Time `json:"updated_at"` // readonly Name string `json:"name"` Description string `json:"description"` Stream bool `json:"stream"` Ephemeral bool `json:"ephemeral"` Auth BucketAuth `json:"auth"` Inputs []*Input `json:"inputs"` // readonly Outputs []*Output `json:"outputs"` // readonly }
Bucket - bucket is required for webhook inputs and outputs. There should probably be one Input per Bucket to make it easy to manage. Buckets control policies such as retries, manipulation, logs, rate limitting
func (*Bucket) MarshalJSON ¶
MarshalJSON helper to marshal unix time
func (*Bucket) UnmarshalJSON ¶
UnmarshalJSON helper to unmarshal unix time
type BucketAuth ¶
type BucketAuth struct { Type AuthType `json:"type"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Token string `json:"token,omitempty"` }
BucketAuth specifies authentication method for incoming requests to the bucket's inputs
type BucketCreateOptions ¶
type BucketCreateOptions struct { Name string `json:"name"` Description string `json:"description"` }
BucketCreateOptions create opts
type BucketDeleteOptions ¶
BucketDeleteOptions are used to delete bucket
type CreateFunctionRequest ¶
CreateFunctionRequest is used when creating a new function
type Domain ¶
type Domain struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` // Domain can be any 3rd party domain such as // user.example.com Domain string `json:"domain"` }
Domain is a domain reservation
func (*Domain) MarshalJSON ¶
MarshalJSON helper to marshal unix time
func (*Domain) UnmarshalJSON ¶
UnmarshalJSON helper to unmarshal unix time
type DomainDeleteOptions ¶
type DomainDeleteOptions struct {
Ref string `json:"ref"`
}
DomainDeleteOptions are used to delete domain reservation
type Endpoint ¶
type Endpoint struct {
Address string `json:"address"`
}
Endpoint - is an address where request should be routed
type ExecuteResponse ¶
type ExecuteResponse = reactor_v1.ExecuteResponse
ExecuteResponse is an alias to reactor v1 pkg
type Features ¶
type Features struct {
RewriteHostHeader string `json:"rewrite_host_header"`
}
Features - optional tunnel features to enable different functionality
type FunctionConfigurationVariableDeleteOptions ¶ added in v0.3.0
FunctionConfigurationVariableDeleteOptions is used in function configuration variable delete request
type FunctionConfigurationVariablesListOptions ¶ added in v0.3.0
type FunctionConfigurationVariablesListOptions struct {
ID string
}
FunctionConfigurationVariablesListOptions is used to list function config variables
type FunctionDeleteOptions ¶
type FunctionDeleteOptions struct {
ID string `json:"id"`
}
FunctionDeleteOptions is used in function delete request
type FunctionListOptions ¶
type FunctionListOptions struct{}
FunctionListOptions is used to list functions
type FunctionRequest ¶
type FunctionRequest struct { ID string `json:"id"` Name string `json:"name"` Payload string `json:"payload"` Driver string `json:"driver"` }
FunctionRequest used for creating/updating functions
type Headers ¶ added in v0.3.0
type Headers map[string]interface{}
Headers - headers are used to store request header info in the webhook log
type IngressRule ¶
type IngressRule struct { // Name is an option identifier for the ingress rule, it usually is a service name // if used with webrelay-ingress Name string `json:"name"` // Path is an extended POSIX regex as defined by IEEE Std 1003.1, // (i.e this follows the egrep/unix syntax, not the perl syntax) // matched against the path of an incoming request. Currently it can // contain characters disallowed from the conventional "path" // part of a URL as defined by RFC 3986. Paths must begin with // a '/'. If unspecified, the path defaults to a catch all sending // traffic to the backend. // +optional Path string `json:"path"` // Endpoints Endpoints []*Endpoint `json:"endpoints"` }
IngressRule is used by the ingress controller to route to multiple targets
type IngressRules ¶
type IngressRules struct {
Rules []*IngressRule `json:"rules"`
}
IngressRules - ingress defines custom routing configuration based on paths
type Input ¶
type Input struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Name string `json:"name"` FunctionID string `json:"function_id"` BucketID string `json:"bucket_id"` Headers map[string][]string `json:"headers"` StatusCode int `json:"status_code"` Body string `json:"body"` // either output ID or "anyOutput" to indicate that the first response // from any output is good enough. Empty string ResponseFromOutput string `json:"response_from_output"` CustomDomain string `json:"custom_domain"` PathPrefix string `json:"path_prefix"` Description string `json:"description"` }
Input - webhook inputs are used to create endpoints which are then used by remote systems
func (*Input) EndpointURL ¶
EndpointURL returns default input URL. If CustomDomain is set (all new inputs from 2020 06 01 are getting them), then it's this domain with path prefix, otherwise it's the URL based on the input ID
func (*Input) MarshalJSON ¶
MarshalJSON helper to change time into unix
func (*Input) UnmarshalJSON ¶
UnmarshalJSON helper to change time from unix
type InputDeleteOptions ¶
InputDeleteOptions delete options
type InputListOptions ¶
type InputListOptions struct {
Bucket string // Bucket reference - ID or name
}
InputListOptions used to query inputs
type InvokeFunctionRequest ¶
type InvokeFunctionRequest struct { Headers map[string][]string `json:"headers"` RawQuery string `json:"raw_query"` RequestBody string `json:"request_body"` Method string `json:"method"` }
InvokeFunctionRequest is a function invoke payload
type InvokeOpts ¶
type InvokeOpts struct { ID string InvokeFunctionRequest InvokeFunctionRequest }
InvokeOpts used to invoke functions, carries function ID and payload
type ListConfigResponse ¶ added in v0.3.0
type ListConfigResponse = reactor_v1.ListConfigResponse
ListConfigResponse defines function config
type Log ¶ added in v0.3.0
type Log struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` AccountID string `json:"account_id"` OutputID string `json:"output_id"` InputID string `json:"input_id"` BucketID string `json:"bucket_id"` Internal bool `json:"internal"` StatusCode int `json:"status_code"` ResponseBody []byte `json:"response_body"` ResponseHeaders Headers `json:"response_headers" ` Status RequestStatus `json:"status"` Retries int `json:"retries"` // request details Headers Headers `json:"headers"` RawQuery string `json:"raw_query"` Method string `json:"method"` ExtraPath string `json:"extra_path"` Body string `json:"body"` // If true, doesn't save request body, query or headers, // inherits from the bucket configuration Ephemeral bool `json:"ephemeral"` }
Log - received webhook event
func (*Log) MarshalJSON ¶ added in v0.3.0
MarshalJSON converst Go time into unix time
func (*Log) UnmarshalJSON ¶ added in v0.3.0
UnmarshalJSON parses unix time
type Logger ¶
type Logger interface {
Printf(format string, v ...interface{})
}
Logger defines the interface this library needs to use logging This is a subset of the methods implemented in the log package
type Option ¶
Option is a functional option for configuring the API client.
func WithHTTPClient ¶
WithHTTPClient accepts a custom *http.Client for making API calls.
func WithHeaders ¶
WithHeaders allows you to set custom HTTP headers when making API calls (e.g. for satisfying HTTP proxies, or for debugging).
func WithLogger ¶
WithLogger can be set if you want to get log output from this API instance By default no log output is emitted
func WithRetryPolicy ¶
WithRetryPolicy applies a non-default number of retries and min/max retry delays This will be used when the client exponentially backs off after errored requests
func WithUserAgent ¶
WithUserAgent can be set if you want to send a software name and version for HTTP access logs. It is recommended to set it in order to help future Customer Support diagnostics and prevent collateral damage by sharing generic User-Agent string with abusive users. E.g. "my-software/1.2.3". By default generic Go User-Agent is used.
type Output ¶
type Output struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Name string `json:"name"` BucketID string `json:"bucket_id"` FunctionID string `json:"function_id"` Headers map[string][]string `json:"headers"` Destination string `json:"destination"` Disabled bool `json:"disabled"` // Allows disabling forwarding to specific output // LockPath ensures that the request path cannot be changed from what is // specified in the destination. For example if request is coming to /v1/webhooks/xxx/github-jenkins, // with lock path 'false' and destination 'http://localhost:8080' it would go to http://localhost:8080/github-jenkins. // However, with lock path 'true', it will be sent to 'http://localhost:8080' LockPath bool `json:"lock_path"` Internal bool `json:"internal"` Timeout int `json:"timeout"` // Destination response timeout Description string `json:"description"` }
Output specified webhook forwarding destination
func (*Output) MarshalJSON ¶
MarshalJSON helper to change time into unix
func (*Output) UnmarshalJSON ¶
UnmarshalJSON helper to change time from unix
type OutputDeleteOptions ¶
OutputDeleteOptions delete options
type OutputListOptions ¶
type OutputListOptions struct {
Bucket string // Bucket reference - ID or name
}
OutputListOptions used to query outputs
type Region ¶
type Region struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Name string `json:"name"` // for default region it's just [xx].webrelay.io // but for Australia region it could be [xx].au.webrelay.io or even // a completely different, non webrelay domain. This way in theory we could allow // self-hosted but managed regions DomainSuffix string `json:"domain_suffix"` // ServerAddress is a tunneling server HOSTNAME:PORT address ServerAddress string `json:"server_address"` }
Region is a server entry that accepts tunnel connections and acts as a hub
func (*Region) MarshalJSON ¶
MarshalJSON helper to marshal unix time
func (*Region) UnmarshalJSON ¶
UnmarshalJSON helper to unmarshal unix time
type RequestStatus ¶ added in v0.3.0
type RequestStatus int
RequestStatus - available request statuses
const ( RequestStatusPreparing RequestStatus = iota RequestStatusSent RequestStatusFailed RequestStatusStalled // if request destination wasn't listening - incoming requests will be stalled RequestStatusReceived RequestStatusRejected )
default statuses
func (RequestStatus) MarshalJSON ¶ added in v0.3.0
func (r RequestStatus) MarshalJSON() ([]byte, error)
MarshalJSON is generated so RequestStatus satisfies json.Marshaler.
func (RequestStatus) String ¶ added in v0.3.0
func (s RequestStatus) String() string
func (*RequestStatus) UnmarshalJSON ¶ added in v0.3.0
func (r *RequestStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON is generated so RequestStatus satisfies json.Unmarshaler.
type RetryPolicy ¶
RetryPolicy specifies number of retries and min/max retry delays This config is used when the client exponentially backs off after errored requests
type SetFunctionConfigRequest ¶ added in v0.3.0
type SetFunctionConfigRequest struct { ID string `json:"-"` // function ID Key string `json:"key"` Value string `json:"value"` }
SetFunctionConfigRequest sets/updates function configuration
type Tunnel ¶
type Tunnel struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Name string `json:"name"` // tunnel name Group string `json:"group"` Region string `json:"region"` Destination string `json:"destination"` // destination host, defaults to 127.0.0.1:8000 Host string `json:"host"` Addr string `json:"addr"` Mode TunnelMode `json:"mode"` Protocol string `json:"protocol"` // tunnel protocol - http/tcp Crypto string `json:"crypto"` AccountID string `json:"account_id"` Description string `json:"description"` Auth TunnelAuth `json:"auth"` Features Features `json:"features"` IngressRules IngressRules `json:"ingress_rules"` }
Tunnel is a type to store bidirectional tunnel data these tunnels are different from webhook buckets in a way that they provide responses to whatever calls them
func (*Tunnel) MarshalJSON ¶
MarshalJSON marshal to unix time
func (*Tunnel) UnmarshalJSON ¶
UnmarshalJSON unamrshal unix time
type TunnelAuth ¶
type TunnelAuth struct { Type AuthType `json:"type"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Token string `json:"token,omitempty"` }
TunnelAuth - optional auth for tunnels
type TunnelDeleteOptions ¶
TunnelDeleteOptions delete options
type TunnelMode ¶
type TunnelMode int
TunnelMode - tunnel mode
const ( TunnelModeInactive TunnelMode = iota TunnelModeActive )
available tunnel modes
func ParseTunnelMode ¶
func ParseTunnelMode(mode string) TunnelMode
ParseTunnelMode - parses tunnel mode string
func (TunnelMode) MarshalJSON ¶
func (r TunnelMode) MarshalJSON() ([]byte, error)
MarshalJSON is generated so TunnelMode satisfies json.Marshaler.
func (TunnelMode) String ¶
func (s TunnelMode) String() string
func (*TunnelMode) UnmarshalJSON ¶
func (r *TunnelMode) UnmarshalJSON(data []byte) error
UnmarshalJSON is generated so TunnelMode satisfies json.Unmarshaler.
type UpdateFunctionRequest ¶
UpdateFunctionRequest is used when updating an existing function
type Variable ¶ added in v0.3.0
type Variable = reactor_v1.Variable
Variable is function configuration variable
type VersionInfo ¶
type VersionInfo struct { Name string `json:"name"` BuildDate string `json:"buildDate"` Revision string `json:"revision"` Version string `json:"version"` APIVersion string `json:"apiVersion"` GoVersion string `json:"goVersion"` OS string `json:"os"` Arch string `json:"arch"` KernelVersion string `json:"kernelVersion"` Experimental bool `json:"experimental"` }
VersionInfo describes version and runtime info.
type WebhookLogsListOptions ¶ added in v0.3.0
type WebhookLogsListOptions struct { BucketID string Status RequestStatus From time.Time To time.Time Limit int Offset int }
WebhookLogsListOptions - list logs options
type WebhookLogsResponse ¶ added in v0.3.0
type WebhookLogsResponse struct { Data []*Log `json:"data"` Total int `json:"total"` Limit int `json:"limit"` Offset int `json:"offset"` }
WebhookLogsResponse is a webhook query response
type WebhookLogsUpdateRequest ¶ added in v0.3.0
type WebhookLogsUpdateRequest struct { ID string `json:"id"` StatusCode int `json:"status_code"` ResponseBody []byte `json:"response_body"` ResponseHeaders Headers `json:"response_headers" ` Status RequestStatus `json:"status"` Retries int `json:"retries"` }
WebhookLogsUpdateRequest is used to update Webhook Relay request if used for example with WebSocket transponder (it becomes client's responsibility to do this action). Response information must be sent within 10 seconds of receiving the webhook.