filter

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RuleDenyGoInstrumentationFamily = Rule{
		Base: Base{
			Name: "RuleDenyGoInstrumentationFamily",
		},
		Rule: []Filter{
			Contains{
				Base: Base{
					Name: "RuleDenyGoInstrumentationFamily",
				},
				AllowList: nil,
				DenyList: []string{
					"github.com/go-instrumentation",
				},
			},
		},
	}
	RuleDenyPbDotGo = Rule{
		Base: Base{Name: "RuleDenyPbDotGo"},
		Rule: []Filter{
			Regex{
				Base: Base{
					Name: "RuleDenyPbDotGo",
				},
				AllowList: nil,
				DenyList: []string{
					":.*\\.pb\\.go::",
				},
			},
		},
	}
	RuleDenyProtobuf = Rule{
		Base: Base{Name: "RuleDenyProtobuf"},
		Rule: []Filter{
			Contains{
				Base: Base{
					Name: "RuleDenyProtobuf",
				},
				AllowList: nil,
				DenyList: []string{
					"github.com/golang/protobuf",
					"github.com/gogo/protobuf",
				},
			},
			RuleDenyPbDotGo,
		},
	}
	RuleOnlyMain = Rule{
		Base: Base{Name: "RuleOnlyMain"},
		Rule: []Filter{
			Prefix{
				Base: Base{
					Name: "RuleOnlyMain",
				},
				AllowList: []string{
					"main",
				},
				DenyList: nil,
			},
		},
	}
	// RuleDenyAlreadyUseJaeger
	// if you are using vendor mode, the jaeger in the vendor may be difference with $GOSRC/go_instrumentation/jaeger
	RuleDenyAlreadyUseJaeger = Rule{
		Base: Base{Name: "RuleDenyAlreadyUseJaeger"},
		Rule: []Filter{
			Contains{
				Base: Base{
					Name: "RuleDenyAlreadyUseJaeger",
				},
				AllowList: nil,
				DenyList: []string{
					"github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc",
					"github.com/moby/buildkit/client",
				},
			},
		},
	}
	RuleDenyInternal = Rule{
		Base: Base{Name: "RuleDenyInternal"},
		Rule: []Filter{Contains{
			Base: Base{
				Name: "RuleDenyInternal",
			},
			AllowList: nil,
			DenyList: []string{
				"internal",
			},
		},
		},
	}
	RuleDenyGolang = Rule{
		Base: Base{Name: "RuleDenyGolang"},
		Rule: []Filter{
			Prefix{
				Base: Base{
					Name: "RuleDenyGolang",
				},
				AllowList: nil,
				DenyList: []string{
					"runtime*",
				},
			},
			Contains{
				Base: Base{
					Name: "RuleDenyGolang",
				},
				AllowList: nil,
				DenyList: []string{
					"golang.org",
				},
			},
		},
	}
	RuleDenyJaeger = Rule{
		Base: Base{Name: "RuleDenyJaeger"},
		Rule: []Filter{
			Contains{
				Base: Base{
					Name: "RuleDenyJaeger",
				},
				AllowList: nil,
				DenyList: []string{
					"github.com/opentracing/opentracing-go",
					"github.com/uber/jaeger-client-go",
					"github.com/uber/jaeger-lib",
				},
			},
		},
	}
	RuleDenyTooManyDetails = Rule{
		Base: Base{Name: "RuleDenyTooManyDetails"},
		Rule: []Filter{
			GoRootFilter,
			RuleDenyProtobuf,
			RuleDenyGolang,
			RuleDenyJaeger,
			Contains{
				Base: Base{
					Name: "RuleDenyTooManyDetails",
				},
				AllowList: nil,
				DenyList: []string{
					"github.com/checkpoint-restore/go-criu",
					"github.com/urfave/cli",
					"github.com/sirupsen/logrus",
					"github.com/pkg/errors",
					"go.opencensus.io",
					"github.com/davecgh/go-spew/spew",
				},
			},
		},
	}
)
View Source
var GlobalRule = Rule{
	Base: Base{Name: "GlobalRule"},
}
View Source
var GoRootFilter = GoRoot{
	Base{Name: "GoRootFilter"},
}
View Source
var LogSwitch = true

Functions

This section is empty.

Types

type Base

type Base struct {
	Name string
}

func (Base) String

func (b Base) String() string

type Contains

type Contains struct {
	Base
	AllowList []string
	DenyList  []string
}

func (Contains) Allow

func (f Contains) Allow(targetObject Object) (allow bool)

type Filter

type Filter interface {
	Allow(targetObject Object) (allow bool)
	String() string
}

type GoRoot

type GoRoot struct {
	Base
}

func (GoRoot) Allow

func (f GoRoot) Allow(targetObject Object) (allow bool)

type Object

type Object struct {
	Package      string
	Filepath     string
	FunctionName string
}

func ParseRule

func ParseRule(rule string) (object Object)

func (Object) String

func (o Object) String() string

type Prefix

type Prefix struct {
	Base
	AllowList []string
	DenyList  []string
}

func (Prefix) Allow

func (f Prefix) Allow(targetObject Object) (allow bool)

type Regex

type Regex struct {
	Base
	AllowList []string
	DenyList  []string
}

func (Regex) Allow

func (f Regex) Allow(targetObject Object) (allow bool)

type Rule

type Rule struct {
	Base
	Rule []Filter
}

func (Rule) Allow

func (r Rule) Allow(targetObject Object) (allow bool)

Jump to

Keyboard shortcuts

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