proxy

package
v0.0.0-...-1509966 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(initFns ...OptionFn) http.RoundTripper

Types

type OptionFn

type OptionFn func(transport *Transport) error

func WithActor

func WithActor(act *vocab.Actor) OptionFn

func WithProxyURL

func WithProxyURL(proxyURL vocab.IRI) OptionFn

func WithTransport

func WithTransport(tr http.RoundTripper) OptionFn

type Transport

type Transport struct {
	Base http.RoundTripper

	ProxyURL vocab.IRI
}

func (Transport) RoundTrip

func (t Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip only accepts HTTP GET requests to a remote server. If a 403 (or 401, for Mastodon servers with secure fetch) error is returned by the Base round-tripper, and we have a valid ProxyURL value, we try to request the original HTTP GET URL through the proxying mechanism provided by the server owning the proxy URL. If the server requires authorization, that should be handled by the Base transport - using most likely the OAuth2 round tripper.

Jump to

Keyboard shortcuts

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