rewriter

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRewriteRulesByMode

func GetRewriteRulesByMode(mode int) []define.Rule

GetRewriteRulesByMode returns caching rules for a specific mode

func MatchingRule

func MatchingRule(path string, rules []define.Rule) (*define.Rule, bool)

MatchingRule finds a matching rule for the given path

func RewriteRequestByMode

func RewriteRequestByMode(r *http.Request, rewriters *URLRewriters, mode int)

RewriteRequestByMode rewrites the request URL based on the mode

Types

type URLRewriter

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

URLRewriter holds the mirror and pattern for URL rewriting

type URLRewriters

type URLRewriters struct {
	Ubuntu      *URLRewriter
	UbuntuPorts *URLRewriter
	Debian      *URLRewriter
	Centos      *URLRewriter
	Alpine      *URLRewriter
	Mu          sync.RWMutex
}

URLRewriters manages rewriters for different distributions

func CreateNewRewriters

func CreateNewRewriters(mode int) *URLRewriters

CreateNewRewriters initializes rewriters based on mode

Jump to

Keyboard shortcuts

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