proxy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Pacakge proxy provides a reverse proxy for talking to Apple DEP APIs based on the standard Go reverse proxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CutIncl

func CutIncl(s, sep string) (before, after string, found bool)

CutIncl is like strings.Cut but keeps sep in after.

func New

func New(transport http.RoundTripper, store client.ConfigRetriever, logger log.Logger) *httputil.ReverseProxy

New creates new NanoDEP ReverseProxy. It dispatches requests using transport which should be a NanoDEP RoundTripper transport (which handles authentication and session management). DEP name configurations are retrieved using store and logger is used for logging.

func ProxyDEPNameHandler

func ProxyDEPNameHandler(p *httputil.ReverseProxy, logger log.Logger) http.HandlerFunc

ProxyDEPNameHandler tries to extract the DEP name from the request URL path and replaces it with the just the endpoint and embeds the name as a context value.

For example if the request URL path is "hello/world/" then "hello" is the DEP name and is set in the request context and "/world/" is then set in the HTTP request passed onto p.

Note the very beginning of the URL path is used as the DEP name. This necessitates stripping the URL prefix before using this handler. Note also that DEP names with a "/" or "%2F" are likely to cause issues as we naively search and cut by "/" in the path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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