rule

package
v0.0.0-...-ae88a46 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package rule

@author: xwc1125

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RewriteHandler

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

func NewHandler

func NewHandler(rules map[string]string) RewriteHandler

func (*RewriteHandler) ServeHTTP

func (h *RewriteHandler) ServeHTTP(res http.ResponseWriter, req *http.Request)

type Rule

type Rule struct {
	Pattern string
	To      string
	*regexp.Regexp
}

func NewRule

func NewRule(pattern, to string) (*Rule, error)

func (*Rule) Replace

func (r *Rule) Replace(u *url.URL) string

func (*Rule) Rewrite

func (r *Rule) Rewrite(req *http.Request) bool

Jump to

Keyboard shortcuts

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