remenv

package
v2.17.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderAPIKey        = "X-Api-Key"            // #nosec G101: header name, not a credential
	HeaderAgentToken    = "X-Arcane-Agent-Token" // #nosec G101: header name, not a credential
	HeaderAuthorization = "Authorization"
)

Variables

View Source
var ErrEnvironmentUnavailable = errors.New("edge agent is not connected")

Functions

func ApplyAgentTokenHeaderMap

func ApplyAgentTokenHeaderMap(headers map[string]string, accessToken *string)

ApplyAgentTokenHeaderMap mirrors ApplyAgentTokenHeaders for map-based header carriers.

func ApplyAgentTokenHeaders

func ApplyAgentTokenHeaders(headers http.Header, accessToken *string)

ApplyAgentTokenHeaders sets the agent token in both X- header forms. It never sets Authorization, which carries the proxied user's own token.

func ExtractBearerToken

func ExtractBearerToken(headerValue string) string

ExtractBearerToken returns the trimmed token from an "Authorization: Bearer <token>" value, or "" when the scheme (case-insensitive) is not Bearer.

func RedactedTokenFingerprint

func RedactedTokenFingerprint(token string) string

RedactedTokenFingerprint returns a short, non-reversible token identifier for debug logs.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client, tunnel TunnelTransport) *Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, req Request) (*Response, error)

type DecodeError

type DecodeError struct {
	Err error
}

func (*DecodeError) Error

func (e *DecodeError) Error() string

func (*DecodeError) Unwrap

func (e *DecodeError) Unwrap() error

type Request

type Request struct {
	EnvironmentID string
	IsEdge        bool
	Method        string
	URL           string
	Path          string
	Headers       map[string]string
	Body          []byte
}

type Response

type Response struct {
	StatusCode int
	Body       []byte
	Headers    map[string]string
}

func (*Response) RequireSuccess

func (r *Response) RequireSuccess() error

type StatusError

type StatusError struct {
	StatusCode int
	Body       []byte
}

func (*StatusError) Error

func (e *StatusError) Error() string

type TransportError

type TransportError struct {
	Err error
}

func (*TransportError) Error

func (e *TransportError) Error() string

func (*TransportError) Unavailable added in v2.11.0

func (e *TransportError) Unavailable() bool

Unavailable reports connection failures that permit using locally stored data. Invalid requests and failures reading an established response are not outages.

func (*TransportError) Unwrap

func (e *TransportError) Unwrap() error

type TunnelTransport

type TunnelTransport interface {
	EnsureAvailable(ctx context.Context, envID string) error
	Do(ctx context.Context, envID, method, path string, headers map[string]string, body []byte) (*Response, error)
}

type TunnelTransportFuncs

type TunnelTransportFuncs struct {
	EnsureAvailableFunc func(ctx context.Context, envID string) error
	DoFunc              func(ctx context.Context, envID, method, path string, headers map[string]string, body []byte) (*Response, error)
}

func (TunnelTransportFuncs) Do

func (t TunnelTransportFuncs) Do(ctx context.Context, envID, method, path string, headers map[string]string, body []byte) (*Response, error)

func (TunnelTransportFuncs) EnsureAvailable

func (t TunnelTransportFuncs) EnsureAvailable(ctx context.Context, envID string) error

Jump to

Keyboard shortcuts

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