proxy

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profile

type Profile struct {
	Default *url.URL
	Rules   []Rule
}

A Profile is set of Rules and a Default proxy URL if none of the rules match

The Default proxy URL may be nil indicating that no proxy should be used (direct connection)

type Rule

type Rule struct {
	Pattern string
	Proxy   *url.URL
}

A Rule allows to match an URL pattern to a proxy URL

The Proxy URL may be nil indicating that no proxy should be used (direct connection)

type Server

type Server struct {
	// Addr represents the Server address
	Addr string
	// contains filtered or unexported fields
}

A Server is responsible to serve http requests and proxy them to the direct target or to another proxy based on the active Profile configuration

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe calls the http.ListenAndServe function with the proxy handler

func (*Server) SetupProfile

func (s *Server) SetupProfile(profile *Profile)

SetupProfile sets the active profile

Jump to

Keyboard shortcuts

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