proposal

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertError

type AlertError interface {
	error
	BzError() BzError
	AlertMessage() *AlertMessage
}

AlertError a critical error, which will send an alert.

type AlertMessage

type AlertMessage struct {
	ProjectName  string            `json:"project_name,omitempty"`
	JournalID    string            `json:"journal_id,omitempty"`
	ErrorVerbose string            `json:"error_verbose,omitempty"`
	Meta         *AlertMessageMeta `json:"meta,omitempty"`
	Timestamp    time.Time         `json:"timestamp,omitempty"`
}

AlertMessage critical message send by alert

func (*AlertMessage) Marshal

func (a *AlertMessage) Marshal() []byte

Marshal to json raw

func (*AlertMessage) Unmarshal

func (a *AlertMessage) Unmarshal(raw []byte) error

Unmarshal from json raw

type AlertMessageMeta

type AlertMessageMeta struct {
	URL        string `json:"url,omitempty"`
	Parameters string `json:"parameters,omitempty"`
}

AlertMessageMeta some optional meta

type BzError

type BzError interface {
	error
	Code
	StackErr() errors.Error
}

BzError a business error, do not send alert.

type Code

type Code interface {
	BzCode() int
	HTTPCode() int
	Desc() string
	WithDesc(string) Code
}

Code some enum with business/http code, and some short descriptive information.

type NotifyHandler

type NotifyHandler func(msg *AlertMessage)

NotifyHandler a handler for send alert

type Payload

type Payload interface {
	JournalID() string
	ForwardedByGrpcGateway() bool
	Service() string
	Date() string
	Method() string
	URI() string
	Body() []byte
}

Payload rest or grpc payload

type SignatureHandler

type SignatureHandler func(authorizationProxy string, payload Payload) (identifier string, ok bool, err error)

SignatureHandler a handler for verify signature

type Signer added in v1.3.1

type Signer func(fullMethod string, jsonRaw []byte) (authorizationProxy, date string, err error)

Signer a handler for do sign

type UserinfoHandler

type UserinfoHandler func(authorization string, payload Payload) (userinfo interface{}, err error)

UserinfoHandler a handler for sso

type Validator

type Validator interface {
	Validate() error
}

Validator the validator for protobuf message fields

type WhitelistingHandler

type WhitelistingHandler func(xForwardedFor string) (ok bool, err error)

WhitelistingHandler a handler for filter ip

Jump to

Keyboard shortcuts

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