urlreplacer

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 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 host is invalid")
	ErrInvalidTargetURL = errors.New("target host is invalid")
	ErrURLNotMatched    = errors.New("is not matched")
)

Functions

This section is empty.

Types

type Factory added in v0.0.4

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

func NewURLReplacerFactory

func NewURLReplacerFactory(urlMappings config.Mappings) *Factory

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)

func (*Replacer) ReplaceSoft added in v0.2.1

func (r *Replacer) ReplaceSoft(source string) string

type ReplacerFactory added in v0.2.0

type ReplacerFactory interface {
	Make(requestURL *url.URL) (*Replacer, *Replacer, error)
}

Jump to

Keyboard shortcuts

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