urlreplacer

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMappingNotFound     = errors.New("mapping not found")
	ErrMappingNotSpecified = errors.New("you must specify at least one mapping")
)
View Source
var (
	ErrEmptySourceURL = errors.New("source url should not be empty")
	ErrEmptyTargetURL = errors.New("target url should not be empty")
)
View Source
var (
	ErrInvalidSourceURL = errors.New("source url is invalid")
	ErrURLNotMached     = errors.New("is not matched")
)

Functions

func NormaliseMappings added in v0.0.4

func NormaliseMappings(mappings map[string]string, httpPort, httpsPort int, useHTTPS bool) (map[string]string, error)

Types

type Factory added in v0.0.4

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

func NewURLReplacerFactory

func NewURLReplacerFactory(urlMappings map[string]string) (*Factory, error)

func (*Factory) Make added in v0.0.4

func (f *Factory) Make(requestURL *url.URL) (*Replacer, *Replacer, error)

type Replacer

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

func NewReplacer added in v0.0.4

func NewReplacer(source, target string) (*Replacer, error)

func (*Replacer) IsMatched added in v0.0.4

func (r *Replacer) IsMatched(source string) bool

func (*Replacer) IsSourceSecure added in v0.0.3

func (r *Replacer) IsSourceSecure() bool

func (*Replacer) IsTargetSecure added in v0.0.3

func (r *Replacer) IsTargetSecure() bool

func (*Replacer) Replace added in v0.0.4

func (r *Replacer) Replace(source string) (string, error)

Jump to

Keyboard shortcuts

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