Documentation

Index

Constants

View Source
const (
	HeaderKeySignature    = "X-CF-Proxy-Signature"
	HeaderKeyForwardedURL = "X-CF-Forwarded-Url"
	HeaderKeyMetadata     = "X-CF-Proxy-Metadata"
)

Variables

View Source
var ErrExpired = errors.New("route service request expired")

Functions

func BuildSignatureAndMetadata

func BuildSignatureAndMetadata(
	crypto secure.Crypto,
	signatureContents *SignatureContents,
) (string, string, error)

Types

type Metadata

type Metadata struct {
	Nonce []byte `json:"nonce"`
}

type RequestReceivedFromRouteService

type RequestReceivedFromRouteService struct {
	Metadata  string
	Signature string
	AppUrl    string
}

type RequestToSendToRouteService

type RequestToSendToRouteService struct {
	URLString      string
	ParsedUrl      *url.URL
	Signature      string
	Metadata       string
	ForwardedURL   string
	RecommendHttps bool
}

type RouteServiceConfig

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

func NewRouteServiceConfig

func NewRouteServiceConfig(
	logger logger.Logger,
	enabled bool,
	hairpinning bool,
	timeout time.Duration,
	crypto secure.Crypto,
	cryptoPrev secure.Crypto,
	recommendHttps bool,
) *RouteServiceConfig

func (*RouteServiceConfig) CreateRequest

func (rs *RouteServiceConfig) CreateRequest(rsUrl, forwardedUrl string) (RequestToSendToRouteService, error)

func (*RouteServiceConfig) RouteServiceEnabled

func (rs *RouteServiceConfig) RouteServiceEnabled() bool

func (*RouteServiceConfig) RouteServiceHairpinning

func (rs *RouteServiceConfig) RouteServiceHairpinning() bool

func (*RouteServiceConfig) RouteServiceRecommendHttps

func (rs *RouteServiceConfig) RouteServiceRecommendHttps() bool

func (*RouteServiceConfig) ValidateRequest

type SignatureContents

type SignatureContents struct {
	ForwardedUrl  string    `json:"forwarded_url"`
	RequestedTime time.Time `json:"requested_time"`
}

func SignatureContentsFromHeaders

func SignatureContentsFromHeaders(signatureHeader, metadataHeader string, crypto secure.Crypto) (SignatureContents, error)