rulemodifiers

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: BSD-3-Clause, GPL-3.0, MIT, + 1 more Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrForbiddenHeader             = errors.New("forbidden header")
	ErrInvalidRemoveheaderModifier = errors.New("invalid removeheader modifier")
)
View Source
var ErrInvalidJSONPruneModifier = errors.New("invalid jsonprune modifier")

Functions

This section is empty.

Types

type ContentTypeModifier

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

func (*ContentTypeModifier) Cancels

func (m *ContentTypeModifier) Cancels(modifier Modifier) bool

func (*ContentTypeModifier) Parse

func (m *ContentTypeModifier) Parse(modifier string) error

func (*ContentTypeModifier) ShouldMatchReq

func (m *ContentTypeModifier) ShouldMatchReq(req *http.Request) bool

func (*ContentTypeModifier) ShouldMatchRes

func (m *ContentTypeModifier) ShouldMatchRes(_ *http.Response) bool

type DomainModifier

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

func (*DomainModifier) Cancels

func (m *DomainModifier) Cancels(modifier Modifier) bool

func (*DomainModifier) Parse

func (m *DomainModifier) Parse(modifier string) error

func (*DomainModifier) ShouldMatchReq

func (m *DomainModifier) ShouldMatchReq(req *http.Request) bool

func (*DomainModifier) ShouldMatchRes

func (m *DomainModifier) ShouldMatchRes(_ *http.Response) bool

type HeaderModifier

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

func (*HeaderModifier) Cancels

func (h *HeaderModifier) Cancels(m Modifier) bool

func (*HeaderModifier) Parse

func (h *HeaderModifier) Parse(modifier string) error

func (*HeaderModifier) ShouldMatchReq

func (h *HeaderModifier) ShouldMatchReq(_ *http.Request) bool

func (*HeaderModifier) ShouldMatchRes

func (h *HeaderModifier) ShouldMatchRes(res *http.Response) bool

type JSONPruneModifier

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

func (*JSONPruneModifier) Cancels

func (m *JSONPruneModifier) Cancels(other Modifier) bool

func (*JSONPruneModifier) ModifyReq

func (m *JSONPruneModifier) ModifyReq(*http.Request) bool

func (*JSONPruneModifier) ModifyRes

func (m *JSONPruneModifier) ModifyRes(res *http.Response) (modified bool, err error)

func (*JSONPruneModifier) Parse

func (m *JSONPruneModifier) Parse(modifier string) error

type MatchingModifier

type MatchingModifier interface {
	Modifier
	ShouldMatchReq(req *http.Request) bool
	ShouldMatchRes(res *http.Response) bool
}

MatchingModifier defines whether a rule matches a request.

type MethodModifier

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

func (*MethodModifier) Cancels

func (m *MethodModifier) Cancels(modifier Modifier) bool

func (*MethodModifier) Parse

func (m *MethodModifier) Parse(modifier string) error

func (*MethodModifier) ShouldMatchReq

func (m *MethodModifier) ShouldMatchReq(req *http.Request) bool

func (*MethodModifier) ShouldMatchRes

func (m *MethodModifier) ShouldMatchRes(_ *http.Response) bool

type Modifier

type Modifier interface {
	Parse(modifier string) error
}

Modifier is a Modifier of a rule.

type ModifyingModifier

type ModifyingModifier interface {
	Modifier
	ModifyReq(req *http.Request) (modified bool)
	ModifyRes(res *http.Response) (modified bool, err error)
	Cancels(Modifier) bool
}

modifyingModifier modifies a request.

type RemoveHeaderModifier

type RemoveHeaderModifier struct {
	Kind       removeHeaderKind
	HeaderName string
}

func (*RemoveHeaderModifier) Cancels

func (rm *RemoveHeaderModifier) Cancels(modifier Modifier) bool

func (*RemoveHeaderModifier) ModifyReq

func (rm *RemoveHeaderModifier) ModifyReq(req *http.Request) (modified bool)

func (*RemoveHeaderModifier) ModifyRes

func (rm *RemoveHeaderModifier) ModifyRes(res *http.Response) (modified bool, err error)

func (*RemoveHeaderModifier) Parse

func (rm *RemoveHeaderModifier) Parse(modifier string) error

type RemoveParamModifier

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

func (*RemoveParamModifier) Cancels

func (rm *RemoveParamModifier) Cancels(modifier Modifier) bool

func (*RemoveParamModifier) ModifyReq

func (rm *RemoveParamModifier) ModifyReq(req *http.Request) (modified bool)

func (*RemoveParamModifier) ModifyRes

func (rm *RemoveParamModifier) ModifyRes(*http.Response) (modified bool, err error)

ModifyRes implements ModifyingModifier.

func (*RemoveParamModifier) Parse

func (rm *RemoveParamModifier) Parse(modifier string) error

type ScrambleJSModifier

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

func (*ScrambleJSModifier) Cancels

func (s *ScrambleJSModifier) Cancels(modifier Modifier) bool

func (*ScrambleJSModifier) ModifyReq

func (*ScrambleJSModifier) ModifyReq(*http.Request) bool

func (*ScrambleJSModifier) ModifyRes

func (s *ScrambleJSModifier) ModifyRes(res *http.Response) (bool, error)

func (*ScrambleJSModifier) Parse

func (s *ScrambleJSModifier) Parse(modifier string) error

type ThirdPartyModifier

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

https://adguard.com/kb/general/ad-filtering/create-own-filters/#third-party-modifier

func (*ThirdPartyModifier) Cancels

func (m *ThirdPartyModifier) Cancels(modifier Modifier) bool

func (*ThirdPartyModifier) Parse

func (m *ThirdPartyModifier) Parse(modifier string) error

func (*ThirdPartyModifier) ShouldMatchReq

func (m *ThirdPartyModifier) ShouldMatchReq(req *http.Request) bool

func (*ThirdPartyModifier) ShouldMatchRes

func (m *ThirdPartyModifier) ShouldMatchRes(_ *http.Response) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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