Documentation
¶
Index ¶
- Constants
- Variables
- func ContainsPermissions(src []string, target []string) bool
- func Exec(plugin Plugin, p ...Process) bool
- func GetFinished(ctx context.Context) bool
- func IsUnauthorizeDomainError(err error) bool
- func IsUnauthorizePathError(err error) bool
- func IsUnauthorizePermissionError(err error) bool
- func Lanuch(p Plugin, opt Options)
- func LogError(err error)
- func MatchDomain(pattern string, domain string) bool
- func MustAuthorizePermission(permissions []string, permission string) bool
- func MustCleanPath(base string, newpath string) string
- func NewUnauthorizeDomainError(domain string) error
- func NewUnauthorizePathError(path string) error
- func NewUnauthorizePermissionError(prmission string) error
- func NopPrinter(info string)
- type BasicPlugin
- func (p *BasicPlugin) HandlePluginError(err error)
- func (p *BasicPlugin) MustBootPlugin()
- func (p *BasicPlugin) MustClosePlugin()
- func (p *BasicPlugin) MustInitPlugin()
- func (p *BasicPlugin) MustLoadPlugin()
- func (p *BasicPlugin) PluginOptions() Options
- func (p *BasicPlugin) PluginPrint(info string)
- func (p *BasicPlugin) PluginType() string
- func (p *BasicPlugin) SetPluginErrorHandler(h func(err error))
- func (p *BasicPlugin) SetPluginOptions(opt Options)
- func (p *BasicPlugin) SetPluginPrinter(h func(info string))
- type ContextName
- type Location
- type Module
- type NopOptions
- type Options
- type PlainOptions
- type Plugin
- type Process
- type Trusted
- type UnauthorizeDomainError
- type UnauthorizePathError
- type UnauthorizePermissionError
Constants ¶
View Source
const ContextNameFinished = ContextName("finished")
View Source
const PermissionDangerousAPI = "DANGER!!!ALLOW-MALICIOUS-DAMAGE"
Variables ¶
View Source
var Finish = func(ctx context.Context, plugin Plugin) { result := ctx.Value(ContextNameFinished).(*bool) *result = true }
Functions ¶
func ContainsPermissions ¶
func GetFinished ¶
func IsUnauthorizePathError ¶
func MatchDomain ¶
func MustAuthorizePermission ¶
func MustCleanPath ¶
func NewUnauthorizePathError ¶
func NopPrinter ¶
func NopPrinter(info string)
Types ¶
type BasicPlugin ¶
type BasicPlugin struct {
// contains filtered or unexported fields
}
func New ¶
func New() *BasicPlugin
func (*BasicPlugin) HandlePluginError ¶
func (p *BasicPlugin) HandlePluginError(err error)
func (*BasicPlugin) MustBootPlugin ¶
func (p *BasicPlugin) MustBootPlugin()
func (*BasicPlugin) MustClosePlugin ¶
func (p *BasicPlugin) MustClosePlugin()
func (*BasicPlugin) MustInitPlugin ¶
func (p *BasicPlugin) MustInitPlugin()
func (*BasicPlugin) MustLoadPlugin ¶
func (p *BasicPlugin) MustLoadPlugin()
func (*BasicPlugin) PluginOptions ¶
func (p *BasicPlugin) PluginOptions() Options
func (*BasicPlugin) PluginPrint ¶
func (p *BasicPlugin) PluginPrint(info string)
func (*BasicPlugin) PluginType ¶
func (p *BasicPlugin) PluginType() string
func (*BasicPlugin) SetPluginErrorHandler ¶
func (p *BasicPlugin) SetPluginErrorHandler(h func(err error))
func (*BasicPlugin) SetPluginOptions ¶
func (p *BasicPlugin) SetPluginOptions(opt Options)
func (*BasicPlugin) SetPluginPrinter ¶
func (p *BasicPlugin) SetPluginPrinter(h func(info string))
type ContextName ¶
type ContextName string
type Location ¶
type Location struct {
Path string
}
func NewLoaction ¶
func NewLoaction() *Location
func (*Location) MustCleanInsidePath ¶
func (*Location) MustCleanPath ¶
type NopOptions ¶
type NopOptions struct{}
func (NopOptions) GetLocation ¶
func (o NopOptions) GetLocation() *Location
func (NopOptions) GetParam ¶
func (o NopOptions) GetParam(name string) string
func (NopOptions) MustAuthorizeDomain ¶
func (o NopOptions) MustAuthorizeDomain(domain string) bool
func (NopOptions) MustAuthorizePath ¶
func (o NopOptions) MustAuthorizePath(path string) bool
func (NopOptions) MustAuthorizePermission ¶
func (o NopOptions) MustAuthorizePermission(permission string) bool
type PlainOptions ¶
type PlainOptions struct { Location *Location Params map[string]string Trusted *Trusted Permissions []string }
func NewOptions ¶
func NewOptions() *PlainOptions
func (*PlainOptions) GetLocation ¶
func (o *PlainOptions) GetLocation() *Location
func (*PlainOptions) GetParam ¶
func (o *PlainOptions) GetParam(name string) string
func (*PlainOptions) MustAuthorizeDomain ¶
func (o *PlainOptions) MustAuthorizeDomain(domain string) bool
func (*PlainOptions) MustAuthorizePath ¶
func (o *PlainOptions) MustAuthorizePath(path string) bool
func (*PlainOptions) MustAuthorizePermission ¶
func (o *PlainOptions) MustAuthorizePermission(permission string) bool
type Process ¶
type Process func(ctx context.Context, plugin Plugin, next func(ctx context.Context, plugin Plugin))
func ComposeProcess ¶
type Trusted ¶
func NewTrusted ¶
func NewTrusted() *Trusted
func (*Trusted) MustAuthorizeDomain ¶
func (*Trusted) MustAuthorizePath ¶
type UnauthorizeDomainError ¶
type UnauthorizeDomainError struct {
}func (*UnauthorizeDomainError) Error ¶
func (e *UnauthorizeDomainError) Error() string
type UnauthorizePathError ¶
type UnauthorizePathError struct {
}func (*UnauthorizePathError) Error ¶
func (e *UnauthorizePathError) Error() string
type UnauthorizePermissionError ¶
type UnauthorizePermissionError struct {
}func (*UnauthorizePermissionError) Error ¶
func (e *UnauthorizePermissionError) Error() string
Click to show internal directories.
Click to hide internal directories.