router

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = logger.Logger.WithPrefix("Violet Manager")

Functions

func GenerateHostSearch added in v0.0.12

func GenerateHostSearch(hosts []string) (string, []string)

GenerateHostSearch this should help improve performance TODO(Melon) discover how to implement this correctly

Types

type Manager

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

Manager is a database and mutex wrap around router allowing it to be dynamically regenerated after updating the database of routes.

func NewManager

func NewManager(db *database.Queries, proxy *proxy.HybridTransport) *Manager

NewManager create a new manager, initialises the routes and redirects tables in the database and runs a first time compile.

func (*Manager) Compile

func (m *Manager) Compile()

func (*Manager) DeleteRedirect

func (m *Manager) DeleteRedirect(source string) error

func (*Manager) DeleteRoute

func (m *Manager) DeleteRoute(source string) error

func (*Manager) GetAllRedirects

func (m *Manager) GetAllRedirects(hosts []string) ([]target.RedirectWithActive, error)

func (*Manager) GetAllRoutes

func (m *Manager) GetAllRoutes(hosts []string) ([]target.RouteWithActive, error)

func (*Manager) InsertRedirect

func (m *Manager) InsertRedirect(redirect target.RedirectWithActive) error

func (*Manager) InsertRoute

func (m *Manager) InsertRoute(route target.RouteWithActive) error

func (*Manager) ServeHTTP

func (m *Manager) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type Router

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

func New

func New(proxy *proxy.HybridTransport) *Router

func (*Router) AddRedirect

func (r *Router) AddRedirect(t target.Redirect)

func (*Router) AddRoute

func (r *Router) AddRoute(t target.Route)

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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